Vim commands

Vim text editor.

Wed Feb 22 2017

vim

vim is a popular command-line text editor

why vim?

-edit files on a remote server over ssh

-works without a graphical desktop environment

-many programming-specific features

-really fast editing

type vim

If that doesn’t work, install vim. sudo apt-get install vim vim-common to get vim plus extras like syntax highlighting.

In vim!

Type i to go into insert mode.

Now you can type normally.

Saving and quitting

Hit esc to get out of insert mode. Now type:

:w foo.txt

to save your file as foo.txt. You can go back into insert mode by typing i again or you can quit by typing:

:q

More commands.

  Try :wq           to save and then quit.
  Try :q!           to quit without saving.
  Try :q            quit (short for :quit)
  Try :w            save changes to file
  Try :wq or :x     write and quit (think write and quit)
  Try :qa           quit all (short for :quitall)
  Try u             undo
  Try x             delete character at cursor
  Try I             insert at beginning of file
  Try a             append at cursor
  Try A             append at end of line
  Try excape        exit insert mode

Moving around - hjkl

In insert mode, the arrow keys do work, but you should practice not using them! Instead, in command mode: h - moves left one character j - moves down one line k - moves up one line l - moves right one character

:help Show help about . You can use :help without a to get general help.

Source http://www.fprintf.net/vimCheatSheet.html

http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/

https://linuxmoz.com/vi-commands-cheat-sheet/

https://www.vim.org/about.php

http://vim.wikia.com/wiki/Copy,cutand_paste

Loading...
Deepak Mishra

Deepak Mishra #JavaScript, #Node, #React #Angular, #jQuery, #HTML5, #CSS blog

  • www.deepakmihsra.com