Skip to content

Instantly share code, notes, and snippets.

@wall-e-08
Last active April 18, 2024 17:22
Show Gist options
  • Save wall-e-08/795f139f2a6d46494e96f4ba2b4db62a to your computer and use it in GitHub Desktop.
Save wall-e-08/795f139f2a6d46494e96f4ba2b4db62a to your computer and use it in GitHub Desktop.
VIM personal cookbook
to modify lines=>
:<start_line_number>,<end_line_number>s/<regex>/<text>
for example to add comment on start from line 5 to 10: ":5,10s/^/#"
to undo this: ":5,10s/^#//"
to copy specific line
1. Move the cursor to the line you want to copy.
2. Press yy to copy the entire line.
3. Move the cursor to the position where you want to paste the copied line.
4. Press p to paste the copied line after the cursor or P to paste it before the cursor.
OR
:<line_number>copy .
For example:
:5copy .
to copy last line:
1. Move the cursor to the line you want to copy from.
2. Press Shift + yy to copy the line.
3. Move the cursor to the position where you want to paste the copied line.
4. Press p to paste the copied line after the cursor or P to paste it before the cursor.
OR
":-1t."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment