You can also select a specific lines by visually selecting those lines. Press CTRL + V in command mode, use navigation keys to select the part of the file you want to be substituted. Press ‘:’ which will automatically formed as :’<,’> Then you can use the normal substitute as
:'<,'>s/helo/hello/g
"<" ">" delimiter de debut et fin de mot. e.g.
:s/\<his\>/her/
When the string starts with ‘\=’, it should be evaluated as an expression. Using the ‘line’ function we can get the current line number. By combining both the functionality the substitution does the line numbering of all lines.
:%s/^/\=line(".") . ". "/g
\=submatch(0) get the 1st matched pattern
BOOKMARK
local bookmark (dans un fichier)
créer : m{macro-name} e.g. ma
acces : `{macro-name} e.g. `a
acces debut ligne : '{macro-name} 'a
list : :marks
global bookmark
meme chose mais avec macro-name en majuscule
RECORDS
Start:
Type: Esc q followed by a
q indicates to start the recording
a indicates to store the recordings in register a
When you do q a, it will display “recording” at the bottom of the vi.