Vim Recipes

One-liners and other useful tricks for Vim.

Table of Contents

  1. Installing .vba / vimball plugins

  2. Filetype specific settings

  3. To uppercase

  4. Vim Regex

  5. Useful plugins

## Installing .vba / vimball plugins Open the file in vim and execute

:source %

This will move all of the plugins to their respective directory.

Filetype specific settings

A good way of managing file specific settings is to use the filetype plugin: in short, add

filetype plugin on

to your .vimrc file. Then, configure each filetype’s settings in ~/.vim/ftplugin/. For example, a configuration for UNIX Makefiles

" ~/.vim/ftplugin/make.vim
set ts=8
set sw=8
set noexpandtab

More information in the Vim Fandom.

To uppercase

We can turn all words uppercase using the search-and-replace regex:

%s/\<./\u&/g

Here

  • \< matches the start of a word

  • \u is the Vim uppercase modifier, for the character in the substituted string (i.e. &, the LHS)

Vim Regex

Useful overview is provided on Vimregex.

Useful plugins

  • DrawIt for creating ASCII diagrams link

  • Renamer for batch renaming files link