,K - Git grep up to next exclamation. Useful for ruby method grepping
This commit is contained in:
parent
413f989dd5
commit
4a2bd58c99
@ -189,7 +189,8 @@ 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)
|
||||
* K - GitGrep the current word under the cursor and show results in quickfix window
|
||||
* 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)
|
||||
* ,hl - toggle search highlight on and off
|
||||
* ,gg - GitGrep command line with a quote pretyped (close the quote yourself)
|
||||
|
20
vim/plugin/settings/git-grep.vim
Normal file
20
vim/plugin/settings/git-grep.vim
Normal file
@ -0,0 +1,20 @@
|
||||
"git grep the current word using K (mnemonic Kurrent)
|
||||
nnoremap <silent> K :GitGrep <cword><CR>
|
||||
function! GetVisual()
|
||||
let reg_save = getreg('"')
|
||||
let regtype_save = getregtype('"')
|
||||
let cb_save = &clipboard
|
||||
set clipboard&
|
||||
normal! ""gvy
|
||||
let selection = getreg('"')
|
||||
call setreg('"', reg_save, regtype_save)
|
||||
let &clipboard = cb_save
|
||||
return selection
|
||||
endfunction
|
||||
|
||||
"git grep visual selection
|
||||
vnoremap K :<C-U>execute GitGrep(GetVisual())<CR>
|
||||
|
||||
"git grep current word up to the next exclamation point using ,K
|
||||
nnoremap ,K viwf!:<C-U>execute GitGrep(GetVisual())<CR>
|
||||
|
@ -85,9 +85,6 @@ nnoremap <silent> ,f <C-]>
|
||||
"toggle between last two buffers with Z (normally ctrl-shift-6)
|
||||
nnoremap <silent> ,z <C-^>
|
||||
|
||||
"git grep the current word using K (mnemonic Kurrent)
|
||||
nnoremap <silent> K :GitGrep <cword><CR>
|
||||
|
||||
" ==============================
|
||||
" Window/Tab/Split Manipulation
|
||||
" ==============================
|
||||
|
Loading…
Reference in New Issue
Block a user