[UPDATE][VIM] Factorise b:undo_ftplugin
Instead of re-writing the same condition each time, I put the function in an autoload plugin instead (which is going to be loaded just about every time I start writing code, but that's neither here nor there) to stop repeating myself.
This commit is contained in:
parent
36faab278e
commit
d9eab5526f
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" Use shfmt as ALE fixer for bash
|
" Use shfmt as ALE fixer for bash
|
||||||
let b:ale_fixers=[ 'shfmt' ]
|
let b:ale_fixers=[ 'shfmt' ]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" More warnings and the usual version in flags for Clang
|
" More warnings and the usual version in flags for Clang
|
||||||
let b:ale_c_clang_options='-Wall -Wextra -pedantic -std=c99'
|
let b:ale_c_clang_options='-Wall -Wextra -pedantic -std=c99'
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" More warnings and the usual version in flags for Clang
|
" More warnings and the usual version in flags for Clang
|
||||||
let b:ale_cpp_clang_options='-Wall -Wextra -pedantic -std=c++17'
|
let b:ale_cpp_clang_options='-Wall -Wextra -pedantic -std=c++17'
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" Use my desired ALE fixer for D
|
" Use my desired ALE fixer for D
|
||||||
let b:ale_fixers=[ 'dfmt' ]
|
let b:ale_fixers=[ 'dfmt' ]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" Don't highlight trailing whitespace in fugitive windows
|
" Don't highlight trailing whitespace in fugitive windows
|
||||||
let b:better_whitespace_enabled=0
|
let b:better_whitespace_enabled=0
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" Enable spell checking on commit messages
|
" Enable spell checking on commit messages
|
||||||
setlocal spell
|
setlocal spell
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" Use my desired ALE fixer for JSON
|
" Use my desired ALE fixer for JSON
|
||||||
let b:ale_fixers=[ 'jq' ]
|
let b:ale_fixers=[ 'jq' ]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" Makefiles should use tabs to indent
|
" Makefiles should use tabs to indent
|
||||||
setlocal noexpandtab
|
setlocal noexpandtab
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" Don't show Netrw in buffer list
|
" Don't show Netrw in buffer list
|
||||||
setlocal bufhidden=delete
|
setlocal bufhidden=delete
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" Let ALE know that I want Markdown linters
|
" Let ALE know that I want Markdown linters
|
||||||
let b:ale_linter_aliases=[ 'markdown' ]
|
let b:ale_linter_aliases=[ 'markdown' ]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" Use my desired ALE fixers for python
|
" Use my desired ALE fixers for python
|
||||||
let b:ale_fixers=[ 'black', 'isort' ]
|
let b:ale_fixers=[ 'black', 'isort' ]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" Use h/l to go to the previous/next non-empty quickfix or location list
|
" Use h/l to go to the previous/next non-empty quickfix or location list
|
||||||
nnoremap <silent> <buffer> h :call quickfixed#older()<CR>
|
nnoremap <silent> <buffer> h :call quickfixed#older()<CR>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" Check tests too
|
" Check tests too
|
||||||
let b:ale_rust_cargo_check_tests=1
|
let b:ale_rust_cargo_check_tests=1
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" Use shfmt as ALE fixer for sh
|
" Use shfmt as ALE fixer for sh
|
||||||
let b:ale_fixers=[ 'shfmt' ]
|
let b:ale_fixers=[ 'shfmt' ]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
if !exists("b:undo_ftplugin")
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
let b:undo_ftplugin=''
|
call ftplugined#check_undo_ft()
|
||||||
endif
|
|
||||||
|
|
||||||
" Use shfmt as ALE fixer for zsh
|
" Use shfmt as ALE fixer for zsh
|
||||||
let b:ale_fixers=[ 'shfmt' ]
|
let b:ale_fixers=[ 'shfmt' ]
|
||||||
|
|
6
vim/.vim/autoload/ftplugined.vim
Normal file
6
vim/.vim/autoload/ftplugined.vim
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||||
|
function! ftplugined#check_undo_ft()
|
||||||
|
if !exists("b:undo_ftplugin")
|
||||||
|
let b:undo_ftplugin=''
|
||||||
|
endif
|
||||||
|
endfunction
|
Loading…
Reference in a new issue