this post was submitted on 07 Jul 2023
11 points (100.0% liked)

VIM - Vi IMproved

1028 readers
1 users here now

For Vim enthusiasts and anyone interested in Vim/Neovim!

"VIM is the greatest editor since the stone chisel." - Dr. Jose Unpingco

#HJKL

founded 1 year ago
MODERATORS
11
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/[email protected]
 

TL;DR: I use a vim like editor which tackles Vim's greatest weakness: vis.

top 4 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 1 year ago (1 children)

I feel like a heretic for not knowing what sam was until reading this

[–] [email protected] 2 points 1 year ago

Be happy then as you're going to learn quite a few things on that path!

[–] [email protected] 1 points 1 year ago (1 children)

I have never used Vim in the manner you show in the Vim example. I use ex commands seldom — usually when I need to make mass changes to a file. You are really doing things the hard way if you use an ex command to add a semicolon at the end of a line.

[–] [email protected] 1 points 1 year ago

Of course the examples I gave are easier done interactively, rather than using ex commands. I used them because they're easy to read and understand.

I do however use ex (well, sam in my case ) commands quite often though. Examples include renaming variables, changing file paths reference, fixing repetitive typos, ...

There is another area where vis does a really good job: it's a good replacement for vim macros.

Sam's x command let me select a pattern that will match amongst multiple lines, and will then create a new cursor for every match. I can then interactively change text from all these positions at the same time, and the changes apply in real time. With vim you would have to build a macro, then apply it to multiple lines and verify the result, to either undo and restart from scratch, or "accept" the changes. It's very tedious when you figure out how simpler multi cursors are.