From c5f3a3fd462e52e6dc2563eb3792d1f6a4e94032 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 5 Sep 2017 16:55:32 +0200 Subject: pkgs/vim: Clean up autocommands I was using set for a bunch of these, but these autocommands are only used for single buffers so let's actually make sure they are set only there by using setlocal. In addition to that I've corrected usage of '==' to use '==#', because '==' actually depends on user settings whether it's case sensitive or not (set ignorecase). Signed-off-by: aszlig --- pkgs/aszlig/vim/default.nix | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'pkgs/aszlig') diff --git a/pkgs/aszlig/vim/default.nix b/pkgs/aszlig/vim/default.nix index aa1c0b47..4915a2b7 100644 --- a/pkgs/aszlig/vim/default.nix +++ b/pkgs/aszlig/vim/default.nix @@ -327,12 +327,12 @@ let \ exe "normal! g'\"zz" | endif " filetype defaults - au BufNewFile,BufRead *.as set ft=actionscript - au BufNewFile,BufRead *.tt set ft=tt2html ts=2 sw=2 sts=2 et - au BufNewFile,BufRead *.html set ts=2 sw=2 sts=2 et - au FileType python set textwidth=79 - au FileType gitcommit set textwidth=72 - au FileType docbk set tabstop=2 shiftwidth=2 expandtab + au BufNewFile,BufRead *.as setlocal ft=actionscript + au BufNewFile,BufRead *.tt setlocal ft=tt2html ts=2 sw=2 sts=2 et + au BufNewFile,BufRead *.html setlocal ts=2 sw=2 sts=2 et + au FileType python setlocal textwidth=79 + au FileType gitcommit setlocal textwidth=72 + au FileType docbk setlocal tabstop=2 shiftwidth=2 expandtab " highlight unnecessary whitespace highlight ExtraWhitespace ctermbg=red guibg=red @@ -346,14 +346,17 @@ let au BufWinEnter * if &ft !=# 'csv' \ | let w:m2=matchadd('ErrorMsg', '\%>79v.\+', -1) \ | endif + + " flake everything that has been *detected* as python (not just by suffix) + au BufWritePost * if &ft ==# 'python' | call Flake8() | endif ''; - misc = '' + functions = '' " ASCII art mode fun! AAMode() highlight clear ExtraWhitespace for m in getmatches() - if m.group == 'ErrorMsg' && m.pattern == '\%>79v.\+' + if m.group ==# 'ErrorMsg' && m.pattern ==# '\%>79v.\+' call matchdelete(m.id) endif endfor @@ -361,9 +364,6 @@ let command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis \ | wincmd p | diffthis - - " flake everything that has been *detected* as python (not just by suffix). - autocmd BufWritePost * if &ft ==# 'python' | call Flake8() | endif ''; vimrc = writeText "vimrc" '' @@ -376,11 +376,11 @@ let syntax on colorscheme elflord + ${functions} + if has("autocmd") ${autocmd} endif - - ${misc} ''; -- cgit 1.4.1