POSIX/BSD vi is extremely primitive—no colors, no language modes, no plugins. But still, using it is a nice exercise in minimalist text editing. That’s what I, as a Lisp programmer, am trying to do, preferably without going insane. This .exrc config file is an attempt to reproduce the functionality of fancy Lisp-friendly systems. Like Emacs and Paredit. In vi.
Just copy/symlink the .exrc to your home directory and start vi.
git clone https://github.com/aartaka/emvi
ln -s emvi/.exrc ~/.exrcHere are the (Emacs-inspired) bindings I’ve added:
- C-x s
- Save changes.
- C-x b
- Edit the previous/alternate file.
- C-x q
- Exit.
- C-x Q
- Exit without saving changes.
- C-x e
- Edit a new file.
- C-x .
- Jump to a tag/source. Use
ctags-compatible solution (likely Universal Ctags) to generate a tags file for your Lisp codebase and use it to navigate around. - C-x d
- Delete s-expression.
- C-x y, C-x p, C-x P
- Copy s-expression and paste it.
- C-x x
- Jump to matching paren/bracket/brace.
- C-x J, C-x K
- Jump to next/previous triple-semicolon section.
- C-a (
- Add empty parentheses and insert right into them.
- C-a [
- Same, but for square brackets.
- C-a {
- Same, but for curly braces.
- C-a ”
- Same, but for double quotes.
- C-x (
- Wrap the current symbol into parens (
paredit-wrap-round).- C-x [
paredit-wrap-square.- C-x {
paredit-wrap-curly.- C-x ”
paredit-meta-doublequote, but without the internal quoting.
- C-x )
- Slurping the next symbol into the current parenthesized form.
- C-x ]
- Same, but for square brackets.
- C-x }
- Same, but for curly braces.
- Thanks to Vasily Gerasimov for the name idea.
- Thanks to Arch Linux forums for giving me pointers on how to fix tag support in vi.