1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 17:45:00 +08:00

Updated plugins. Switched to Ack as standard search tool (much better than grep/vimgrep)

This commit is contained in:
amix
2014-02-07 10:41:15 +00:00
parent e62adb8084
commit 8265dca5d5
76 changed files with 3855 additions and 143 deletions

View File

@ -293,23 +293,21 @@ autocmd BufWrite *.coffee :call DeleteTrailingWS()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => vimgrep searching and cope displaying
" => Ack searching and cope displaying
" requires ack.vim - it's much better than vimgrep/grep
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" When you press gv you vimgrep after the selected text
" When you press gv you Ack after the selected text
vnoremap <silent> gv :call VisualSelection('gv', '')<CR>
" Open vimgrep and put the cursor in the right position
map <leader>g :vimgrep // **/*.<left><left><left><left><left><left><left>
" Vimgreps in the current file
map <leader><space> :vimgrep // <C-R>%<C-A><right><right><right><right><right><right><right><right><right>
" Open Ack and put the cursor in the right position
map <leader>g :Ack
" When you press <leader>r you can search and replace the selected text
vnoremap <silent> <leader>r :call VisualSelection('replace', '')<CR>
" Do :help cope if you are unsure what cope is. It's super useful!
"
" When you search with vimgrep, display your results in cope by doing:
" When you search with Ack, display your results in cope by doing:
" <leader>cc
"
" To go to the next search result do:
@ -373,7 +371,7 @@ function! VisualSelection(direction, extra_filter) range
if a:direction == 'b'
execute "normal ?" . l:pattern . "^M"
elseif a:direction == 'gv'
call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.' . a:extra_filter)
call CmdLine("Ack \"" . l:pattern . "\" " )
elseif a:direction == 'replace'
call CmdLine("%s" . '/'. l:pattern . '/')
elseif a:direction == 'f'