Hi Everyone !!!
Gvim is the most common editor used by Linux Users. Here are some the gvim editor commands are given below,
Short Cut Command |
Description |
ZZ |
Save and Quit |
ZQ |
Quit Without Save |
CTRL+E/Y |
Scrolling line up and down |
CTRL+U/D |
Move the half of the screen up and down |
CTRL+F/B |
Page up and down |
s |
Deletes the current character cursor will be in insert mode |
S |
Deletes the entire line and cursor in insert mode |
H |
Move the top of the screen |
L |
End of the screen |
G |
Jumps to the file or line typed before(this is the difference between
L and G) |
-/+ |
Moves the line up and down |
dnw |
It delete upto n words |
h |
Moves the cursor left direction(we can use numbers also i.e 8h) |
K |
Moves a cursor to upward direction(i.e 9k) |
J |
Moves the cursor downward direction. We can use 9j also |
L |
Moves the cursor right direction(we can use numbers also i.e 8l) |
zt |
Scroll the cursor to top |
zb |
Scroll the cursor to bottom |
zc |
Scroll the cursor at center |
( |
Jumps the beginning of the sentence |
) |
Jumps the end of the sentence |
w |
jump by start of words (punctuation considered words) |
W |
jump by words (spaces separate words) |
e |
jump to end of words (punctuation considered words) |
E |
jump to end of words (no punctuation) |
0 |
(zero) start of line |
$ |
Go to the end of the line(we
can use number also 9$ means cursor will go the end of 9th line) |
i |
start insert mode at cursor |
I |
insert at the beginning of the line |
a |
append after the cursor |
A |
append at the end of the line |
o |
open (append) blank line below current line (no need to press return) |
O |
open blank line above current line |
Esc |
exit insert mode |
C |
delete from cursor position to end of the line |
:E |
edit a file in a new buffer |
:sp |
open a file in a new buffer and split window |
Ctrl+ws |
split windows |
Ctrl+ww |
switch cursor between windows |
Ctrl+W+ |
Increase the window size in split screen |
Ctrl+wq |
quit a window |
Ctrl+w gf |
Edit existing file under cursor in new tabpage |
Ctrl+w f |
Edit existing file under cursor in split window |
gf |
Edit existing file under cursor in same window |
Ctrl+wv |
split windows vertically |
:%s/old/new/g |
replace all old with new throughout file |
:%s/old/new/gc |
replace all old with new throughout file with confirmations |
n |
repeat search in same direction |
N |
repeat search in opposite direction |
/pattern |
search for pattern |
:w |
write (save) the file, but don’t exit |
:wq |
write (save) and quit |
:wqall |
Write and quit all |
:wall |
Save the changes in all file |
:w! |
force write to a read only file |
:q! |
force quit and throw away changes |
yy or(Y) |
yank (copy) a line |
2yy |
yank 2 lines |
dd or D |
delete (cut) a line |
p |
put (paste) the clipboard after cursor |
P |
put (paste) before cursor |
dw |
delete (cut) the current word |
yw |
yank word |
~ |
switch case |
Ctrl+v |
start visual block mode |
U |
undo |
. |
repeat last command |
r |
replace a single character (does not use insert mode) |
R |
replace characters till Esc is pressed |
J |
join line below to the current one |
:tabnew |
open new tab |
:tabnew % |
open same file in new tab |
Searching options:
Remember that vim stores the recordings in macros.Following are the steps for recording in gvim:
- Start recording by pressing q, followed by a lower case character (a-z) to name the macro.
- Perform any editing, actions inside Vim editor, which will be recorded.
- Stop recording by pressing q.
- Play the recorded macro by pressing @ followed by the macro name.
- To repeat macros multiple times, press: N@macro name. N is a number.
Ex. 1@a (or @a) will play recording 1 time stored in buffer ‘a’, 2@a will play it 2 times and so on.
You can store 26 different recordings at a time!
Thank you for providing this recording option. Will be useful in doing some repeated thing in our frequent activity.
ReplyDeletenoh -> removes the highlights
ReplyDelete