Hacker News new | ask | show | jobs
by stevebmark 544 days ago
Agree that Vim is a language to talk to your computer, but it's not necessarily efficient. Vim is famously an imperative editor: You have to tell Vim the sequence of steps to perform. Clicking your mouse on a position on the screen is declarative: You declare you want the cursor here. With Vim you have to imperatively walk the cursor to where you want to go, or god forbid use something like easymotion.
7 comments

Setting aside that you can enable mouse mode in vim and use the mouse to your heart's desire --

and setting aside the "declarative" vs "imperative" nomenclature debate --

vim is pretty dang efficient. Typing `gg` to go to the beginning of a file, or `G` to go the end. Or all the other variety of motions. There are a lot.

Also, there is not necessarily any need to move the cursor anywhere. For example, if I'm in the middle of writing some string and I've decided to change the whole thing, `<ESC>ci"` does that, with no cursor movement required.

You can, in fact, click to set the cursor position and even click and drag to select.
It is imperative in certain editors that you fumble for the mouse whilst in vi one can simply declare 3ff to get to the third f on the line. Granted, I mostly do not use certain editors, and accidentally compiled mouse click support out of the terminal—brushing the trackpad risked spamming programs with mouse noise, and some programs would sometimes do silly things with it. The mouse is fine for focusing terminals, I guess. (No, not vim, vi.)
> With Vim you have to imperatively walk the cursor to where you want to go, or god forbid use something like easymotion.

If you prefer to use a mouse you can do that in Vim too.

It even works over SSH.

> With Vim you have to imperatively walk the cursor to where you want to go

I used to use vscode with mouse. Then vscode + vim with mouse. Then I forced myself to actually learn how to "properly" use vim, including all the motions plus enabling smart line numbers.

As a result, my right hand switches between keyboard and mouse much less than they used to, and I can do development work with my hands stay on the keyboard for minutes or longer. It made me more efficient, and RSI was much less of a problem.

set incsearch

Now use / (+ n or N) + Enter to move around

Done

Incremental search in vim is great, you can also cycle through results with CTRL-G/T while typing.

This even works as a motion (e.g. d / foo, then ctrl G until you hit the right foo, then enter to delete until there).

That is great! Thanks
That's like telling some small child they are lesser because they can't walk because they're still learning to crawl. The systems that vim worked on didn't even know what a mouse was.