Vim learning Journey
Vim is written long time ago but it is one of the best software ever written. It’s not outdated, it’s not old-fashioned. If you wanna be fast smooth and dripping with coconut oil. Mastering Vim is a must. No more Intellij, no more VSCode, no more Sublime. Learning vim is one of the best investment for developers!
I followed this series from the Youtuber ThePrimeagen for learning VIM. He has a lot of experience using vim and also makes funny videos. Each phase takes about a week to practice, don’t try to rush all command at one time. Familiarize yourself with each sets of commands before moving on.
Learning Journey
Phase1:
hjkl
: basic movement
w
forward by a word
b
back by a word
yy
copy a line
p
paste a line below
dd
delete a line
u
undo
V
highlight a line
v
highlight a character
i
insert mode
:w
save file
yw
copy word
dw
delete the remaining word
dj
delete current line and next line
Phase2:
o
insert line above
O
insert line after
P
past a line above
a
append
A
insert mode in end of line
I
insert mode in beginning of line
/
search n
search next result N
search previous result
*
search next result of current word
#
search previous result of current word
Phase3:
Inline movement
f
Jump onto the character (after) e.g. fe
(jump onto e)
t
Jump to the character (after)
F
Jump onto the character (before)
T
Jump to character (before)
Above command plus ;
move to next one
x
delete a single char
s
delete a single char and go to insert mode
cw
delete the remaining word and go to insert mode
combine dcyv
with ftFT
dt)
delete everything until the closing parenthesis
ct)
change everything until the closing parenthesis and go to insert mode
yt)
copy everything until the closing parenthesis
vT(
highlight everything in visual mode until the open parenthesis before
D
delete the rest of the line
C
change the rest of the line and go to insert mode
Phase4
Vertical move
gg
top of the file
GG
buttom of the file
:100
go the line 100
[number][hjklwb]
move [number][movement]
{
go up by paragraph
}
go down by paragraph
Ctrl u
page up
Ctrl d
page down
%
go to matching parenthesis (useful)
vi{
select everything inside bracket
di{
delete everything inside nearest bracket and go to insert mode
ci{
change everything inside nearest bracket and go to insert mode
ca{
change everything inside nearest bracket (including) and go to insert mode
c2i{
change everything inside nearest bracket (2 level) and go to insert mode
cip
delete a paragraph and go to insert mode
diw
delete current word
Phase5
ctrl ^
swap between last two open files
ctrl o
move to previous cursor position
ctr i
move to next cursor position
m[lowercase]
local mark (current file)
m[uppercase]
global mark (anywhere)
‘[mark]
jump to mark
Anything start with ctrl w
is window command
(He recommends not to use splits, just use one window ! But this is personal preference)
ctrl w v
open new window vertically
ctrl w s
open new window horizontally
ctrl w o
close all window but current one
ctrl w hjkl
move between windows
Plugin manager
vim-plug: A minimalist Vim plugin manager
Useful Plugin
telescope : Fuzzy search (nvim only)
Practice vim
VimBeGood: vim plugin that let you practice vim, also developed by ThePrimeagen
ColorScheme
gruvbox : Best color scheme ever
Conclusion
I am still learning vim, so this post get updated regularly to record my learning journey. I am also using nvim instead of vim, because it comes with a lot of default features. Here is my nvim setup.
keep hustling !