@malin Ooh, that's cool. Hadn't seen that before. BTW the code editor I'm using at work has VI on it and it's already been quite useful. Combined with a macro, the efficiency is wonderful.

@anguslm Nice! Vim's the best. I use it for normal writing and after that everything else feels like breathing sludge.

What's your language?

@malin Java, and yeah, I just finished a small project and decided at the end that I wanted to make all the inputs case invariant by replacing each instance of equals with equalsIgnoreCase. Couldn’t help but smile at how annoying that would have been to do manually.

@anguslm Ah! That's just 'find and replace'. There's a wealth underneath that.

Couple of good ones:

`ci[` = change everything that's inside square bracketsss.

`ca[` = same as above, but also deletes the brackets.

`fA` = go to the next capital A on the line.

`df9` = delete everything from here till you find the number 9.

`dF.` = delete everything from here, backwards, till you find a full stop.

`qrI+{Escape}jq10@r` = listen to me, put a '+' at the start of the line, then do that 10 times

@malin Oh cool, I can get fA df9 and dF. to work, but not the others. With the first one, hitting i exits VIM.

@anguslm Maybe that's what's exiting upon the stroke of "i". Was it really so difficult to exit that people needed a plugin to get out?

@malin I think i changes it to insert mode rather than completely quitting. What's the format for the ci[ command? ci[ then space then replacement word then enter? or without the space? or something else?

@anguslm Literally you just enter inside some [ brackets ] then type "ci[", and everything inside the brackets goes, and you're in insert mode.

"di[" should delete all inside the brackets.

Follow

@malin Ah, you have to be inside the brackets already, I thought it was to take you to the next bracket and then alter it.

@anguslm Hey - we should see about Vim golf sometime. It's where people compete to complete a Vim task with the fewest number of keystrokes.

@malin I can see that being useful though, especially if you can have versions like find-and-replace-all-x-in-brackets.

@anguslm It becomes instinctive pretty quickly - like a specialized language.

It works on more than square brackets of course - you can ` ci" ` or ` da' `, and then combine this with on the fly macros, or combine macros together.

Ooh! Also like 50 clipboards. I'm using a version of vim which yanks to the computer's clipboards (Linux has 2), in addition to having its own.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.