Vim-cheatsheet: Difference between revisions

From wikipost
Jump to navigation Jump to search
(Created page with "===Markers=== <pre> :ma set current position for mark A `a jump to position of mark A :marks show list of marks </pre>")
 
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
===Cursor movement===

<pre>
gg home
G end
</pre>


===Markers===
===Markers===


<pre>
<pre>
:ma set current position for mark A
ma set current position for mark A
`a jump to position of mark A
'a jump to position of mark A
[' previous mark
]' next mark


:marks show list of marks
:marks show list of marks
</pre>



===Find and Replace===

<pre>
:%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
</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