vim-picker is a fuzzy picker for Neovim and Vim.
vim-picker allows you to search for and select files, buffers, and tags using a
fuzzy selector such as fzy, pick, or selecta.
It has advantages over plugins with a similar purpose such as ctrlp.vim and
Command-T:
- It uses the embedded terminal emulator when used within Neovim, so the fuzzy selector does not block the UI. Whilst selecting an item you can move to another buffer, edit that buffer, and return to the fuzzy selector to continue where you left off.
- It adheres to the Unix philosophy, and does not reimplement existing tools.
File listing is achieved using the best tool for the job:
gitin Git repositories andrgelsewhere, falling back tofindifrgis not available. Fuzzy text selection is done withfzyby default: a fast, well behaved interactive filter. - It doesn't define default key mappings, allowing you to define your own mappings that best fit your workflow and don't conflict with your other plugins.
To use vim-picker you will first need a fuzzy selector such as fzy
(recommended), pick, or selecta installed. See their
respective homepages for installation instructions.
To install vim-picker using vim-plug, add the following to your vimrc
($HOME/.vim/vimrc for Vim and
${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.vim for Neovim), restart Vim, and
run :PlugInstall:
Plug 'srstevenson/vim-picker'Using Dein.vim, add the following to your vimrc, restart Vim, and run :call dein#install():
call dein#add('srstevenson/vim-picker')Using Vundle, add the following to your vimrc, restart Vim, and run
:PluginInstall:
Plugin 'srstevenson/vim-picker'If you have Vim 7.4.1840 or newer, you can use the native package
support instead of a plugin manager by cloning vim-picker into a
directory under packpath. For Vim:
git clone https://github.com/srstevenson/vim-picker \
~/.vim/pack/plugins/start/vim-pickerFor Neovim:
git clone https://github.com/srstevenson/vim-picker \
${XDG_DATA_HOME:-$HOME/.local/share}/nvim/site/pack/plugins/start/vim-pickervim-picker provides the following commands:
:PickerEdit: Pick a file to edit in the current window.:PickerSplit: Pick a file to edit in a new horizontal split.:PickerTabedit: Pick a file to edit in a new tab.:PickerVsplit: Pick a file to edit in a new vertical split.:PickerBuffer: Pick a buffer to edit in the current window.:PickerTag: Pick a tag to jump to in the current window.:PickerBufferTag: Pick a tag from the current buffer to jump to.:PickerHelp: Pick a help tag to jump to in the current window.
vim-picker defines the following <Plug> mappings:
<Plug>PickerEdit: Execute:PickerEdit.<Plug>PickerSplit: Execute:PickerSplit.<Plug>PickerTabedit: Execute:PickerTabedit.<Plug>PickerVsplit: Execute:PickerVsplit.<Plug>PickerBuffer: Execute:PickerBuffer.<Plug>PickerTag: Execute:PickerTag.<Plug>PickerBufferTag: Execute:PickerBufferTag.<Plug>PickerHelp: Execute:PickerHelp.
These are not mapped to key sequences, to allow you to choose those that best fit your workflow and don't conflict with other plugins you use. However if you have no preference, the following snippet maps each mapping to a mnemonic key sequence:
nmap <unique> <leader>pe <Plug>PickerEdit
nmap <unique> <leader>ps <Plug>PickerSplit
nmap <unique> <leader>pt <Plug>PickerTabedit
nmap <unique> <leader>pv <Plug>PickerVsplit
nmap <unique> <leader>pb <Plug>PickerBuffer
nmap <unique> <leader>p] <Plug>PickerTag
nmap <unique> <leader>po <Plug>PickerBufferTag
nmap <unique> <leader>ph <Plug>PickerHelpfzy is used as the default fuzzy selector. To use an alternative selector,
set g:picker_selector in your vimrc. For example, set
let g:picker_selector = 'pick'to use pick. vim-picker has been tested with fzy, pick, and selecta,
but any well behaved command line filter should work. If you run Vim within
tmux, setting g:picker_selector to the fzy-tmux script
distributed with fzy will open the fuzzy selector in a new tmux pane below
Vim, providing an interface similar to using vim-picker with Neovim.
To specify the height of the window in which the fuzzy selector is opened in
Neovim, set g:picker_height in your vimrc. The default is 10 lines:
let g:picker_height = 10Copyright © 2016-2017 Scott Stevenson.
vim-picker is distributed under the terms of the ISC licence.
