Vim

From /tech/ Wiki
Jump to navigationJump to search

Vim (Vi IMproved) is a free command line modal text-editor. It expands on the earlier Vi editor which was designed within the limitations of the PDP-11. Vim is included with most GNU/Linux systems as well as MacOS, sometimes symlinked from vi.

Making vim XDG compliant

First export the VIMINIT variable in ~/.profile or /etc/profile:

export VIMINIT=":source $XDG_CONFIG_HOME"/vim/vimrc

Now make the following changes to your vimrc in $XDG_CONFIG_HOME/vim/vimrc:

set undodir=$XDG_DATA_HOME/vim/undo
set directory=$XDG_DATA_HOME/vim/swap
set backupdir=$XDG_DATA_HOME/vim/backup
set viminfo+='1000,n$XDG_DATA_HOME/vim/viminfo
set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME,$XDG_CONFIG_HOME/vim/after

NeoVim

A project that seeks to refactor Vim's ancient code base.

  • XDG compliant
  • Doesn't support poor children in Uganda.
  • Don't have to use VimScript to write plugins.

Learning Vim

Tips

  • Don't use arrow keys
  • Don't rely on hjkl either
  • Map ESC to Caps Lock or another nearby key.

VimScript

The formal expression of vim commands in written code. Often unreadable.

gVim

Graphical Vim.