From f1e4a4d914aed756aa9ba42a9df3a83b3f730f03 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 23 Feb 2021 15:08:46 +0000 Subject: [PATCH] home: vim: add 'after' --- home/vim/after/ftplugin/bash.vim | 14 +++++++ home/vim/after/ftplugin/beancount.vim | 13 ++++++ home/vim/after/ftplugin/c.vim | 14 +++++++ home/vim/after/ftplugin/cmake.vim | 6 +++ home/vim/after/ftplugin/cpp.vim | 14 +++++++ home/vim/after/ftplugin/d.vim | 6 +++ home/vim/after/ftplugin/fugitive.vim | 6 +++ home/vim/after/ftplugin/gitcommit.vim | 6 +++ home/vim/after/ftplugin/gitconfig.vim | 6 +++ home/vim/after/ftplugin/gitsendemail.vim | 6 +++ home/vim/after/ftplugin/haskell.vim | 30 ++++++++++++++ home/vim/after/ftplugin/help.vim | 6 +++ home/vim/after/ftplugin/json.vim | 6 +++ home/vim/after/ftplugin/mail.vim | 6 +++ home/vim/after/ftplugin/make.vim | 6 +++ home/vim/after/ftplugin/netrw.vim | 6 +++ home/vim/after/ftplugin/pandoc.vim | 14 +++++++ home/vim/after/ftplugin/python.vim | 40 +++++++++++++++++++ home/vim/after/ftplugin/qf.vim | 8 ++++ home/vim/after/ftplugin/rust.vim | 31 ++++++++++++++ home/vim/after/ftplugin/sh.vim | 14 +++++++ home/vim/after/ftplugin/tex.vim | 6 +++ home/vim/after/ftplugin/yaml.vim | 6 +++ home/vim/after/ftplugin/zsh.vim | 14 +++++++ home/vim/after/plugin/mappings/ale.vim | 2 + home/vim/after/plugin/mappings/fugitive.vim | 10 +++++ home/vim/after/plugin/mappings/fzf.vim | 38 ++++++++++++++++++ home/vim/after/plugin/mappings/misc.vim | 8 ++++ home/vim/after/plugin/mappings/qf.vim | 11 +++++ home/vim/after/plugin/mappings/unimpaired.vim | 7 ++++ home/vim/default.nix | 4 ++ 31 files changed, 364 insertions(+) create mode 100644 home/vim/after/ftplugin/bash.vim create mode 100644 home/vim/after/ftplugin/beancount.vim create mode 100644 home/vim/after/ftplugin/c.vim create mode 100644 home/vim/after/ftplugin/cmake.vim create mode 100644 home/vim/after/ftplugin/cpp.vim create mode 100644 home/vim/after/ftplugin/d.vim create mode 100644 home/vim/after/ftplugin/fugitive.vim create mode 100644 home/vim/after/ftplugin/gitcommit.vim create mode 100644 home/vim/after/ftplugin/gitconfig.vim create mode 100644 home/vim/after/ftplugin/gitsendemail.vim create mode 100644 home/vim/after/ftplugin/haskell.vim create mode 100644 home/vim/after/ftplugin/help.vim create mode 100644 home/vim/after/ftplugin/json.vim create mode 100644 home/vim/after/ftplugin/mail.vim create mode 100644 home/vim/after/ftplugin/make.vim create mode 100644 home/vim/after/ftplugin/netrw.vim create mode 100644 home/vim/after/ftplugin/pandoc.vim create mode 100644 home/vim/after/ftplugin/python.vim create mode 100644 home/vim/after/ftplugin/qf.vim create mode 100644 home/vim/after/ftplugin/rust.vim create mode 100644 home/vim/after/ftplugin/sh.vim create mode 100644 home/vim/after/ftplugin/tex.vim create mode 100644 home/vim/after/ftplugin/yaml.vim create mode 100644 home/vim/after/ftplugin/zsh.vim create mode 100644 home/vim/after/plugin/mappings/ale.vim create mode 100644 home/vim/after/plugin/mappings/fugitive.vim create mode 100644 home/vim/after/plugin/mappings/fzf.vim create mode 100644 home/vim/after/plugin/mappings/misc.vim create mode 100644 home/vim/after/plugin/mappings/qf.vim create mode 100644 home/vim/after/plugin/mappings/unimpaired.vim diff --git a/home/vim/after/ftplugin/bash.vim b/home/vim/after/ftplugin/bash.vim new file mode 100644 index 0000000..2b69ab4 --- /dev/null +++ b/home/vim/after/ftplugin/bash.vim @@ -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' diff --git a/home/vim/after/ftplugin/beancount.vim b/home/vim/after/ftplugin/beancount.vim new file mode 100644 index 0000000..c5645c8 --- /dev/null +++ b/home/vim/after/ftplugin/beancount.vim @@ -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 = :AlignCommodity +vnoremap = :AlignCommodity diff --git a/home/vim/after/ftplugin/c.vim b/home/vim/after/ftplugin/c.vim new file mode 100644 index 0000000..a85ff07 --- /dev/null +++ b/home/vim/after/ftplugin/c.vim @@ -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' diff --git a/home/vim/after/ftplugin/cmake.vim b/home/vim/after/ftplugin/cmake.vim new file mode 100644 index 0000000..d590ae0 --- /dev/null +++ b/home/vim/after/ftplugin/cmake.vim @@ -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<' diff --git a/home/vim/after/ftplugin/cpp.vim b/home/vim/after/ftplugin/cpp.vim new file mode 100644 index 0000000..4fa501e --- /dev/null +++ b/home/vim/after/ftplugin/cpp.vim @@ -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' diff --git a/home/vim/after/ftplugin/d.vim b/home/vim/after/ftplugin/d.vim new file mode 100644 index 0000000..0e868c7 --- /dev/null +++ b/home/vim/after/ftplugin/d.vim @@ -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' diff --git a/home/vim/after/ftplugin/fugitive.vim b/home/vim/after/ftplugin/fugitive.vim new file mode 100644 index 0000000..e324494 --- /dev/null +++ b/home/vim/after/ftplugin/fugitive.vim @@ -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' diff --git a/home/vim/after/ftplugin/gitcommit.vim b/home/vim/after/ftplugin/gitcommit.vim new file mode 100644 index 0000000..f785ff8 --- /dev/null +++ b/home/vim/after/ftplugin/gitcommit.vim @@ -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<' diff --git a/home/vim/after/ftplugin/gitconfig.vim b/home/vim/after/ftplugin/gitconfig.vim new file mode 100644 index 0000000..1ff3ac0 --- /dev/null +++ b/home/vim/after/ftplugin/gitconfig.vim @@ -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<' diff --git a/home/vim/after/ftplugin/gitsendemail.vim b/home/vim/after/ftplugin/gitsendemail.vim new file mode 100644 index 0000000..d33306c --- /dev/null +++ b/home/vim/after/ftplugin/gitsendemail.vim @@ -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' diff --git a/home/vim/after/ftplugin/haskell.vim b/home/vim/after/ftplugin/haskell.vim new file mode 100644 index 0000000..80d7f2e --- /dev/null +++ b/home/vim/after/ftplugin/haskell.vim @@ -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<' diff --git a/home/vim/after/ftplugin/help.vim b/home/vim/after/ftplugin/help.vim new file mode 100644 index 0000000..884bf64 --- /dev/null +++ b/home/vim/after/ftplugin/help.vim @@ -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' diff --git a/home/vim/after/ftplugin/json.vim b/home/vim/after/ftplugin/json.vim new file mode 100644 index 0000000..2b4ba56 --- /dev/null +++ b/home/vim/after/ftplugin/json.vim @@ -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' diff --git a/home/vim/after/ftplugin/mail.vim b/home/vim/after/ftplugin/mail.vim new file mode 100644 index 0000000..fd9624b --- /dev/null +++ b/home/vim/after/ftplugin/mail.vim @@ -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<' diff --git a/home/vim/after/ftplugin/make.vim b/home/vim/after/ftplugin/make.vim new file mode 100644 index 0000000..6785116 --- /dev/null +++ b/home/vim/after/ftplugin/make.vim @@ -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<' diff --git a/home/vim/after/ftplugin/netrw.vim b/home/vim/after/ftplugin/netrw.vim new file mode 100644 index 0000000..e3689f8 --- /dev/null +++ b/home/vim/after/ftplugin/netrw.vim @@ -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<' diff --git a/home/vim/after/ftplugin/pandoc.vim b/home/vim/after/ftplugin/pandoc.vim new file mode 100644 index 0000000..d44bc12 --- /dev/null +++ b/home/vim/after/ftplugin/pandoc.vim @@ -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<' diff --git a/home/vim/after/ftplugin/python.vim b/home/vim/after/ftplugin/python.vim new file mode 100644 index 0000000..a18299e --- /dev/null +++ b/home/vim/after/ftplugin/python.vim @@ -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<' diff --git a/home/vim/after/ftplugin/qf.vim b/home/vim/after/ftplugin/qf.vim new file mode 100644 index 0000000..01036f9 --- /dev/null +++ b/home/vim/after/ftplugin/qf.vim @@ -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 h :call quickfixed#older() +let b:undo_ftplugin.='|nunmap h' +nnoremap l :call quickfixed#newer() +let b:undo_ftplugin.='|nunmap l' diff --git a/home/vim/after/ftplugin/rust.vim b/home/vim/after/ftplugin/rust.vim new file mode 100644 index 0000000..61516f9 --- /dev/null +++ b/home/vim/after/ftplugin/rust.vim @@ -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<' diff --git a/home/vim/after/ftplugin/sh.vim b/home/vim/after/ftplugin/sh.vim new file mode 100644 index 0000000..5b5a88c --- /dev/null +++ b/home/vim/after/ftplugin/sh.vim @@ -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' diff --git a/home/vim/after/ftplugin/tex.vim b/home/vim/after/ftplugin/tex.vim new file mode 100644 index 0000000..f0560da --- /dev/null +++ b/home/vim/after/ftplugin/tex.vim @@ -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<' diff --git a/home/vim/after/ftplugin/yaml.vim b/home/vim/after/ftplugin/yaml.vim new file mode 100644 index 0000000..13b37f2 --- /dev/null +++ b/home/vim/after/ftplugin/yaml.vim @@ -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<' diff --git a/home/vim/after/ftplugin/zsh.vim b/home/vim/after/ftplugin/zsh.vim new file mode 100644 index 0000000..b8c7a31 --- /dev/null +++ b/home/vim/after/ftplugin/zsh.vim @@ -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' diff --git a/home/vim/after/plugin/mappings/ale.vim b/home/vim/after/plugin/mappings/ale.vim new file mode 100644 index 0000000..3069f81 --- /dev/null +++ b/home/vim/after/plugin/mappings/ale.vim @@ -0,0 +1,2 @@ +" Use ALE LSP-powered symbol information +nnoremap K :ALEHover diff --git a/home/vim/after/plugin/mappings/fugitive.vim b/home/vim/after/plugin/mappings/fugitive.vim new file mode 100644 index 0000000..934f00e --- /dev/null +++ b/home/vim/after/plugin/mappings/fugitive.vim @@ -0,0 +1,10 @@ +" Visual bindings for merging diffs as in normal mode +xnoremap dp :diffput +xnoremap do :diffget + +" Open status window +nnoremap gs :Gstatus +" Open diff view of current buffer: the up/left window is the current index +nnoremap gd :Gdiffsplit! +" Open current file log in new tab, populate its location list with history +nnoremap gl :spT:Gllog --follow -- %:p diff --git a/home/vim/after/plugin/mappings/fzf.vim b/home/vim/after/plugin/mappings/fzf.vim new file mode 100644 index 0000000..8cfb8b8 --- /dev/null +++ b/home/vim/after/plugin/mappings/fzf.vim @@ -0,0 +1,38 @@ +" Only git-tracked files, Vim needs to be in a Git repository +nnoremap fg :GFiles + +" All files +nnoremap ff :Files + +" Currently open buffers +nnoremap fb :Buffers + +" Buffer history +nnoremap fh :History + +" Tags in buffer +nnoremap ft :BTags + +" Tags in all project files +nnoremap fT :Tags + +" Snippets for the current fileytpe (using Ultisnips) +nnoremap fs :Snippets + +" All available commands +nnoremap f: :Commands + +" All commits (using fugitive) +nnoremap fc :Commits + +" All commits for the current buffer (using fugitive) +nnoremap fC :BCommits + +" Select normal mode mapping by searching for its name +nmap (fzf-maps-n) + +" Select visual mode mapping by searching for its name +xmap (fzf-maps-x) + +" Select operator pending mode mapping by searching for its name +omap (fzf-maps-o) diff --git a/home/vim/after/plugin/mappings/misc.vim b/home/vim/after/plugin/mappings/misc.vim new file mode 100644 index 0000000..7f1ea1c --- /dev/null +++ b/home/vim/after/plugin/mappings/misc.vim @@ -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 m :silent! :make! \| :redraw! + +" Remove search-highlighting +noremap :nohls diff --git a/home/vim/after/plugin/mappings/qf.vim b/home/vim/after/plugin/mappings/qf.vim new file mode 100644 index 0000000..c5e353b --- /dev/null +++ b/home/vim/after/plugin/mappings/qf.vim @@ -0,0 +1,11 @@ +" Next and previous in quick-fix list +nmap fn (qf_qf_next) +nmap fp (qf_qf_previous) + +" Next and previous in location list +nmap ln (qf_loc_next) +nmap lp (qf_loc_previous) + +" Toggle quick-fix and location lists +nmap tf (qf_qf_toggle) +nmap tl (qf_loc_toggle) diff --git a/home/vim/after/plugin/mappings/unimpaired.vim b/home/vim/after/plugin/mappings/unimpaired.vim new file mode 100644 index 0000000..53457bd --- /dev/null +++ b/home/vim/after/plugin/mappings/unimpaired.vim @@ -0,0 +1,7 @@ +" Better fr layout mappings for vim-unimpaired and other '[' and ']' commands +nmap ( [ +nmap ) ] +omap ( [ +omap ) ] +xmap ( [ +xmap ) ] diff --git a/home/vim/default.nix b/home/vim/default.nix index 2962c71..e0f0cfc 100644 --- a/home/vim/default.nix +++ b/home/vim/default.nix @@ -47,6 +47,10 @@ }; xdg.configFile = { + "nvim/after" = { + source = ./after; + }; + "nvim/autoload" = { source = ./autoload; };