This plugin is DEPRECATED since the commands are now provided by default by vim-fzy.
Fuzzy-select buffers, files in arglist
, tags, help tags, oldfiles
, and file
marks using the fuzzy-searcher fzy.
- Vim
>= 8.1.1828
(>= 8.2.0204
for popup window) - fzy
- vim-fzy (see installation instructions below)
- cut(1) (for the :Help command)
Command | Description |
---|---|
:Buffer | List buffers, edit selected buffer in current window. |
:SBuffer* | Same as :Buffer, but edit the selected buffer in a new split. |
:Args | List global arglist, edit selected file in current window. |
:SArgs* | Same as :Args, but edit the selected file in a new split. |
:Largs | List local arglist, edit selected file in current window. |
:SLargs* | Same as :Largs, but edit the selected file in a new split. |
:MRUedit | List Most-Recently-Used files, edit selected file in current window. |
:MRUsplit* | Same as :MRUedit, but edit the selected file in a new split. |
:Tjump | List tags, jump to selected tag in current window. |
:STjump* | Same as :Tjump, but jump to the selected tag in a new split. |
:Marks | List marks, jump to the selected mark in the current window. |
:SMarks* | Same as :Marks, but jump to the selected mark in a new split. |
:Help* | List help tags, open help page with the selected tag in new split. |
*Commands that split the current window accept a command modifier. For example, to open the help page with the selected tag in a new vertical split, run :vertical Help. :tab MRUsplit will open the selected file in a new tab.
For a full list of supported command modifiers, see :help fzy-:SBuffer.
Options can be passed to fzy through the dictionary g:fzy
. Currently, the
following entries are supported:
Entry | Description | Default |
---|---|---|
lines |
Specify how many lines of results to show. Sets the fzy --lines option. |
10 |
prompt |
Set the fzy input prompt. | '▶ ' |
showinfo |
If true, fzy is invoked with the --show-info option. |
0 |
term_highlight |
Highlight group for the terminal window. | 'Terminal' |
popupwin |
Display fzy in a popup terminal. | v:false |
popup |
Popup window options. Entry must be a dictionary. | see below |
Note: All entries are also used by vim-fzy-find to provide a uniform fzy interface.
The appearance of the popup window can be changed through the popup
key. When
unspecified or set to an empty dictionary, the following values are used:
{
'padding': [0, 1, 0, 1],
'border': [],
'minwidth': 80
}
The following popup
entries can be set: line
, col
, pos
, minwidth
,
drag
, resize
, close
, padding
, border
, borderhighlight
,
borderchars
, highlight
, and zindex
. For more details on each entry see
:help popup-usage as well as the examples below.
- Display 15 items, use a custom prompt, and show the selection info line:
let g:fzy = { \ 'lines': 15, \ 'prompt': '>>> ', \ 'showinfo': 1 \ }
- Same as 1. but display fzy in a popup window, use the default popup options:
let g:fzy = { \ 'lines': 15, \ 'prompt': '>>> ', \ 'showinfo': 1, \ 'popupwin': 1, \ 'popup': {} \ }
- Use a custom popup border and custom highlighting:
let g:fzy = { \ 'lines': 15, \ 'showinfo': 1, \ 'term_highlight': 'NormalDark', \ 'popupwin': 1, \ 'popup': { \ 'minwidth': 90, \ 'highlight': 'NormalDark', \ 'borderchars': ['─', '│', '─', '│', '┌', '┐', '┘', '└'], \ 'padding': [0, 1, 0, 1], \ 'borderhighlight': ['GreyDark'] \ } \ }
- Same as 3. but don't draw a popup border:
let g:fzy = { \ 'lines': 15, \ 'showinfo': 1, \ 'term_highlight': 'NormalDark', \ 'popupwin': 1, \ 'popup': { \ 'minwidth': 90, \ 'highlight': 'NormalDark', \ 'borderchars': [' '], \ 'padding': [0, 1, 0, 1], \ 'borderhighlight': ['GreyDark'] \ } \ }
- Open the popup window at the 5th screen line from the top of the screen:
let g:fzy = { \ 'lines': 15, \ 'showinfo': 1, \ 'popupwin': 1, \ 'popup': { \ 'padding': [0, 1, 0, 1], \ 'pos': 'topleft', \ 'line': 5, \ } \ }
If you prefer shorter Ex commands, add the following to your vimrc
:
command ME MRUedit
command MS MRUsplit
command MV vertical MRUsplit
command MT tab MRUsplit
The command names are inspired by vim-tinyMRU.
If you prefer mappings over Ex commands, you might find the following useful:
" Jump between listed buffers
nnoremap <silent> <leader>be :<c-u>Buffer<cr>
nnoremap <silent> <leader>bs :<c-u>SBuffer<cr>
nnoremap <silent> <leader>bv :<c-u>vertical SBuffer<cr>
nnoremap <silent> <leader>bt :<c-u>tab SBuffer<cr>
" Jump between buffers in global arglist
nnoremap <silent> <leader>ae :<c-u>Args<cr>
nnoremap <silent> <leader>as :<c-u>SArgs<cr>
nnoremap <silent> <leader>av :<c-u>vertical SArgs<cr>
nnoremap <silent> <leader>at :<c-u>tab SArgs<cr>
" Quickly edit oldfiles
nnoremap <silent> <leader>me :<c-u>MRUedit<cr>
nnoremap <silent> <leader>ms :<c-u>MRUsplit<cr>
nnoremap <silent> <leader>mv :<c-u>vertical MRUsplit<cr>
nnoremap <silent> <leader>mt :<c-u>tab MRUsplit<cr>
" Quickly jump to tag location
nnoremap <silent> <leader>te :<c-u>Tjump<cr>
nnoremap <silent> <leader>ts :<c-u>STjump<cr>
nnoremap <silent> <leader>tv :<c-u>vertical STjump<cr>
nnoremap <silent> <leader>tt :<c-u>tab STjump<cr>
" Quickly open help pages
nnoremap <silent> <leader>hh :<c-u>Help<cr>
nnoremap <silent> <leader>hv :<c-u>vertical Help<cr>
nnoremap <silent> <leader>ht :<c-u>tab Help<cr>
Run the following commands in your terminal:
$ cd ~/.vim/pack/git-plugins/start
$ git clone https://github.com/bfrg/vim-fzy
$ git clone https://github.com/bfrg/vim-fzy-builtins
$ vim -u NONE -c "helptags vim-fzy/doc" -c q
$ vim -u NONE -c "helptags vim-fzy-builtins/doc" -c q
Note: The directory name git-plugins
is arbitrary, you can pick any other
name. For more details see :help packages.
Assuming vim-plug is your favorite plugin manager, add the following to
your vimrc
:
Plug 'bfrg/vim-fzy'
Plug 'bfrg/vim-fzy-builtins'
Distributed under the same terms as Vim itself. See :help license.