From 5716eaa23974997fae9ac9a5d44293319d07b6a4 Mon Sep 17 00:00:00 2001 From: yan Date: Wed, 25 Jan 2012 12:09:40 -0800 Subject: [PATCH 1/2] Improve window killer (Q) - close window if multiple windows to same buffer exist --- vim/plugin/settings/window-killer.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vim/plugin/settings/window-killer.vim b/vim/plugin/settings/window-killer.vim index 71ff415..804b4b4 100644 --- a/vim/plugin/settings/window-killer.vim +++ b/vim/plugin/settings/window-killer.vim @@ -2,7 +2,9 @@ " (if there are multiple windows into the same buffer) " or kill the buffer entirely if it's the last window looking into that buffer function! CloseWindowOrKillBuffer() - if(bufwinnr('%')) > 1 + let number_of_windows_to_this_buffer = len(filter(range(1, winnr('$')), "winbufnr(v:val) == bufnr('%')")) + + if number_of_windows_to_this_buffer > 1 wincmd c else bdelete From 1217f5277a9c75b13608a9803de6b3e1f0d4bfb7 Mon Sep 17 00:00:00 2001 From: yan Date: Wed, 25 Jan 2012 12:10:02 -0800 Subject: [PATCH 2/2] Added ,F - find tag in vertical split window --- README.md | 1 + vim/plugin/settings/skwp-keymap.vim | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 4e46ffc..f9955cc 100644 --- a/README.md +++ b/README.md @@ -290,6 +290,7 @@ files contain key mappings as well (TODO: probably will move them out to skwp-ke **Search/Code Navigation** * ,f - instantly Find definition of class (must have exuberant ctags installed) + * ,F - same as ,f but in a vertical split * K - GitGrep the current word under the cursor and show results in quickfix window * ,K - GitGrep the current word up to next exclamation point (useful for ruby foo! methods) * Cmd-* - highlight all occurrences of current word (similar to regular * except doesn't move) diff --git a/vim/plugin/settings/skwp-keymap.vim b/vim/plugin/settings/skwp-keymap.vim index 6c91dfe..fd5d97f 100644 --- a/vim/plugin/settings/skwp-keymap.vim +++ b/vim/plugin/settings/skwp-keymap.vim @@ -94,6 +94,10 @@ nnoremap ,gcp :GitGrepCurrentPartial " this uses ctags. the standard way to get this is Ctrl-] nnoremap ,f +" use ,F to jump to tag in a vertical split +nnoremap ,F :let word=expand(""):vsp:wincmd w:exec("tag ". word) + + "toggle between last two buffers with Z (normally ctrl-shift-6) nnoremap ,z