diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-03-18 18:06:31 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-03-18 18:06:31 -0300 |
commit | 7a8a48f3072c0124734573d42f525ca481a66ddd (patch) | |
tree | b38ec21c0aa281051e2d34da7b75736811fa5b01 | |
parent | 7dedc657174479fa281b770f3d9b07fe202dbef2 (diff) | |
download | vim-7a8a48f3072c0124734573d42f525ca481a66ddd.tar.gz vim-7a8a48f3072c0124734573d42f525ca481a66ddd.tar.bz2 |
Avoid autocmd spam
-rw-r--r-- | vimrc.dot.link | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/vimrc.dot.link b/vimrc.dot.link index ed464aa..38df4a4 100644 --- a/vimrc.dot.link +++ b/vimrc.dot.link @@ -35,8 +35,13 @@ function! ResetTitle(title) exec ":!xtitle " a:title endfunction -au VimLeave *mutt/* silent call ResetTitle("mutt") -au VimLeave *remind/* silent call ResetTitle("wyrd") +" Avoid autocmd spam by using augroups and reseting autocmd +" https://stackoverflow.com/questions/19030290/syntax-highlighting-causes-terrible-lag-in-vim +augroup vimleave + autocmd! + au VimLeave *mutt/* silent call ResetTitle("mutt") + au VimLeave *remind/* silent call ResetTitle("calendar") +augroup END " Command mode completion " See https://stackoverflow.com/questions/526858/how-do-i-make-vim-do-normal-bash-like-tab-completion-for-file-names @@ -62,22 +67,27 @@ set wildmenu let php_sql_query=1 " Filetypes -au BufNewFile,BufRead *.vue set ft=html -au BufNewFile,BufRead *.thtml set ft=php -au BufNewFile,BufRead *.mdwn set ft=ikiwiki -au BufNewFile,BufRead *.md set ft=ikiwiki -au BufNewFile,BufRead *.rem set ft=remind -au BufNewFile,BufRead *.trac set ft=tracwiki -au BufNewFile,BufRead *.tracwiki set ft=tracwiki -au BufNewFile,BufRead Vagrantfile set ft=ruby +augroup vimrc_syntax + autocmd! + au BufNewFile,BufRead *.vue set ft=html + au BufNewFile,BufRead *.thtml set ft=php + au BufNewFile,BufRead *.mdwn set ft=ikiwiki + au BufNewFile,BufRead *.md set ft=ikiwiki + au BufNewFile,BufRead *.rem set ft=remind + au BufNewFile,BufRead *.trac set ft=tracwiki + au BufNewFile,BufRead *.tracwiki set ft=tracwiki + au BufNewFile,BufRead Vagrantfile set ft=ruby +augroup END augroup mkd - autocmd BufRead *.mkd set ai formatoptions=tcroqn2 comments=n:> + autocmd! + autocmd BufRead *.mkd set ai formatoptions=tcroqn2 comments=n:> augroup END if has("autocmd") " Drupal *.module and *.install files. augroup module + autocmd! autocmd BufRead,BufNewFile *.profile set filetype=php autocmd BufRead,BufNewFile *.module set filetype=php autocmd BufRead,BufNewFile *.install set filetype=php @@ -276,12 +286,15 @@ imap <ESC><Up> <ESC><C-w><Up> " NERDTree section " Thanks to http://stackoverflow.com/questions/1447334/how-do-you-add-nerdtree-to-your-vimrc -" Open NERDTree when vim starts -"autocmd VimEnter * NERDTree -"autocmd VimEnter * wincmd p +augroup nerdtree + autocmd! + " Open NERDTree when vim starts + "autocmd VimEnter * NERDTree + "autocmd VimEnter * wincmd p -autocmd FileType nerdtree set relativenumber -autocmd FileType taglist set relativenumber + autocmd FileType nerdtree set relativenumber + autocmd FileType taglist set relativenumber +augroup END function TabNew(address) execute ":tabnew" @@ -315,7 +328,10 @@ vmap <C-x> "+c " Workaround for mail editing. There must be a plugin enabling autoindent in " mail composition, which is annoying. -au FileType mail set noautoindent +augroup mail + autocmd! + au FileType mail set noautoindent +augroup END " For email: unfold and delete to your signature " See https://hroy.eu/tips/vim/email-delete-til-signature/ |