星际穿越

Vim Tricks

2024-04-16

jumps

  • gg/G, num+gg
  • hijk
  • jump
    • C-o(out/previous), C-i(in/next)
  • mark
  • 0/$
  • I/A

manipulate numbers list

  • ctrl+a/x ascending/descending
  • gctrl+a/x
  • 10g
  • :help CTRL-A

go to end of current tag (when editing HTML/Vue/React files)

Choice1: only use raw features of VIM

vat + Esc to get to the ending tag.

vato + Esc to get to the starting tag.

After vat you can also press o to jump back and forth between the start and the end.

Choice2: use plugins

matchit

Seems like matchit plugin will do the same by allowing you to jump with %

https://github.com/vim/vim/tree/master/runtime/pack/dist/opt/matchit

vim-matchup

I’d recommend using matchup these days, it’s a modern replacement for matchit.

https://github.com/andymass/vim-matchup

string substitute

https://poe.com/s/ReEG2NsFyCqw06dnl1Kr

Tags: vim