1
0
Fork 0
mirror of synced 2024-12-21 06:21:07 -05:00

Smaller changes to the core vimrcs

Default to Ag (instead of Ack)... Much faster.
Performance improvements due to smaller history.
Don't remember the position in file (this slows Vim down considerably.
This commit is contained in:
amix 2015-07-13 11:21:10 +01:00
parent 14babd4799
commit 9a2843c2a5
2 changed files with 24 additions and 14 deletions

View file

@ -44,7 +44,7 @@
" => General " => General
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sets how many lines of history VIM has to remember " Sets how many lines of history VIM has to remember
set history=700 set history=500
" Enable filetype plugins " Enable filetype plugins
filetype plugin on filetype plugin on
@ -232,7 +232,7 @@ map <C-l> <C-W>l
map <leader>bd :Bclose<cr> map <leader>bd :Bclose<cr>
" Close all the buffers " Close all the buffers
map <leader>ba :1,1000 bd!<cr> map <leader>ba :bufdo bd<cr>
" Useful mappings for managing tabs " Useful mappings for managing tabs
map <leader>tn :tabnew<cr> map <leader>tn :tabnew<cr>
@ -262,12 +262,12 @@ catch
endtry endtry
" Return to last edit position when opening files (You want this!) " Return to last edit position when opening files (You want this!)
autocmd BufReadPost * " autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") | " \ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" | " \ exe "normal! g`\"" |
\ endif " \ endif
" Remember info about open buffers on close " Remember info about open buffers on close
set viminfo^=% " set viminfo^=%
"""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""
@ -310,21 +310,21 @@ autocmd BufWrite *.coffee :call DeleteTrailingWS()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Ack searching and cope displaying " => Ag searching and cope displaying
" requires ack.vim - it's much better than vimgrep/grep " requires ag.vim - it's much better than vimgrep/grep
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" When you press gv you Ack after the selected text " When you press gv you Ag after the selected text
vnoremap <silent> gv :call VisualSelection('gv', '')<CR> vnoremap <silent> gv :call VisualSelection('gv', '')<CR>
" Open Ack and put the cursor in the right position " Open Ag and put the cursor in the right position
map <leader>g :Ack map <leader>g :Ag
" When you press <leader>r you can search and replace the selected text " When you press <leader>r you can search and replace the selected text
vnoremap <silent> <leader>r :call VisualSelection('replace', '')<CR> vnoremap <silent> <leader>r :call VisualSelection('replace', '')<CR>
" Do :help cope if you are unsure what cope is. It's super useful! " Do :help cope if you are unsure what cope is. It's super useful!
" "
" When you search with Ack, display your results in cope by doing: " When you search with Ag, display your results in cope by doing:
" <leader>cc " <leader>cc
" "
" To go to the next search result do: " To go to the next search result do:
@ -389,7 +389,7 @@ function! VisualSelection(direction, extra_filter) range
if a:direction == 'b' if a:direction == 'b'
execute "normal ?" . l:pattern . "^M" execute "normal ?" . l:pattern . "^M"
elseif a:direction == 'gv' elseif a:direction == 'gv'
call CmdLine("Ack \"" . l:pattern . "\" " ) call CmdLine("Ag \"" . l:pattern . "\" " )
elseif a:direction == 'replace' elseif a:direction == 'replace'
call CmdLine("%s" . '/'. l:pattern . '/') call CmdLine("%s" . '/'. l:pattern . '/')
elseif a:direction == 'f' elseif a:direction == 'f'

View file

@ -116,3 +116,13 @@ nnoremap <silent> <leader>z :Goyo<cr>
" => Syntastic (syntax checker) " => Syntastic (syntax checker)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:syntastic_python_checkers=['pyflakes'] let g:syntastic_python_checkers=['pyflakes']
let g:syntastic_javascript_checkers = ['jshint']
" Custom CoffeeScript SyntasticCheck
func! SyntasticCheckCoffeescript()
let l:filename = substitute(expand("%:p"), '\(\w\+\)\.coffee', '.coffee.\1.js', '')
execute "e " . l:filename
execute "SyntasticCheck"
execute "Errors"
endfunc
nnoremap <silent> <leader>l :call SyntasticCheckCoffeescript()<cr>