tldr/pages/common/vim.md

487 B

vim

Vi IMproved, a programmer's text editor.

  • Open a file with cursor at the given line number:

vim {{file}} +{{linenumber}}

  • Open multiple files at once, each file in its own tab page:

vim -p {{file1}} {{file2}} {{file3}}

  • Open a file in read-only mode:

view {{file}}

  • switch to normal mode

<esc>

  • switch to insert mode

<esc> i <enter>

  • exit vim

<esc> :q <enter>

  • save file in vim

<esc> :w <enter>

  • save file then exit vim

<esc> :wq <enter>