From c205313b2527cd1085c3ee154dbf2277b411390c Mon Sep 17 00:00:00 2001 From: yan Date: Fri, 20 Jan 2012 18:43:49 -0800 Subject: [PATCH] ,q/ ,qg/ ,qa/ Quickfix search aliases inspired by Steve Losh --- README.md | 7 +++++-- vim/plugin/settings/quickfix-search.vim | 9 +++++++++ vim/plugin/settings/skwp-keymap.vim | 6 +++--- 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 vim/plugin/settings/quickfix-search.vim diff --git a/README.md b/README.md index 1bb5a80..d31f961 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,9 @@ files contain key mappings as well (TODO: probably will move them out to skwp-ke * ,gg - GitGrep command line with a quote pretyped (close the quote yourself) * ,gcp - GitGrep Current Partial to find references to the current view partial * // - clear the search + * ,q/ - quickfix window with last search (stolen from Steve Losh) + * ,qa/ - quickfix Ack last search (Steve Losh) + * ,qg/ - quickfix GitGrep last search * ,T - Tag list (list of methods in a class) **File Navigation** @@ -237,8 +240,8 @@ files contain key mappings as well (TODO: probably will move them out to skwp-ke * vv - vertical split (Ctrl-w,v) * ss - horizontal split (Ctrl-w,s) * ,, - zoom a window to max size and again to unzoom it (ZoomWin plugin, usually C-w,o) - * ,oq - open quickfix window (this is where output from GitGrep goes) - * ,q - close quickfix + * ,qo - open quickfix window (this is where output from GitGrep goes) + * ,qc - close quickfix **NERDTree Project Tree** diff --git a/vim/plugin/settings/quickfix-search.vim b/vim/plugin/settings/quickfix-search.vim new file mode 100644 index 0000000..c4c78c5 --- /dev/null +++ b/vim/plugin/settings/quickfix-search.vim @@ -0,0 +1,9 @@ +" Stolen from Steve Losh vimrc: https://bitbucket.org/sjl/dotfiles/src/tip/vim/.vimrc +" Open a Quickfix window for the last search. +nnoremap q/ :execute 'vimgrep /'.@/.'/g %':copen + +" Ack for the last search. +nnoremap qa/ :execute "Ack! '" . substitute(substitute(substitute(@/, "\\\\<", "\\\\b", ""), "\\\\>", "\\\\b", ""), "\\\\v", "", "") . "'" + +" GitGrep the last search (my own invention) +nnoremap qg/ :execute "GitGrep '" . substitute(substitute(substitute(@/, "\\\\<", "\\\\b", ""), "\\\\>", "\\\\b", ""), "\\\\v", "", "") . "'" diff --git a/vim/plugin/settings/skwp-keymap.vim b/vim/plugin/settings/skwp-keymap.vim index b28b0d4..337f89a 100644 --- a/vim/plugin/settings/skwp-keymap.vim +++ b/vim/plugin/settings/skwp-keymap.vim @@ -14,7 +14,7 @@ nnoremap ,yw yiww " ,ow = 'overwrite word', replace a word with what's in the yank buffer " FIXME: will not properly repeat when you use a dot (tie into repeat.vim) -nnoremap ,ow viwp +nnoremap ,ow "_diwhp "make Y consistent with C and D nnoremap Y y$ @@ -59,8 +59,8 @@ nmap :NERDTreeToggle " ,q to toggle quickfix window (where you have stuff like GitGrep) " ,oq to open it back up (rare) -nmap ,q :cclose -nmap ,oq :copen +nmap ,qc :cclose +nmap ,qo :copen " move up/down quickly by using Ctrl-j, Ctrl-k " which will move us around by functions