Home Nvim: common action/movement
Post
Cancel

Nvim: common action/movement

Background

After some set up of vim I want to mark down some common action that I used within my Nvim. Most of them are quite useful during processing log and unique that only vim have this function

Actions

Delete

Command to delete all lines include string “potatochick2020”

1
:g/potatochick2020/d

Command to delete all lines not include string “potatochick2020”

1
:g!/potatochick2020/d

The logic behind bellow delete command is delete until cursor , so $ in normal mode mean move cursor to end of line, d$ mean delete until end of line

Delete until end of line in normal mode

1
d$

Delete until start of line in normal mode

Delete until end of Document

1
dG

Delete until start of Document

1
dgg

Motion

go to line x , e.g. 1

1
:1

Hop.nvim

Basically I could go to anywhere of my screen with few click, I type :HopChar1 for demonstration purpose. In my use case, I had map it to -J , which my leader key is space key.

hop.nvim-demo

with Hop.nvim, I could do to perform delete until destination.

1
2
3
4
d
:HopChar1
first char for search
second char for jump

Sorting

Sort ascendingly

1
:sort

Sort Descendingly

1
:sort!

Undo

Undo

1
u 

Redo

1
C-R
This post is licensed under CC BY 4.0 by the author.