How the hell do I exit: Guide to Vim
ESC? Nothing happens.CTRL + C? No.ESC ESC ESC? Nope. I’m stuck.How to quit?Sound familiar?
Don’tknow about you, but I’ve been there. Until I decided to spend 10 minutes learning the very basics of Vim, this post is just enough to get you started and do not covers advance!
Vim is there by default with many operating systems (including most Linux distributions and Mac OS X), so Just launch a terminal and type ‘vim’ to get started.
: why to use vim?
With some learning, Vim can be more potent than many graphical IDEs. As it certainly doesn’t eat hundreds of mega of memory just to view an empty file (like in, Eclipse).
Some commands in this guide start with a colon: pressing it will display the command prompt where the subsequent command is written
Commands written in CAPITAL LETTERS are specific keys: for example, ESC means the escape key on your keyboard.
Commands without a colon are more like hotkeys — they can be used in the Vim default mode (which is the mode Vim starts in).
All commands in Vim are case-sensitive.
a) To start inserting text on the current cursor location:
b) To start adding at the end of the current line:
c) To exit insert mode, and return to the default mode:
a) To quit, discarding any changes you might have made (before press ESC):
b) To quit, saving any changes you’ve made(before press ESC):
NAVIGATING THE BAR
a) To move to line 285 (before press ESC):
b) To search for the word return(before press ESC):
CUT COPY PASTE
a) To copy the current selection into the buffer (think of it as a clipboard):
b) To cut the current selection:
c) To copy the current line into the buffer:
d) To copy three lines, including the current line into the buffer:
e) To cut the current line and place it into the buffer:
f) To cut five lines, including the current line:
UNDO AND REDO
a) To undo the last change:
b) To redo the recent change you just undid:
CTRL + R
SYNTAX HIGHLIGHTING AND INDENTATION
a) Turn on syntax highlighting:
b) Enable automatic indentation:
WORKING WITH MULTIPLE FILES
a) To open a new tab of the terminal
b) To open server.py in a new tab:
c) To move to the next tab on the right:
e) To move to the previous tab on the left:
a) To open templates/base.html in a vertical split-screen:
b) To open shared.js in a horizontal split-screen:
c) To move between split screens:
CTRL + W + ARROW KEYS