I've being using 'vi' since my Ultrix days and find this series of refreshing videos very informative. My muscle memory has carried me through the years for vi as I find my self pressing 'j' in many text editors by accident and always seem to come back to using 'vi' or at least I endevour to get it installed on my windoze machines. This videos series has cemented my desire to have it everywhere now. Thanks for the series, it's a real blast to find more tricks using vi (vim) as my long time favorite editor.
BASIC NAVIGATION : J - Down K - Up L - Right H - left 'x' to remove a character under the cursor. 'a' insert after the cursor. 'i' insert before the cursor. -> 'o' to open a new line , it will open a new line below the cursor and move to that line in insert mode (Helps alot when we want to add something between two line generally we have to first go to the end of the first line then insert mode and press enter) But pressing 'o' will open a line and move to that line in insert mode shift + o will open a line above the current line we are on and move to that line pressing 'n''o' will open n lines below current line and pressing 'n''O' will open n lines above current line ':q' to quit when no changes made. ':q!' force quit without saving any changes. ':w' write (save) the changes. ':wq' or ':x' write and quit. ZZ to write and quit To move to end of a line : $ | end key | 99l to move to Starting of a line : 0 | home | 99h to move to end of a FILE : G | ctrl + end | 999j | 100% to move to Starting of a FILE : gg | ctrl + home | 999k | 1% 'r' to replace a character under the cursor. '~' to invert the case of the character Capital ←→ lower case 9l will move cursor 9 positions to the right 7h will move cursor 7 position to the left 18j will move us down to 18 lines from current one 8k will move us 8 lines up from current one 9G will move to 9th line , nG will move to nth line :set number or :set nu will enable line number :set nonumber or :set nonu will disable line number or :set nu! :set relativenumber or :set rnu (to enable line number , from the line we are currently on set to 0) [makes easier to copy multiple lines] :set norelativenumber or :set nornu (to disable relativenumber) or :set rnu! NOTE: when we use ! then if it is ON by default then it will be turned on and vice versa, means we can use this command to turn on/off it will toggle between the two
'yy' to yank the line we are currently on (in the memory) 'P' to put the line (ABOVE the line/cursor we are currently on) 'p' to put the line (BELOW the line/cursor we are currently on) 'dd' to delete the line and put it on memory 'u' to undo the last change ctrl + r (to redo the change) 'cc' to change the entire line no matter where is the cursor. 'nY' to copy n lines from the current line incl. the current line (eg. 5Y will yank total of 5 lines from the line we are currently on) 'nD' to delete n lines from the current line incl. the current line (eg. 4D will delete 4 lines and put in memory we can later paste them somewhere its like cut and paste or move ) [ Y- yank (entire line) D - deletes (from cursor to end of the line) ] 'C' Delete from the cursor to end of the line and go into insert mode ( dids the same things as D and then i ) -> 'A' go to end of the line and go into insert mode. 'dw' delete a word 'dnw' to delete n words ( d2w will delete 2 words ) 'w' to jump through words 'b' to jump backwords through words 'nw or nb' to jump through n words at once ( 2b will take back 2 words) 'e' to go to end of the word -> 'ge' to go to end of the previous word 'ne or nge' to move through end of the n words 'b' to go to the begenning of the word 'W' to move through words but ignoring special characters and spaces 'B' same but moves backwards
[optional Number] [optional Number] ( when we press 'j' it moves cursor one line so 1 is the [number] , move down is and line is ) similarly, 2dw means 2 times delete a word or d2w delete 2 words 2d3l, 2 times delete 3 characters ( characters because on pressing 'l' we move 1 character right , so 3l means 3 characters right) its same as 3d2l ) which means 3 times delete 2 characters in right. 2d3j , means 2 times delete 3 lines ( lines coz pressing j moves us one line down , so 3j means 3 lines down ) its same as d6j or 3d2j > : to indent ("indent" refers to the space at the beginning of a line of text ) noun is important to mention to clarify that to vim about what to indent so when we type '>l' or '>h' it means " [1] > " ( indent current line ) '>>' to indent current line '>j' indent current line and below line , similary , '>2j' means indent current line and below 2 lines. '2j' it means 2 times indent 2 lines means total of 6 lines coz 2j means indent current line and below 2 lines '.' (dot) - to repeat previous command we remember that, to change a character we use 'r' to change a line we use C which delete the line and move to insert mode to change a word we use 'cw' it deletes the word and move to insert mode. [ like we change a word from hello to hey using cw then if we press . on other words it will change them to hey as '.' repeats the last command executed ]
'*' : to search the word the cursor is on. Press 'n' to find next occurrence of the same word. Press 'N' to search backwards. '#' : backward search for the word cursor is on. In this case functionality of n and N gets reversed Press 'n' to find next occurrence of the same word. (Upward) Press 'N' to search backwards. (Downwards) / : to search all the occurrence of a word in file at once and press n and N to move through ? : search backward These above searching methods are CASE SENSITIVE (Database and database will be treated differently) To disable search for case sensitive words /\c (\c is escape sequence is we simply write /c it will search for c ) To search for case sensitive words (like if we search for 'Database' it will treat 'database' a different word and not search for it). If we search 'in' it will search for it if in comes within other words , eg. /in will result "def(in)e","follow(in)g"... Etc If we only "in" itself in the output we have to use escape sequence \ To search for "in" itself use /\ Eg. To search for /** we have to use /\/\*\*
To find last occurrence of a word in file First search for it using / → using 'G' move to EOF and then press N to search backwards Similarly to find first occurence of a word in the file →press 'gg' to move to top then press 'n' to search next occurrence of the word from top
To Enable and disable set highlighting :set hlsearch or :set nohlsearch (:nohl or :noh will work to) To disable incremental search(simultaneously searching while typing) :set noincsearch or :set incsearch Entering / or ? Then pressing up or down arrow searches word or anything from our search history Let's Say, Search History => while if main .... (continuous Pressing down arrow will search for while then if then main) And as we have used / so it will search forward and ? Backwards Similarly Pressing : (colon) then arrow up key let us execute the previous commands If we want to actually see the history q/ (forward history) q? (reverse history) in the history we can actually modify then press enter to search Eg in history if it's \ then putting cursor on c then pressing ~ will change it to \ then pressing enter will search for it. Similarly we can use 'r' to replace a character or we can simply write and delete Similarly, q: to see command history Press :q to exit
In a tragic case of happenstance, this video was released on the same day we received the news of Bram Moolenar's passing. RIP.
I've being using 'vi' since my Ultrix days and find this series of refreshing videos very informative. My muscle memory has carried me through the years for vi as I find my self pressing 'j' in many text editors by accident and always seem to come back to using 'vi' or at least I endevour to get it installed on my windoze machines. This videos series has cemented my desire to have it everywhere now. Thanks for the series, it's a real blast to find more tricks using vi (vim) as my long time favorite editor.
What a fitting tribute to Bram Moolenaar
It sounds like Bob Odenkirk is teaching Vim ! 😂
Honestly, good content and great efforts for putting 5 Hrs of Vim goldmine.
Thank you for the work you put into this series. I found the original uploads incredibly useful back when I was fairly new to Vim!
Coming back WITH GREAT STUFF! Restarting big! :)
Thank you Sir
Mr FrugalComputerGuy can we get a complete tutorial series for libre office. I saw some in your channel but those are very old like 8 years ago.
He's back!
Great to see you back :)
Damn, that's so awesome. Thanks a lot!!
Thank you! ❤
Thanks a lot man! You made vim my favourite text editor!
Thank you for this vim file!
VERY very GOOD video
BASIC NAVIGATION :
J - Down
K - Up
L - Right
H - left
'x' to remove a character under the cursor.
'a' insert after the cursor.
'i' insert before the cursor.
-> 'o' to open a new line , it will open a new line below the cursor and move to that line in insert mode
(Helps alot when we want to add something between two line generally we have to first go to the end of the first line then insert mode and press enter)
But pressing 'o' will open a line and move to that line in insert mode
shift + o will open a line above the current line we are on and move to that line
pressing 'n''o' will open n lines below current line and pressing 'n''O' will open n lines above current line
':q' to quit when no changes made.
':q!' force quit without saving any changes.
':w' write (save) the changes.
':wq' or ':x' write and quit.
ZZ to write and quit
To move to end of a line :
$ | end key | 99l
to move to Starting of a line :
0 | home | 99h
to move to end of a FILE :
G | ctrl + end | 999j | 100%
to move to Starting of a FILE :
gg | ctrl + home | 999k | 1%
'r' to replace a character under the cursor.
'~' to invert the case of the character Capital ←→ lower case
9l will move cursor 9 positions to the right
7h will move cursor 7 position to the left
18j will move us down to 18 lines from current one
8k will move us 8 lines up from current one
9G will move to 9th line , nG will move to nth line
:set number or :set nu will enable line number
:set nonumber or :set nonu will disable line number or :set nu!
:set relativenumber or :set rnu (to enable line number , from the line we are currently on set to 0) [makes easier to copy multiple lines]
:set norelativenumber or :set nornu (to disable relativenumber) or :set rnu!
NOTE: when we use ! then if it is ON by default then it will be turned on and vice versa, means we can use this command to turn on/off it will toggle between the two
'yy' to yank the line we are currently on (in the memory)
'P' to put the line (ABOVE the line/cursor we are currently on)
'p' to put the line (BELOW the line/cursor we are currently on)
'dd' to delete the line and put it on memory
'u' to undo the last change
ctrl + r (to redo the change)
'cc' to change the entire line no matter where is the cursor.
'nY' to copy n lines from the current line incl. the current line (eg. 5Y will yank total of 5 lines from the line we are currently on)
'nD' to delete n lines from the current line incl. the current line (eg. 4D will delete 4 lines and put in memory we can later paste them somewhere its like cut and paste or move )
[ Y- yank (entire line)
D - deletes (from cursor to end of the line) ]
'C' Delete from the cursor to end of the line and go into insert mode ( dids the same things as D and then i )
-> 'A' go to end of the line and go into insert mode.
'dw' delete a word
'dnw' to delete n words ( d2w will delete 2 words )
'w' to jump through words
'b' to jump backwords through words
'nw or nb' to jump through n words at once ( 2b will take back 2 words)
'e' to go to end of the word
-> 'ge' to go to end of the previous word
'ne or nge' to move through end of the n words
'b' to go to the begenning of the word
'W' to move through words but ignoring special characters and spaces
'B' same but moves backwards
[optional Number] [optional Number] ( when we press 'j' it moves cursor one line so 1 is the [number] , move down is and line is )
similarly, 2dw means 2 times delete a word or d2w delete 2 words
2d3l, 2 times delete 3 characters ( characters because on pressing 'l' we move 1 character right , so 3l means 3 characters right)
its same as 3d2l ) which means 3 times delete 2 characters in right.
2d3j , means 2 times delete 3 lines ( lines coz pressing j moves us one line down , so 3j means 3 lines down )
its same as d6j or 3d2j
> : to indent ("indent" refers to the space at the beginning of a line of text ) noun is important to mention to clarify that to vim about what to indent
so when we type '>l' or '>h' it means " [1] > " ( indent current line )
'>>' to indent current line
'>j' indent current line and below line , similary , '>2j' means indent current line and below 2 lines.
'2j' it means 2 times indent 2 lines means total of 6 lines coz 2j means indent current line and below 2 lines
'.' (dot) - to repeat previous command
we remember that, to change a character we use 'r' to change a line we use C which delete the line and move to insert mode
to change a word we use 'cw' it deletes the word and move to insert mode. [ like we change a word from hello to hey using cw then if we press . on other words it will change them to hey as '.' repeats the last command executed ]
'*' : to search the word the cursor is on.
Press 'n' to find next occurrence of the same word.
Press 'N' to search backwards.
'#' : backward search for the word cursor is on.
In this case functionality of n and N gets reversed
Press 'n' to find next occurrence of the same word. (Upward)
Press 'N' to search backwards. (Downwards)
/ : to search all the occurrence of a word in file at once and press n and N to move through
? : search backward
These above searching methods are CASE SENSITIVE (Database and database will be treated differently)
To disable search for case sensitive words
/\c (\c is escape sequence is we simply write /c it will search for c )
To search for case sensitive words (like if we search for 'Database' it will treat 'database' a different word and not search for it).
If we search 'in' it will search for it if in comes within other words , eg. /in will result "def(in)e","follow(in)g"... Etc
If we only "in" itself in the output we have to use escape sequence \
To search for "in" itself use /\
Eg. To search for /** we have to use /\/\*\*
To find last occurrence of a word in file
First search for it using /
→ using 'G' move to EOF and then press N to search backwards
Similarly to find first occurence of a word in the file
→press 'gg' to move to top then press 'n' to search next occurrence of the word from top
To Enable and disable set highlighting
:set hlsearch or :set nohlsearch (:nohl or :noh will work to)
To disable incremental search(simultaneously searching while typing)
:set noincsearch or :set incsearch
Entering / or ? Then pressing up or down arrow searches word or anything from our search history
Let's Say, Search History =>
while
if
main
.... (continuous Pressing down arrow will search for while then if then main)
And as we have used / so it will search forward and ? Backwards
Similarly Pressing : (colon) then arrow up key let us execute the previous commands
If we want to actually see the history
q/ (forward history)
q? (reverse history)
in the history we can actually modify then press enter to search
Eg in history if it's \ then putting cursor on c then pressing ~ will change it to \ then pressing enter will search for it.
Similarly we can use 'r' to replace a character or we can simply write and delete
Similarly, q: to see command history
Press :q to exit