Ok. I had been introduced to “Vim” (vi) quite few years ago… i think was 2005?
Before that I was using “pico” which is meant for pine or reading email client if not mistaken.
At that time , i was hardly know how to use vi .
remembering how did i always messed up whenever tried to edit cronjob using
“crontab -e” . it spawn the default editor instead of pico.
most of the system i used by then was vi..
First few attempt was the following sequence :
vi file.txt :q! - quit without change i - insert :w - write to file :wq - write to file and quit :wq! - write and quite with override option.. doesn't care if file is not written due to permission or anything. (that time got no sense of file permission yet.. haha)
vim -r file.txt - recover from a .swp file? view file.txt - just view the file without altering it.. as someone else is also accessing the file. y - for yank d - delete p - for paste. 3yy - for three line copy r - for replace v - for visual mode. i - for insert mode.
:%s/texttomatch/replacewiththis/g - for replacing thing gg - go to top most of current file G - go to most bottom?
then few week back.. learnt the following..
:split . - split the screen horizontally with the current folder content.. which is clickable.
:vsplit . - split the screen vertically .. with current folder.
shift+v – to start line selection. (change to visual mode)
then followed by down arrow to highlight the line.
press y to yank..highligted line.
then move the cursor to where to put..
press p to paste..
% - to find the next closing bracket. u - to undo ctrl+r - to redo :set ai - turn on auto-indent :set noai - turn off auto-indent .. useful whenever pasted from other window.
and also the ~/.exrc with the following content.
set ts=2 set shiftwidth=2 set ai set background=dark
I believe there are many more usage…
let’s collect it before I forgot how to use them