Copied to clipboard

vim

Vim is a text editor that can be accessed through the command line. It has many powerful features such as undo and redo, search and replace, and split-screen editing. It is the preferred editor of many programmers and developers.

Example

  • Open a file: vim filename.txt
  • Save a file: Press :w or :write in normal mode
  • Exit vim: Press :q or :quit in normal mode
  • Force exit vim: Press :q! or :quit! in normal mode
  • Save and exit vim: Press :wq or :x in normal mode
  • Scroll down: Press Ctrl + f in normal mode
  • Scroll up: Press Ctrl + b in normal mode
  • Search in file: Press / in normal mode, then enter the text to search and press Enter
  • Replace text: Press :%s/old/new/g in normal mode, where old is the text to be replaced, and new is the new text
  • Find next match: Press n in normal mode
  • Find previous match: Press N in normal mode
  • Quit vim without saving: Press :q! or :quit! in normal mode