Merge pull request #110 from majjoha/majjoha/add-filetypes-command

Add `Filetypes` command.
This commit is contained in:
Junegunn Choi 2016-04-04 00:35:01 +09:00
commit ee71f5a207
4 changed files with 15 additions and 0 deletions

View file

@ -69,6 +69,7 @@ Commands
| `Commands` | Commands |
| `Maps` | Normal mode mappings |
| `Helptags` | Help tags <sup id="a1">[1](#helptags)</sup> |
| `Filetypes` | File types
- Most commands support `CTRL-T` / `CTRL-X` / `CTRL-V` key
bindings to open in a new tab, a new split, or in a new vertical split

View file

@ -713,6 +713,18 @@ function! fzf#vim#helptags(...)
\ 'options': '--ansi +m --tiebreak=begin --with-nth ..-2'}, a:000)
endfunction
" ------------------------------------------------------------------
" File types
" ------------------------------------------------------------------
function! fzf#vim#filetypes(...)
return s:fzf({
\ 'source': sort(map(split(globpath(&rtp, 'syntax/*.vim'), '\n'),
\ 'fnamemodify(v:val, ":t:r")')),
\ 'sink': 'setf',
\ 'options': '+m --prompt="File types> "'
\}, a:000)
endfunction
" ------------------------------------------------------------------
" Windows
" ------------------------------------------------------------------

View file

@ -95,6 +95,7 @@ COMMANDS *fzf-vim-commands*
`Commands` | Commands
`Maps` | Normal mode mappings
`Helptags` | Help tags [1]
`Filetypes` | File types
-----------------+-------------------------------------------------------------------
- Most commands support CTRL-T / CTRL-X / CTRL-V key bindings to open in a new

View file

@ -60,6 +60,7 @@ call s:defs([
\'command! -bang Commits call fzf#vim#commits(s:w(<bang>0))',
\'command! -bang BCommits call fzf#vim#buffer_commits(s:w(<bang>0))',
\'command! -bang Maps call fzf#vim#maps("n", s:w(<bang>0))',
\'command! -bang Filetypes call fzf#vim#filetypes(s:w(<bang>0))',
\'command! -bang -nargs=* History call s:history(<q-args>, <bang>0)'])
function! s:history(arg, bang)