Last active
August 5, 2016 03:40
-
-
Save mcfiredrill/b8102704696f746a837bf12b21d3349d to your computer and use it in GitHub Desktop.
grep (ag) text under cursor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mapleader = "," | |
""""""""""""""""""""""""" | |
" ag command | |
""""""""""""""""""""""""" | |
map <leader>g :call GrepTextUnderCursor()<CR> | |
function! GrepTextUnderCursor() | |
let word_under_cursor = expand("<cword>") | |
exec ":Ag! " . word_under_cursor | |
endfunction | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" disable arrow keys so you get used to moving with hjkl | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
map <Left> <Nop> | |
map <Right> <Nop> | |
map <Up> <Nop> | |
map <Down> <Nop> | |
" Move around splits with <c-hjkl> | |
nnoremap <c-j> <c-w>j | |
nnoremap <c-k> <c-w>k | |
nnoremap <c-h> <c-w>h | |
nnoremap <c-l> <c-w>l | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment