diff --git a/README.md b/README.md index 4e86397..67396fc 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ Commands | `Commands` | Commands | | `Maps` | Normal mode mappings | | `Helptags` | Help tags [1](#helptags) | +| `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 diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 8d7b3e1..74aeb79 100644 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -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 " ------------------------------------------------------------------ diff --git a/doc/fzf-vim.txt b/doc/fzf-vim.txt index c1f9219..b1f53da 100644 --- a/doc/fzf-vim.txt +++ b/doc/fzf-vim.txt @@ -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 diff --git a/plugin/fzf.vim b/plugin/fzf.vim index dbde8f8..d846500 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -60,6 +60,7 @@ call s:defs([ \'command! -bang Commits call fzf#vim#commits(s:w(0))', \'command! -bang BCommits call fzf#vim#buffer_commits(s:w(0))', \'command! -bang Maps call fzf#vim#maps("n", s:w(0))', +\'command! -bang Filetypes call fzf#vim#filetypes(s:w(0))', \'command! -bang -nargs=* History call s:history(, 0)']) function! s:history(arg, bang)