Vim-cheatsheet: Difference between revisions

From wikipost
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 22: Line 22:


<pre>
<pre>
:%s/word1/word2/ once
:%s/word1/word2/g entire document, all instances on a line
:%s/word1/word2/g entire document
:%s/word1/word2/gc entire document, all instances on a line, with confirmation
:%s/word1/word2/gc entire document, with confirmation
:,$s/word1/word2/c staring from current line, first instance, with confirmation
</pre>
</pre>

Latest revision as of 02:03, 5 May 2024

Cursor movement

gg      home
G       end


Markers

ma      set current position for mark A
'a      jump to position of mark A
['      previous mark
]'      next mark

:marks  show list of marks


Find and Replace

:%s/word1/word2/g     entire document, all instances on a line
:%s/word1/word2/gc    entire document, all instances on a line, with confirmation
:,$s/word1/word2/c    staring from current line, first instance, with confirmation