Vim

September 8, 2019 Application 1 minute, 51 seconds

Working on that! :)

:w !sudo tee %

:g/^$/d

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.

:version

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

vim --startuptime vim.log

vim -D

:ccl[ose]
:cope[n]
:cp
:cn

:lcl[ose]
:lop[en]
:lp
:ln

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.