aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2015-07-13 17:29:22 -0400
committerTeddy Wing2015-07-13 17:29:22 -0400
commit061f2a2298c2c8419d9cab61749d9db3758f8690 (patch)
treeb0f9ef3e8843c862d963a458561a3a0095b4a1b6
parent736dfe7dd17289a8c83873af873c2b86c62de90f (diff)
downloaddotvim-061f2a2298c2c8419d9cab61749d9db3758f8690.tar.bz2
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.
-rw-r--r--vimrc13
1 files changed, 12 insertions, 1 deletions
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 <leader>xd :call PickCommand(g:pick_command, "", ":edit")<cr>
nnoremap <leader>xs :call PickCommand(g:pick_command, "", ":split")<cr>
nnoremap <leader>xv :call PickCommand(g:pick_command, "", ":vsplit")<cr>
nnoremap <leader>xt :call PickCommand(g:pick_command, "", ":tabedit")<cr>
-nnoremap <leader>xb :call PickBuffer()<cr>
+nnoremap <leader>xbs :call PickCommand(PickBufferListCommand(), "", ":split")<cr>
+nnoremap <leader>xbv :call PickCommand(PickBufferListCommand(), "", ":vsplit")<cr>
+nnoremap <leader>xbt :call PickCommand(PickBufferListCommand(), "", ":tabedit")<cr>
nnoremap <leader>x] :call PickTag()<cr>