May 2, 2020 Application 2 minutes, 39 seconds


:w !sudo tee %


vnoremap p "_dP

vim -b

  • SHIFT-v to select lines
  • `:norm Astring'

norm means type the following commands and the A stands for append

  • ^ to move to the start of the line
  • `CTRL-v' to block select your lines
  • SHIFT-I to insert your string (on one line)
  • ESC to insert the string on all lines

vim -p [file1] [file2] ...

vim +':w ++ff=unix' +':q' FILE

or for other endings

  • :w ++ff=dos
  • :w ++ff=mac

:map [<C-j>]
:verbose map [<C-j>]

Prints various information about vim like version, enabled features, compile flags and loaded configuration files.


config using indent as fold method (see also Modeline):

set foldmethod=indent   
set foldnestmax=10
set nofoldenable
set foldlevel=2
  • za: Toogle at the current line
  • zo: Open fold
  • zc: Close fold
  • zR: Open all folds
  • zM: Close all folds
  • zm: Increases the foldlevel by one
  • zr: Decreases the foldlevel by one
  • zj Moves the cursor to the next fold
  • zk: Moves the cursor to the previous fold
  • [z: Move to start of open fold
  • ]z: Move to end of open fold
  • zf#j: Creates a fold from the cursor down # lines
  • zf/string Creates a fold from the cursor to string
  • zd: Deletes the fold at the cursor
  • zE: Deletes all folds

By setting set modeline=1 you can enable the Modeline Magic. When it is not working you can check the setting with the following command:

:verbose set modeline?

Some distros disable it with nomodeline in /etc/vimrc

Example usage folding: This line at the bottom of a file tells vim to use marker as foldmethod and fold all foldings after opening the file

" vim:foldmethod=marker:foldlevel=0

vim --startuptime vim.log

vim -D



In Linux use setxkbmap:

setxkbmap -option caps:escape # More options available
setxkbmap -option # to reset changes

In .config/nvim/init.vim (create if not existing)

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath=&runtimepath
source ~/.vimrc
  1. In insert mode
  2. C-k a question mark will appear
  3. Enter Co

Here is a cheatsheet about digraphs (how this is called)

A buffer is the in-memory text of a file.
A window is a viewport on a buffer.
A tab page is a collection of windows.