diff --git a/vimrc b/vimrc index 4000926..50a52d5 100644 --- a/vimrc +++ b/vimrc @@ -676,15 +676,15 @@ function! s:CompleteFilenameWithoutExtension(ArgLead, CmdLine, CursorPos) endfunction " Custom command to open cpp and h files without typing an extension -"command! -nargs=+ -complete=custom,s:CompleteFilenameWithoutExtension OpenCppSource execute ':e .cpp' +"command! -nargs=+ -complete=custom,s:CompleteFilenameWithoutExtension "OpenCppSource exec ':e .cpp' ":ca c OpenCppSource ":ca C OpenCppSource -"command! -nargs=+ -complete=custom,s:CompleteFilenameWithoutExtension OpenCppHeader execute ':e .h' +"command! -nargs=+ -complete=custom,s:CompleteFilenameWithoutExtension "OpenCppHeader exec ':e .h' ":ca h OpenCppHeader ":ca H OpenCppHeader -"command! -nargs=+ -complete=custom,s:CompleteFilenameWithoutExtension OpenCppSourceAndHeader execute ':vsp | :e .h | :sp .cpp' +"command! -nargs=+ -complete=custom,s:CompleteFilenameWithoutExtension "OpenCppSourceAndHeader exec ':vsp | :e .h | :sp .cpp' ":ca b OpenCppSourceAndHeader ":ca B OpenCppSourceAndHeader @@ -929,8 +929,8 @@ set statusline=%<%f\ (%{&ft})\ %-4(%m%)%=%-19(%3l,%02c%03V%) " COLORS """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -execute "autocmd ColorScheme " . g:campo_dark_theme . " call ReloadRainbow()" -execute "autocmd ColorScheme " . g:campo_light_theme . " call ReloadRainbow()" +exec "autocmd ColorScheme " . g:campo_dark_theme . " call ReloadRainbow()" +exec "autocmd ColorScheme " . g:campo_light_theme . " call ReloadRainbow()" " Switch between light and dark themes. map l :call ChangeBgTheme('light', 0) @@ -1020,7 +1020,7 @@ augroup END "################################################################ function! PrintError(msg) abort - execute 'normal! \' + exec 'normal! \' echohl ErrorMsg echomsg a:msg echohl None @@ -1149,6 +1149,15 @@ nnoremap p (&buftype is# "quickfix" ? "\|:copen" : "p") " SEARCH & REPLACE """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" argdo wrapper that will disable all events for read/save. This significantly +" speeds up GlobalReplaceIt(). +command! -nargs=? Argdo call Argdo() +function! Argdo(command) + set eventignore=all + exec 'noautocmd argdo '. a:command . ' | update' + set eventignore= +endfunction + " Replace the selected text in all files within the repo. function! GlobalReplaceIt(confirm_replacement) if exists(':Ggrep') @@ -1178,8 +1187,10 @@ function! GlobalReplaceIt(confirm_replacement) let l:confirm_opt = 'e' endif - execute 'Ggrep '.l:term - execute 'Qargs | argdo %s/'.l:term.'/'.l:replacement.'/g'.l:confirm_opt + exec 'Ggrep '.l:term + exec 'Qargs | Argdo %s/'.l:term.'/'.l:replacement.'/g'.l:confirm_opt + " Regen ctags. + call s:RunCtags() else PrintError "Unable to search since you're not in a git repo!" endif