By default Command mode is active. Insert mode used for typing. Visual modes used for copy paste. Visual block mode used to select and copy colums.
'i' enter Insert mode 'o' - enter Insert mode and add new line 'v' - enter Visual mode 'ctrl+v' - enter Visual block mode 'esc' - exit Insert or Visual mode and back to Cammand mode
$ vim file.txt
':q' - close file ':q!' - close without saving ':wq' - save and close file ':e other-file.txt' - open other file without closing vim ':new' - new unsaved unnamed file in new tab ':w file-name.txt' - save unnamed file ':e' - reload file ':ls' - list open files ':bp' - previous ':bn' - next ':bn *filename-part*' - with tab key providing auto-completion
'yy' - copy line 'p' - paste 'u' - undo 'ctrl+r' - redo 'd' - delete selected 'dd' - delete line 'd5↑' - delete 5 lines up 'y3↓' - copy 3 lines down *delete works as cut
'/pattern' - search for pattern in file '/regexp' - search using regual expresion 'n' - step to the next find item 'noh' - clear search highlight
':vsp' - split vertical ':sp' - split horizontal 'ctrl+w arrow' - move cursor to other tab ':q' - close tab ':cd' - change directory ':pwd'- current directory
Global config, make shure, file permissions is set to 644
Config for single user
Running multiple jobs in single terminal window
'ctrl+z' - send to backgound 'jobs' - list all jobs 'fg' - bring from backgound 'fg (number)' - bring from background by list number 'kill %(number)' - kill job 'cd -' - go to previous path
$ grep -r --include="*.c" "main" ./
Git grep works faster, so to search inside git repo use:
$ git grep "main"
'-n' - to see line numbers