Skip to content

Instantly share code, notes, and snippets.

@raine
Created October 7, 2015 09:42
Show Gist options
  • Save raine/86a5ddfddb5a8f645c3a to your computer and use it in GitHub Desktop.
Save raine/86a5ddfddb5a8f645c3a to your computer and use it in GitHub Desktop.
function! AgSearchAndReplaceCursor()
let search = expand('<cword>')
execute "Ag! " . search
call feedkeys(':QFdo %s/' . search . "//gc")
call feedkeys("\<Left>\<Left>\<Left>")
endfunction
nmap <space>ac :silent Ag<CR> " word on cursor
nmap <space>ag :silent Ag! ""<Left>
nmap <space>as :silent AgFromSearch<CR>
nmap <space>ar :call AgSearchAndReplaceCursor()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment