tldr/pages/common/vim.md

492 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>