Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I regret to tell you, `dib` is a specific action you just can't beat with a mouse.

Type it for me. dib.

C'mon.

I'm not a member of the ratpoison squad, and use vim commands because they are eloquent. Sometimes that's fast, sometimes it isn't.

I use a mouse because it is versatile and I'm not competitive at vim golf or trying to be.

dib is great though, right up there with ddO.



> I regret to tell you, `dib` is a specific action you just can't beat with a mouse.

> Type it for me. dib.

Ok. I took the bait and typed it. Fro the looks of it found the next matching set of parentheses, deleted content between them, and placed the cursor between them.

I'm.... supposed to be impressed by this random action of destruction?

> dib is great though, right up there with ddO.

Delete a line and insert one empty line? (As far as I could deduce from typing it several times).

But at this point we're veering into the territory discussing weird Vim commands :)

--- offtopic ---

IDEA's versions for this are, on a Mac:

dib:

- Option + Arrow Up to semantically select groups of words. Where "semantically" means "depends on the language". Atrribute value -> attribute value with quotes -> attribute_name="attribute value" -> tag etc. if it's HTML. Value -> declaration -> block -> etc. if it's a programming language (in reality more complex than that)

- Backspace to delete

ddO:

- Cmd + Backspace to delete line - Option + Cmd + Enter (insert line above) to insert new line in place of the deleted one


The great thing about vim is every major IDE has a vim emulator. So even when I use JetBrains I still get to use vim plus all the other great things in their IDEs. IDEA Vim is great. I had a job where I had to use many tech stacks and different IDEs and they all had vim.


> I'm.... supposed to be impressed by this random action of destruction?

I use di" more often but it's the same thing really. fnCall("a| string"), `di"` lets me replace the string, `dib` to replace the argument (all of them ofc if there's more than one).

If ddO isn't available, granted, Cmd-right-backspace will clean up just as fast. Or Cmd-left-delete if you have both keys.


I still have no idea what di or dib does. (There should be an explain vim a la https://explainshell.com :) )

> `dib` to replace the argument (all of them ofc if there's more than one).

I prefer editors that are aware of context :)


No idea what dib is, and you haven't explained what it is.

Are there specific actions that might be faster than mouse in vim? Yes.

Does it mean that vim is always faster? No.

Does it mean that there exists a dichotomy between keyboard and mouse? No.


> Does it mean that vim is always faster? No.

Yes. You don’t have to move your hands away from the home row, you don’t have to do some random moves with your mouse to locate the pointer. Vim is pretty much always faster. The important thing here is not the speed though - who cares if you spend 2 vs 5 seconds to select a paragraph anyway. It’s just that vim has much more convenient and most importantly precise way to interact with text objects, that’s it. Precision is the key.


Decide whether it's "vim is almost always faster" or "it's not the speed though who cares if you spend 2 vs 5 seconds".

> Precision is the key.

It's funny how you say this and dismiss an actual precision pointing device. It's also funny we are in a subthread that shows how to do arithmetic just to move up and down a certain number of lines and precisely position cursor where it's needed.

Also, a good article on keyboard vs. mouse someone linked in the thread: https://danluu.com/keyboard-v-mouse/


> right up there with ddO

I believe S or even cc is more succinct


See that's vim golfing! I kid, I kid.

I use ddO because I use dd and I use O, while I've never gotten 'conceptually fluent' with using the c range to do delete-then-edit. I know it's there but I don't use it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: