DEV Community

Discussion on: Use VIM macros to move quickly through a file

codeluggage profile image
Matias Forbord • Edited on

Macros definitely rock. I only tend to use them when operating on similar patterns of text multiple times in a row.

My preference for movement is to use one of these:

I - insert before first character in current line
A - insert after last character in current line
0 - go to first character in current line
$ - go to last character in current line
[ - move a paragraph up
] - move a paragraph down

I also really enjoy doingf. and then ; afterwards, to move from period to period in a block of (non code) text. The rarely used , is nice to move to the previous result too. Love it!

Vim is a beautiful "language"! Always cool to see more posts on the topic.

connorbode profile image
Connor Bode Author • Edited on

Thanks for sharing!

I'm not aware of ; or , commands, I dont think (sometimes when I get to a keyboard I'll realize I actually do use the shortcut without knowing it.

I'll have to check them out!

Another problem I have to solve for switching to VIM full time is dropping multiple cursors. For example, a thing I commonly do in other editors is to drop multiple cursors where there is a similar pattern, like ', after each array or list element in many languages.

I suspect macros may be the answer to that problem as well.