mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-18 16:45:38 -05:00
Add template selection exemple
@@ -307,3 +307,23 @@ The default value of `g:netrw_dirhistmax` is 10. You might be interested in incr
|
||||
```viml
|
||||
let g:netrw_dirhistmax = 1000
|
||||
```
|
||||
|
||||
### Fuzzy file template search
|
||||
|
||||
Say you have a folder with files in it you use for templating, and you want a fzf menu to choose which file will be loaded:
|
||||
|
||||
```viml
|
||||
"
|
||||
" choose from templates and apply to file
|
||||
"
|
||||
function! s:read_template_into_buffer(template)
|
||||
" has to be a function to avoid the extra space fzf#run insers otherwise
|
||||
execute '0r ~/.vim/templates/'.a:template
|
||||
endfunction
|
||||
|
||||
command! -bang -nargs=* LoadTemplate call fzf#run({
|
||||
\ 'source': 'ls -1 ~/.config/nvim/templates',
|
||||
\ 'down': 20,
|
||||
\ 'sink': function('<sid>read_template_into_buffer')
|
||||
\ })
|
||||
```
|
||||
Reference in New Issue
Block a user