User Tools

Site Tools


linux:vi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:vi [2020/09/07 19:03] Wulf Rajeklinux:vi [2023/05/29 11:55] (current) – external edit 127.0.0.1
Line 44: Line 44:
 set expandtab set expandtab
 </code> </code>
 +
 +===== Cut, Copy & Paste =====
 +
 +  - Press ''v'' to select lines or test with cursor keys
 +  - Then press ''y'' to copy the selection or press ''d'' to cut the selection
 +  - Then press ''%%'%%>'' to skip to the end of the selection
 +  - Then press ''p'' to paste under the cursor or ''SHIFT+p'' to paste after the cursor
 +
 +  - Copy the entire line by pressing ''yy'' (more info :help yy ) or cut using ''dd''.
 +  - Paste the line by pressing ''p''.
 +
 +===== Copy whole file to clipboard =====
 +
 +The clipboard is buffer +. To copy to clipboard, do "+y and [movement].
 +So, gg"+yG will copy the whole file.
 +
 +Similarly, to paste from clipboard, "+p
 +
 +Alternatively:
 +gg"*yG
 +:%y+
 +
 +===== Search & Replace =====
 +
 +<code>
 +:%s/bla/blubs/
 +</code>
 +
 +Complex replace with reference:
 +<code>
 +:%s/rtrim(\(.*\),"0")/zerotrim(\1)/
 +</code>
 +
 +to repeat, press ":", then the cursor up
  
linux/vi.1599501791.txt.gz · Last modified: 2023/05/29 11:53 (external edit)