Skip to content

Instantly share code, notes, and snippets.

@mcfiredrill
Last active August 5, 2016 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcfiredrill/b8102704696f746a837bf12b21d3349d to your computer and use it in GitHub Desktop.
Save mcfiredrill/b8102704696f746a837bf12b21d3349d to your computer and use it in GitHub Desktop.
grep (ag) text under cursor
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