[UPDATE][VIM] Use b:undo_ftplugin

You're supposed to undo the changes that you made to a buffer's
variables when doing filetype-related settings. The variable
'b:undo_ftplugin' contains the commands necessary to revert any changes
that you have made to accomodate this filetype.

I removed the mappings for left and right in a quickfix windows because
I don't use them, and the 'qf' plug-in already maps those (meaning I had
an error when I tried to unmap them after qf already did so).
This commit is contained in:
Bruno BELANYI 2019-10-13 19:33:20 +02:00
parent a0a11c5eb9
commit 0473705335
12 changed files with 23 additions and 4 deletions

View file

@ -1,8 +1,11 @@
" Use shfmt as ALE fixer for bash
let b:ale_fixers=[ 'shfmt' ]
let b:undo_ftplugin.='|unlet b:ale_fixers'
" Indent with 4 spaces, simplify script, indent switch cases, use Bash variant
let b:ale_sh_shfmt_options='-i 4 -s -ci -ln bash'
let b:undo_ftplugin.='|unlet b:ale_sh_shfmt_options'
" Use bash dialect explicitly, require explicit empty string test
let b:ale_sh_shellcheck_options='-s bash -o avoid-nullary-conditions'
let b:undo_ftplugin.='|unlet b:ale_sh_shellcheck_options'

View file

@ -1,2 +1,3 @@
" Use compile_commands.json to look for additional flags
let b:ale_c_parse_compile_commands=1
let b:undo_ftplugin.='|unlet b:ale_c_parse_compile_commands'

View file

@ -1,2 +1,3 @@
" Use compile_commands.json to look for additional flags
let b:ale_c_parse_compile_commands=1
let b:undo_ftplugin.='|unlet b:ale_c_parse_compile_commands'

View file

@ -1,2 +1,3 @@
" Use my desired ALE fixer for D
let b:ale_fixers=[ 'dfmt' ]
let b:undo_ftplugin.='|unlet b:ale_fixers'

View file

@ -1,2 +1,3 @@
" Enable spell checking on commit messages
setlocal spell
let b:undo_ftplugin.='|setlocal spell<'

View file

@ -1,2 +1,3 @@
" Use my desired ALE fixer for JSON
let b:ale_fixers=[ 'jq' ]
let b:undo_ftplugin.='|unlet b:ale_fixers'

View file

@ -1,2 +1,3 @@
" Let ALE know that I want Markdown linters
let b:ale_linter_aliases=[ 'markdown' ]
let b:undo_ftplugin.='|unlet b:ale_linter_aliases'

View file

@ -1,10 +1,13 @@
" Use my desired ALE fixers for python
let b:ale_fixers=[ 'black', 'isort' ]
let b:undo_ftplugin.='|unlet b:ale_fixers'
" Use my desired ALE linters for python
let b:ale_linters=[ 'flake8', 'mypy', 'pylint', 'pyls' ]
let b:undo_ftplugin.='|unlet b:ale_linters'
"let b:ale_python_pyls_executable='pyls'
let b:ale_python_pyls_auto_pipenv=1
let b:undo_ftplugin.='|unlet b:ale_python_pyls_auto_pipenv'
" Disable pycodestyle checks from pyls because I'm already using flake8
let b:ale_python_pyls_config={
@ -16,6 +19,8 @@ let b:ale_python_pyls_config={
\ },
\ },
\ }
let b:undo_ftplugin.='|unlet b:ale_python_pyls_config'
" Change max length of a line to 88 for this buffer to match black's settings
setlocal colorcolumn=88
let b:undo_ftplugin.='|setlocal colorcolumn<'

View file

@ -1,7 +1,5 @@
" Use h/l to go to the previous/next non-empty quickfix or location list
nnoremap <silent> <buffer> h :call quickfixed#older()<CR>
let b:undo_ftplugin.='|nunmap <buffer> h'
nnoremap <silent> <buffer> l :call quickfixed#newer()<CR>
" Use left/right to go to the previous/next non-empty quickfix or location list
nnoremap <silent> <buffer> <Left> :call quickfixed#older()<CR>
nnoremap <silent> <buffer> <Right> :call quickfixed#newer()<CR>
let b:undo_ftplugin.='|nunmap <buffer> l'

View file

@ -1,2 +1,3 @@
" Use rustfmt as ALE fixer for rust
let b:ale_fixers=[ 'rustfmt' ]
let b:undo_ftplugin.='|unlet b:ale_fixers'

View file

@ -1,8 +1,11 @@
" Use shfmt as ALE fixer for sh
let b:ale_fixers=[ 'shfmt' ]
let b:undo_ftplugin.='|unlet b:ale_fixers'
" Indent with 4 spaces, simplify the code, indent switch cases, use POSIX
let b:ale_sh_shfmt_options='-i 4 -s -ci -ln posix'
let b:undo_ftplugin.='|unlet b:ale_sh_shfmt_options'
" Require explicit empty string test
let b:ale_sh_shellcheck_options='-o avoid-nullary-conditions'
let b:undo_ftplugin.='|unlet b:ale_sh_shellcheck_options'

View file

@ -1,8 +1,11 @@
" Use shfmt as ALE fixer for zsh
let b:ale_fixers=[ 'shfmt' ]
let b:undo_ftplugin.='|unlet b:ale_fixers'
" Indent with 4 spaces, simplify script, indent switch cases, use Bash variant
let b:ale_sh_shfmt_options='-i 4 -s -ci -ln bash'
let b:undo_ftplugin.='|unlet b:ale_sh_shfmt_options'
" Use bash dialect explicitly, require explicit empty string test
let b:ale_sh_shellcheck_options='-s bash -o avoid-nullary-conditions'
let b:undo_ftplugin.='|unlet b:ale_sh_shellcheck_options'