From 061f2a2298c2c8419d9cab61749d9db3758f8690 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 13 Jul 2015 17:29:22 -0400 Subject: vimrc: Add extended pick.vim buffer mappings * Add new mappings to have pick.vim open buffers in a new split, vsplit, or tab * Add `PickBufferListCommand` function copied directly from the pick.vim plugin to give me the correct pick list since the function isn't accessible outside the script. We can then combine this list with the appropriate opening command. --- vimrc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/vimrc b/vimrc index d634cfa..cc4c163 100644 --- a/vimrc +++ b/vimrc @@ -308,6 +308,8 @@ " 2015.07.13: " * Use `find` as our pick.vim command in order to include untracked git " files in the pick list. +" * Add mappings to use pick.vim for opening buffers in new splits, +" vsplits, and tabs " @@ -480,11 +482,20 @@ let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""' " pick let g:pick_command = "find * -type f -o -type l" + +function! PickBufferListCommand() + let bufnrs = filter(range(1, bufnr("$")), 'buflisted(v:val)') + let buffers = map(bufnrs, 'bufname(v:val)') + return 'echo "' . join(buffers, "\n") . '"' +endfunction + nnoremap xd :call PickCommand(g:pick_command, "", ":edit") nnoremap xs :call PickCommand(g:pick_command, "", ":split") nnoremap xv :call PickCommand(g:pick_command, "", ":vsplit") nnoremap xt :call PickCommand(g:pick_command, "", ":tabedit") -nnoremap xb :call PickBuffer() +nnoremap xbs :call PickCommand(PickBufferListCommand(), "", ":split") +nnoremap xbv :call PickCommand(PickBufferListCommand(), "", ":vsplit") +nnoremap xbt :call PickCommand(PickBufferListCommand(), "", ":tabedit") nnoremap x] :call PickTag() -- cgit v1.2.3