Skip to content

Latest commit

 

History

History
83 lines (56 loc) · 2.39 KB

vim_cheatsheet.md

File metadata and controls

83 lines (56 loc) · 2.39 KB

INDEX

  1. Setting/Unsetting values
  2. Saving session
  3. Auto complete
  4. File Explorer
  5. Repeating commands
  6. Bookmarks
  7. Searching Text
  8. Indentation

Setting/Unsetting Values

set number      # set
set nonumber    # unset
set number!     # toggle

set numberwidth=3           # key=value
set number numberwidth=3    # Multiple setting at once

Saving session

mksession my-work-session.vim

Auto complete

Press Ctrl+n in insert mode.

File Explorer

Give ::Explore command

Repeating commands

  • Press qX where X=any letter to start recording.
  • Use some commands
  • Press @X where X=previously used letter.

You can use @@ after using @X once.

Bookmarks

  • mX where X=a-z for setting local bookmarks(In same file).
  • mX where X=A-Z for setting global bookmarks(In any file).
  • 'X where X=a-zA-Z to go to the bookmarks.
  • :marks to show all the bookmarks.

Searching Text

Type / in normal mode, then insert keyword and press enter. Cursor will go to the first occurrence of the keyword. Press n to go to the next occurrence or N to go to previous occurrence.

Pressing * will search the current word under cursor.

Indentation

= is used to indent a line.

Managing Tabs

  • :tabm i - Move current tab to i th position.
  • :tabm +i - Move current tab i place right.
  • :tabm -i - Move current tab i place left.

Managing Windows

Resize:

  • Ctrl + w + < - Decrease window width
  • Ctrl + w + > - Increase window width
  • Ctrl + w + - - Decrese window height
  • Ctrl + w + + - Increase window height

Move placement:

  • Ctrl + w + R - Move window up/left
  • Ctrl + w + r - Move window down/right