m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 16:45:38 -05:00

Add template selection exemple

Vinícius Hoyer
2019-10-11 09:20:12 -03:00
parent b8d1b844aa
commit b781f2a2cf

@@ -306,4 +306,24 @@ 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')
\ })
```