issues
search
afm719
/
Cloud-Computing-Arahi
0
stars
0
forks
source link
VIM commands
#4
Open
afm719
opened
1 month ago
afm719
commented
1 month ago
Vim Modes:
Normal Mode:
The default mode when you open Vim. Here you navigate and execute commands.
Press
Esc
to return to Normal Mode from any other mode.
Insert Mode:
To enter text.
Press
i
to enter Insert Mode.
Visual Mode:
To select text.
Press
v
to start selecting text.
Command-Line Mode:
To run commands.
Press
:
to enter Command-Line Mode.
Navigation Commands:
h
: Move cursor left.
j
: Move cursor down.
k
: Move cursor up.
l
: Move cursor right.
w
: Jump to the start of the next word.
b
: Jump to the start of the previous word.
gg
: Go to the beginning of the file.
G
: Go to the end of the file.
Ctrl + f
: Scroll forward one page.
Ctrl + b
: Scroll back one page.
Editing Text:
i
: Insert text before the cursor.
a
: Insert text after the cursor.
o
: Insert a new line below the current one.
dd
: Delete the current line.
d$
: Delete from the cursor to the end of the line.
x
: Delete the character under the cursor.
u
: Undo the last action.
Ctrl + r
: Redo the last undone action.
yy
: Copy (yank) the current line.
p
: Paste after the cursor.
Search and Replace:
/word
: Search for the next occurrence of "word."
n
: Go to the next occurrence of the search.
N
: Go to the previous occurrence.
:s/old/new
: Replace the first "old" with "new" in the current line.
:s/old/new/g
: Replace all occurrences of "old" in the current line.
:%s/old/new/g
: Replace all occurrences in the entire file.
Save and Exit:
:w
: Save the file.
:q
: Quit Vim.
:wq
or
ZZ
: Save and quit.
:q!
: Quit without saving.
Other Useful Operations:
v
: Enter Visual Mode (select text).
y
: Copy selected text (in Visual Mode).
d
: Cut selected text (in Visual Mode).
Ctrl + g
: Show file information (current line, total lines, etc.).
Vim Modes:
Esc
to return to Normal Mode from any other mode.i
to enter Insert Mode.v
to start selecting text.:
to enter Command-Line Mode.Navigation Commands:
Editing Text:
Search and Replace:
Save and Exit:
Other Useful Operations: