home: vim: add 'after'

This commit is contained in:
Bruno BELANYI 2021-02-23 15:08:46 +00:00
parent d74aead9ae
commit f1e4a4d914
31 changed files with 364 additions and 0 deletions

View file

@ -0,0 +1,14 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" 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

@ -0,0 +1,13 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Use a small indentation value on beancount files
setlocal shiftwidth=2
let b:undo_ftplugin.='|setlocal shiftwidth<'
" Have automatic padding of transactions so that decimal is on 52nd column
let g:beancount_separator_col=52
" Automatic padding for transactions
nnoremap <buffer> <leader>= :AlignCommodity<CR>
vnoremap <buffer> <leader>= :AlignCommodity<CR>

View file

@ -0,0 +1,14 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" More warnings and the usual version in flags for Clang
let b:ale_c_clang_options='-Wall -Wextra -pedantic -std=c99'
let b:undo_ftplugin.='|unlet! b:ale_c_clang_options'
" More warnings and the usual version in flags for GCC
let b:ale_c_gcc_options='-Wall -Wextra -pedantic -std=c99'
let b:undo_ftplugin.='|unlet! b:ale_c_gcc_options'
" 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

@ -0,0 +1,6 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Use 2 spaces indentation inside CMake files
setlocal shiftwidth=2
let b:undo_ftplugin.='|setlocal shiftwidth<'

View file

@ -0,0 +1,14 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" More warnings and the usual version in flags for Clang
let b:ale_cpp_clang_options='-Wall -Wextra -pedantic -std=c++17'
let b:undo_ftplugin.='|unlet! b:ale_cpp_clang_options'
" More warnings and the usual version in flags for GCC
let b:ale_cpp_gcc_options='-Wall -Wextra -pedantic -std=c++17'
let b:undo_ftplugin.='|unlet! b:ale_cpp_gcc_options'
" 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

@ -0,0 +1,6 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Use my desired ALE fixer for D
let b:ale_fixers=[ 'dfmt' ]
let b:undo_ftplugin.='|unlet! b:ale_fixers'

View file

@ -0,0 +1,6 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Don't highlight trailing whitespace in fugitive windows
let b:better_whitespace_enabled=0
let b:undo_ftplugin.='|unlet! b:better_whitespace_enabled'

View file

@ -0,0 +1,6 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Enable spell checking on commit messages
setlocal spell
let b:undo_ftplugin.='|setlocal spell<'

View file

@ -0,0 +1,6 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Git configuration files should use tabs to indent
setlocal noexpandtab
let b:undo_ftplugin.='|setlocal noexpandtab<'

View file

@ -0,0 +1,6 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Disable the prompt to delete whitespace
DisableStripWhitespaceOnSave
let b:undo_ftplugin.='|EnableStripWhitespaceOnSave'

View file

@ -0,0 +1,30 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Use a small indentation value on Haskell files
setlocal shiftwidth=2
let b:undo_ftplugin.='|setlocal shiftwidth<'
" Use my desired ALE fixers for Haskell
let b:ale_fixers=[ 'brittany' ]
let b:undo_ftplugin.='|unlet! b:ale_fixers'
" Use stack-managed `hlint`
let b:ale_haskell_hlint_executable='stack'
let b:undo_ftplugin.='|unlet! b:ale_haskell_hlint_executable'
" Use stack-managed `brittany`
let b:ale_haskell_brittany_executable='stack'
let b:undo_ftplugin.='|unlet! b:ale_haskell_brittany_executable'
" Use dynamic libraries because of Arch linux, with default ALE options
let b:ale_haskell_ghc_options='--dynamic -fno-code -v0'
let b:undo_ftplugin.='|unlet! b:ale_haskell_ghc_options'
" Automatically format files when saving them
let b:ale_fix_on_save=1
let b:undo_ftplugin='|unlet! b:ale_lint_on_save'
" Change max length of a line to 100 for this buffer to match official guidelines
setlocal colorcolumn=100
let b:undo_ftplugin.='|setlocal colorcolumn<'

View file

@ -0,0 +1,6 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Don't highlight trailing whitespace in help windows
let b:better_whitespace_enabled=0
let b:undo_ftplugin.='|unlet! b:better_whitespace_enabled'

View file

@ -0,0 +1,6 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Use my desired ALE fixer for JSON
let b:ale_fixers=[ 'jq' ]
let b:undo_ftplugin.='|unlet! b:ale_fixers'

View file

@ -0,0 +1,6 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Change max length of a line to 72 to follow the netiquette
setlocal colorcolumn=72
let b:undo_ftplugin.='|setlocal colorcolumn<'

View file

@ -0,0 +1,6 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Makefiles should use tabs to indent
setlocal noexpandtab
let b:undo_ftplugin.='|setlocal noexpandtab<'

View file

@ -0,0 +1,6 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Don't show Netrw in buffer list
setlocal bufhidden=delete
let b:undo_ftplugin='|setlocal bufhidden<'

View file

@ -0,0 +1,14 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Let ALE know that I want Markdown linters
let b:ale_linter_aliases=[ 'markdown' ]
let b:undo_ftplugin.='|unlet! b:ale_linter_aliases'
" Use a small indentation value on Pandoc files
setlocal shiftwidth=2
let b:undo_ftplugin.='|setlocal shiftwidth<'
" Use my usual text width
setlocal textwidth=80
let b:undo_ftplugin.='|setlocal textwidth<'

View file

@ -0,0 +1,40 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" 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'
" Use pyls inside the python environment if needed
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={
\ 'pyls': {
\ 'plugins': {
\ 'pycodestyle': {
\ 'enabled': v:false
\ },
\ },
\ },
\ }
let b:undo_ftplugin.='|unlet! b:ale_python_pyls_config'
" Don't use mypy to check for syntax errors
let b:ale_python_mypy_ignore_invalid_syntax=1
let b:undo_ftplugin.='|unlet! b:ale_python_mypy_ignore_invalid_syntax'
" Use mypy inside the python environment if needed
let b:ale_python_mypy_auto_pipenv=1
let b:undo_ftplugin.='|unlet! b:ale_python_mypy_auto_pipenv'
" Automatically format files when saving them
let b:ale_fix_on_save=1
let b:undo_ftplugin='|unlet! b:ale_lint_on_save'
" 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

@ -0,0 +1,8 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" 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>
let b:undo_ftplugin.='|nunmap <buffer> l'

View file

@ -0,0 +1,31 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Check tests too
let b:ale_rust_cargo_check_tests=1
let b:undo_ftplugin='|unlet! b:ale_rust_cargo_check_tests'
" Check examples too
let b:ale_rust_cargo_check_examples=1
let b:undo_ftplugin='|unlet! b:ale_rust_cargo_check_examples'
" Use clippy if it's available instead of just cargo check
let b:ale_rust_cargo_use_clippy=executable('cargo-clippy')
let b:undo_ftplugin='|unlet! b:ale_rust_cargo_use_clippy'
" Use rust-analyzer instead of RLS as a linter
let b:ale_linters=[ 'cargo', 'analyzer' ]
let b:undo_ftplugin='|unlet! b:ale_linters'
" Use rustfmt as ALE fixer for rust
let b:ale_fixers=[ 'rustfmt' ]
let b:undo_ftplugin.='|unlet! b:ale_fixers'
" Automatically format files when saving them
let b:ale_fix_on_save=1
let b:undo_ftplugin='|unlet! b:ale_lint_on_save'
" Change max length of a line to 99 for this buffer to match official guidelines
setlocal colorcolumn=99
let b:undo_ftplugin.='|setlocal colorcolumn<'

View file

@ -0,0 +1,14 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" 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

@ -0,0 +1,6 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Use 2 spaces indentation inside TeX files
setlocal shiftwidth=2
let b:undo_ftplugin.='|setlocal shiftwidth<'

View file

@ -0,0 +1,6 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Use a small indentation value on YAML files
setlocal shiftwidth=2
let b:undo_ftplugin.='|setlocal shiftwidth<'

View file

@ -0,0 +1,14 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" 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'

View file

@ -0,0 +1,2 @@
" Use ALE LSP-powered symbol information
nnoremap <Leader>K :ALEHover<CR>

View file

@ -0,0 +1,10 @@
" Visual bindings for merging diffs as in normal mode
xnoremap dp :diffput<cr>
xnoremap do :diffget<cr>
" Open status window
nnoremap <Leader>gs :Gstatus<CR>
" Open diff view of current buffer: the up/left window is the current index
nnoremap <Leader>gd :Gdiffsplit!<CR>
" Open current file log in new tab, populate its location list with history
nnoremap <Leader>gl :sp<CR><C-w>T:Gllog --follow -- %:p<CR>

View file

@ -0,0 +1,38 @@
" Only git-tracked files, Vim needs to be in a Git repository
nnoremap <Leader>fg :GFiles<CR>
" All files
nnoremap <Leader>ff :Files<CR>
" Currently open buffers
nnoremap <Leader>fb :Buffers<CR>
" Buffer history
nnoremap <Leader>fh :History<CR>
" Tags in buffer
nnoremap <Leader>ft :BTags<CR>
" Tags in all project files
nnoremap <Leader>fT :Tags<CR>
" Snippets for the current fileytpe (using Ultisnips)
nnoremap <Leader>fs :Snippets<CR>
" All available commands
nnoremap <Leader>f: :Commands<CR>
" All commits (using fugitive)
nnoremap <Leader>fc :Commits<CR>
" All commits for the current buffer (using fugitive)
nnoremap <Leader>fC :BCommits<CR>
" Select normal mode mapping by searching for its name
nmap <Leader><Tab> <Plug>(fzf-maps-n)
" Select visual mode mapping by searching for its name
xmap <Leader><Tab> <Plug>(fzf-maps-x)
" Select operator pending mode mapping by searching for its name
omap <Leader><Tab> <Plug>(fzf-maps-o)

View file

@ -0,0 +1,8 @@
" Yank until the end of line with Y, to be more consistent with D and C
nnoremap Y y$
" Run make silently, then skip the 'Press ENTER to continue'
noremap <Leader>m :silent! :make! \| :redraw!<CR>
" Remove search-highlighting
noremap <Leader><Leader> :nohls<CR>

View file

@ -0,0 +1,11 @@
" Next and previous in quick-fix list
nmap <Leader>fn <Plug>(qf_qf_next)
nmap <Leader>fp <Plug>(qf_qf_previous)
" Next and previous in location list
nmap <Leader>ln <Plug>(qf_loc_next)
nmap <Leader>lp <Plug>(qf_loc_previous)
" Toggle quick-fix and location lists
nmap <Leader>tf <Plug>(qf_qf_toggle)
nmap <Leader>tl <Plug>(qf_loc_toggle)

View file

@ -0,0 +1,7 @@
" Better fr layout mappings for vim-unimpaired and other '[' and ']' commands
nmap ( [
nmap ) ]
omap ( [
omap ) ]
xmap ( [
xmap ) ]

View file

@ -47,6 +47,10 @@
}; };
xdg.configFile = { xdg.configFile = {
"nvim/after" = {
source = ./after;
};
"nvim/autoload" = { "nvim/autoload" = {
source = ./autoload; source = ./autoload;
}; };