\z1 ... \z9 */\z6* */\z7* */\z8* */\z9* *E66* *E67*
Matches the same string that was matched by the corresponding
sub-expression in a previous start pattern match.
Cursor line and more...
* You can turn on cursor line and cursor columns
':set cursorline'
':set cursorcolumn'
* Pressing 'q:' or ':<Ctrl-f>' gives the command history window (list of
previously executed commands in the current session)
* Pressing 'q/' or '/<Ctrl-f>' gives the command history window (list of
previously executed commands in the current session)
Note: to highlight special keywords we can use the match option as
':hi <MyGroup> ctermbg=red'
':mat <MyGroup> /<pattern>/'
To clear these highlights do
':mat[ch]'
* '/<pattern1>\|<pattern2>' search for multiple patterns using OR '\|'
* Show lines matching word under cursor '[I'
Repositioning the Screen
'z' Move current line to top of screen
'z.' Move current line to center of screen
'z-' Move current line to bottom of screen
CaSe FOrmaTting
"~" swaps the cAse of a single character
"g~~" toggles the case of an entire sentence
'guu' or 'Vu' makes an entire sentence lowercase
'gUU' or 'VU' makes an entire sentence UPPERCASE
'vE~' flip case word
'vEU' upper case word
'vEu' lower case word
'ggguG' lower case entire file
'=}a' or '=a}' re-indents the current {.....} block relative to how
the {, } have been indented
General key syntax '=<motion>'
Navigating -
"[c" will go to the line of the next difference
"]c" will go to the line of the previous difference
One way to use this is to create a number list
insert 1
'qa'
'yy'
'p'
'CTRL-A' on the new line to convert the 1 to a 2
'q'
'20@a' and voila! You have number 1 to 22 pasted in your file
Three commands can be used to apply commands over multiple files
':argdo'
':windo'
':bufdo'
'argdo' applies a commands on all the files indicated by the 'args' command
':args *.[ch]'
':argdo %s/<pattern1>/<pattern2>/ge | update'
The 'e' option suppresses errors if <pattern1> is not found in a
You can easily start editing at a previously
saved state/views by using the '-S' arguement as
'vim -S session.vim'
To create a session at some point, you can use the command
':mks[ession][!] <filename>'
:help local-additions' shows you the entries for the local help file
The 'set' options can be traced as follows
':verbose set ' - this helps trace from which file this option has been set
We can figure out for a particular group what 'autocmd' has been set
':autocmd ' - this shows all that has been set for a particular group & filetype