To format text in LaTeX you need to surround it with curly brackets, e.g. \emph{}
to render it emphasized. I often need to add commands like that to selected text fragments, nothing that could be covered with a simple :%s/foo/bar/g
substitution. I already figured out how to do the substitution for one selection with the help of Replace in Visual Selection, e.g.:
:'<,'>s/\v%V.*%V/\\emph{&}/
To do this for multiple words, I repeat:
- select
- type
:
- press ↑ followed by Enter
Take this as an example, let’s say I want to replace “bayc’” in the first, “minč’der̊” in the second and “oč’ t’e” and “ayl” in the third sentence – and can’t type those special characters easily:
Irenk’ miayn bołok’ kar-oł en nerkaya-c’n-el bayc’ da hayec’akarg č’-i kar-oł {hamar-v-el. (Ar̊avot 06.04.2006)} \\
Agah mecaharust-n ayr-v-um ēr džoxk’-i krak-ner-i meǰ minč’der̊ Ałk’at Łazaros-ě bazm-el ēr hayr Abraham-i {kołk’-i-n. (Nazaryan 2006: 170)} \\
Na naew ěndgc-el ē or hakamartut’yun-ě kar-oł en luc-el oč’ t’e mijnord-ner-ě ayl {kołm-er-ě. (Armenpress 25.03.2006)} \\
Is there an easier way to either do a substitution for multiple selections at once or repeat the command faster (something like . for ex-mode commands)?
/
, usecgn
to replace the text and then use.
to repeat orn
to skip?