Functions for using pick from within Vim.
Please note: pick requires a fully functional terminal to run therefore cannot be run from within gvim or MacVim.
Recommended installation with Vundle:
Plugin 'thoughtbot/pick.vim'
pick.vim provides the following functions:
Pick a file to edit.
If you are working from within a git repository, PickFile()
will use git ls-files
to get the files to pick from. If not, it will use find
.
Pick a file to edit in a new split.
Pick a file to edit in a new vertical split.
Pick a file to edit in a new tab.
Pick a buffer to edit.
Pick a tag to jump to.
Run the choice_command
in from the shell and pipe the results to pick run with
pick_args
and call the vim_command
with the selected choice.
For example, you could implement PickFile()
like this:
call PickCommand("find * -type f", "", ":edit")
Add your preferred key mappings to your .vimrc
file:
nnoremap <Leader>p :call PickFile()<CR>
nnoremap <Leader>s :call PickFileSplit()<CR>
nnoremap <Leader>v :call PickFileVerticalSplit()<CR>
nnoremap <Leader>t :call PickFileTab()<CR>
nnoremap <Leader>b :call PickBuffer()<CR>
nnoremap <Leader>] :call PickTag()<CR>
The name of the pick executable can be configured with:
let g:pick_executable = "pick"
Copyright (c) 2014 Calle Erlandsson & thoughtbot, Inc.
Lead by Calle Erlandsson & thoughtbot, Inc.