A modular vim configuration
This is my personal vim configuration. The git repo of this configuration is under constant flux, however, it should be compatible with (g)vim (8.0+) and neovim (0.2+), yet some features are only available with newer versions.
Flavors on different machines
I would like to use this configuration on a large variety of machines with different needs. To accommodate for this, the configuration is split up into multiple files and a different set of plugins is used:
- In any case, the plugin set in
plugins-mini.vim
is loaded. - Furthermore,
plugins-midi.vim
,plugins-full.vim
andplugins-local.vim
are loaded if present. They are provided asplugins-xxx.vim.example
and you can create a symlinkplugins-xxx.vim
to have them loaded. (In case ofplugins-local.vim
you will probably provide a machine-dedicated version rather than symlinking the example file.)
Similar to plugins-local.vim
, also the following files are sourced if
existent:
macros-local.vim
keymaps-local.vim
init-local.vim
Example files are shipped with the repository.
Installation
Requirements
The install script that is shipped with this configuration also checks for the following requirements:
- python3 support for vim/gvim
- neovim python3 module
- aspell
Under a Debian-like Linux system you can install these by the following commands
sudo apt-get install aspell aspell-de python3-pip
pip3 install neovim
Note that vim-tiny in Debian does not support python3, but vim-nox, vim-gtk3 or neovim does. You also want to make sure that you have curl and git installed.
Clone & install
If you already have a vim configuration in place then you may first move your
~/.vim
directory first
mv ~/.vim ~/.vim-old
Assuming that there is no ~/.vim
anymore, simply clone this repository into
~/.vim
and invoke install.sh
therein.
git clone https://git.sthu.org/repos/vimconf.git ~/.vim
~/.vim/install.sh
This install script creates backups of existing configuration files (e.g.,
~/.vimrc
) and then creates symlinks to configuration files in ~/.vim
.
Terminal color settings
For consistent background colors you may change the background colors of your terminal program to the gruvbox black #1c1c1c. Otherwise regions of your terminal may appear in a saturated black (#000) rather than the gruvbox black.
Related projects
This vim configuration uses the well designed and popular gruvbox colorscheme. In case you use mutt as mail client and vim for composing mails then you may find my mutt gruvbox colorscheme interesting.
Screenshots
In the following, we present a few screenshots and rationales for settings and choices.
Start screen
The start screen provided by startify. We configured startify to indicate whether (g)vim or neovim and which version has been started. Also the global MRU list has been removed.
On the left the window shown by the command :PlugUpdate to update all plugins asynchronously using Plug. Conditional plugin loading makes vim to fire up in 0.3 seconds on my machines.
Programming
C and Python programming with NERDTree on the left with NERDtree git plugin and Tagbar on the right. Neomake shows an flake8 error on the cursorline at line 18 of utils/echorec.py. The tags file is automatically generated by gutentags and the current working directory of vim is automatically changed to the git root by rooter. A git diff indicated by plus, minus, and changed signs provided by signfiy. Indent detection by detectindent.
C++ programming with git blame (:Gblame) by fugitive on the left and semantic autocompletion by vim-clang:
A :Termdebug session in vim (and similar for neovim) together with gdb pimped by gdb dashboard. A wrapper script in this repository detects gdb dashboard and disables the redundant source window. A breakpoint is set on line 343 and the debugger is currently holding at line
- A popup box at line 331 gives the evaluation of a variable.
A vimspector session with a
breakpoint at line 343, the current execution line at 344 and a variable
inspection at line 331. If a .vimspector.json
does not exist when launching
the debugger, a configuration is automatically created from a template to be
adapted.
Syntax highlighting provided by polyglot on the left for vim and syntax highlighting provided by nvim-treesitter for neovim-0.5+ on the right.
Web development
On the left we see markdown with vim-liquid plugin and on the right CSS resp. SASS with scss-syntax and vim-css-color. Spell checking is enabled and the language is automatically detected via vim-DetectSpellLang.
LaTeX
The vimtex plugin shows a TOC on the left and integrates continuous latex builds with latexmk and an automatically updates preview in okular on the right.
The nvim-treesitter plugin provides rich completion for bibtex and labels. For instance, for figure labels the corresponding PDF pages are shown.
Manpager
Put this line in your shell configuration file (e.g., ~/.profile) in order to make vim the manpager.
export MANPAGER="view -c MANPAGER -"