diff options
author | aszlig <aszlig@redmoonstudios.org> | 2017-09-05 16:55:32 +0200 |
---|---|---|
committer | aszlig <aszlig@redmoonstudios.org> | 2017-09-05 17:01:21 +0200 |
commit | c5f3a3fd462e52e6dc2563eb3792d1f6a4e94032 (patch) | |
tree | 3cbfc969954e304f2adaab6bb3c32a82f09853f7 /pkgs/aszlig | |
parent | ae4f9930d56d2d130b553b45f63b2a119e1fc9f1 (diff) |
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 <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/aszlig')
-rw-r--r-- | pkgs/aszlig/vim/default.nix | 26 |
1 files changed, 13 insertions, 13 deletions
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} ''; |