From 44b3924298992c374b4ed4b11d900c072ae8264b Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 24 Sep 2020 20:29:17 +0200 Subject: vimrc: Add `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 `` 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. --- vimrc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'vimrc') 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 db to open buffers with Pick and :TBuffer. +" " Pathogen @@ -636,6 +639,8 @@ nnoremap bs :call PickCommand(PickBufferListCommand(), "", ":split") nnoremap bv :call PickCommand(PickBufferListCommand(), "", ":vsplit") nnoremap bt :call PickCommand(PickBufferListCommand(), "", ":tabedit") nnoremap d] :call PickTag() +nnoremap db + \ :call PickCommand(PickBufferListCommand(), '', ':TBuffer') " PreserveNoEOL -- cgit v1.2.3