Vim

A powerful Text Editor

Getting Started

Vim Everywhere


Quick shell commands

Run the command under the cursor with !! then sh. The command output will replace the command.

Troubleshooting

Write to log file with vim -V20vimlog README.md

Concealing Characters

see concealcursor and conceallevel to hide characters.

From Vim Custom Markdown Syntax

Counting Words

Count selected text with '<,'>write !wc -w -.

  • Visually select a block of text and press :. This will enter Command Mode.
  • Now complete the command like this '<,'>write !wc -w -
  • write ! will write the selection to an external program
  • the command wc -w - will tell word-count to count text from stdin wordwise

Spellchecking

# download spell file
cd /usr/share/nvim/runtime/spell
sudo wget http://ftp.vim.org/vim/runtime/spell/de.utf-8.spl

Then you can :set spell! to toggle spelling in Vim on and off.

Autocommands

" Remove trailing whitespace on save
autocmd autofixes BufWritePre * %s/\s\+$//e
" specify text width for markdown files
autocmd autofixes BufEnter *.md set textwidth=80