aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2020-09-24 20:29:17 +0200
committerTeddy Wing2020-09-28 20:55:52 +0200
commit44b3924298992c374b4ed4b11d900c072ae8264b (patch)
treed72030af04ae3915144e7f4f9872ad5f5d8ff054
parentfcf6c84515e745ff581684bd8390ffa6e478abe4 (diff)
downloaddotvim-44b3924298992c374b4ed4b11d900c072ae8264b.tar.bz2
vimrc: Add `<leader>db` mapping to open files with TBuffer using Pick
I've been using my `TBuffer` command recently, but don't like how I have to type out parts of the file name interspersed with "*"s, and press `<Tab>` to ensure I'm getting the right file in case there are multiple matches. Make it easier to use `TBuffer` by allowing fuzzy finding with Pick. This allows us to filter the list of buffers, choosing one to pass to `TBuffer`. Used the buffer list because the function is readily available, and because there's no easy way to get a list of all buffer names in all tabs. I'd probably have to map over `gettabinfo()`, and get the buffer name for each window. Or manually filter the `:tabs` output. Chose `db` because `dt` is taken for opening a file in a new tab, and the word "tab" ends in "b". Now that I think about it, though, this command deals with buffers, so it probably makes more sense to put it under the "b" namespace.
-rw-r--r--vimrc5
1 files changed, 5 insertions, 0 deletions
diff --git a/vimrc b/vimrc
index 5908e2c..e8603ee 100644
--- a/vimrc
+++ b/vimrc
@@ -467,6 +467,9 @@
" 2020.09.22:
" * Add i_^r^f mapping to insert the current filename.
"
+" 2020.09.24:
+" * Add <leader>db to open buffers with Pick and :TBuffer.
+"
" Pathogen
@@ -636,6 +639,8 @@ nnoremap <leader>bs :call PickCommand(PickBufferListCommand(), "", ":split")<cr>
nnoremap <leader>bv :call PickCommand(PickBufferListCommand(), "", ":vsplit")<cr>
nnoremap <leader>bt :call PickCommand(PickBufferListCommand(), "", ":tabedit")<cr>
nnoremap <leader>d] :call PickTag()<cr>
+nnoremap <leader>db
+ \ :call PickCommand(PickBufferListCommand(), '', ':TBuffer')<cr>
" PreserveNoEOL