DEV Community

Akash Yadav
Akash Yadav

Posted on

Vim Navigation

Navigation:
h: Move cursor left.
j: Move cursor down.
k: Move cursor up.
l: Move cursor right.
gg: Move to the first line of the file.
G: Move to the last line of the file.
Ctrl + b: Move one page up.
Ctrl + f: Move one page down.
0: Move to the beginning of the line.
$: Move to the end of the line.
w: Move forward one word.
b: Move backward one word.
Editing:
i: Enter insert mode before the cursor.
I: Enter insert mode at the beginning of the line.
a: Enter insert mode after the cursor.
A: Enter insert mode at the end of the line.
o: Open a new line below the current line.
O: Open a new line above the current line.
x: Delete the character under the cursor.
dd: Delete the current line.
yy: Yank (copy) the current line.
p: Paste the yanked or deleted text after the cursor.
u: Undo the last change.
Ctrl + r: Redo the last undone change.
.: Repeat the last change.
Saving and Exiting:
:w: Write (save) the file.
:q: Quit Vim.
:q!: Quit Vim without saving changes.
:wq: Write the file and quit Vim.
:wq!: Write the file and quit Vim, overriding read-only mode if necessary.
Searching and Replacing:
/pattern: Search for a pattern.
n: Move to the next occurrence of the search pattern.
N: Move to the previous occurrence of the search pattern.
:%s/old/new/g: Replace all occurrences of "old" with "new" in the entire file.
Miscellaneous:
:help: Open the help documentation.
:set number: Display line numbers.
:set nonumber: Hide line numbers.
:syntax on: Enable syntax highlighting.
:syntax off: Disable syntax highlighting.

Top comments (0)