Here is how I think about it: the depth of these keyboard-based editors allows for a kind of progressive mastery and you decide how far to pursue it. Plenty of people use Vim in a very rudimentary way, barely using any of the features, and they still might prefer it. Others know certain slices of the functionality available, but everyone knows a different slice depending on how they want to edit. The point is it’s sort of an open space with lots of texture and customizability, which is sometimes how professionals like their tools. It lets you sort of build the tool into what you want it to be. And that can be true even without elaborate customization: even with a stock NeoVim install, figuring out over time which subset of features you care about is a kind of customization.
One tip I have: if you use VS Code, try the Vim extension. Or whatever IDE you use, see if it has a vim mode. That is by far the best way to learn, and it may well be the best way for you to use Vim long-term. You don’t have to change editors, you don’t have to configure anything, you can just focus on moving the cursor around in a new way.
And if I want to look around a single file, I feel like anything else besides scrolling would be quite inferior in terms of speed and accuracy.
And moving around lines and words is already quite optimal enough without a mouse, using arrows and option/command modifier.
So mostly I use mouse when I need to scroll around the file or click on a certain imported identifier to move to its definition.
And also I use a lot of ctrl + f to move around, which I find quite reliable.
> And if I want to look around a single file, I feel like anything else besides scrolling would be quite inferior in terms of speed and accuracy.
{ and } jump you to the previous/next new line, respectively. Also page up and down work of course, as well as arrows or j/k. But I’m rarely scrolling in vim because I know what I’m looking for and how to get there faster.
> And moving around lines and words is already quite optimal enough without a mouse, using arrows and option/command modifier.
Fair, and in vim you have a single key to jump words (w/W) or the f/F commands (along with ;) to quickly jump through a single character in a line. Example:
This is a string and I want to get to the last letter.
If your cursor is at the beginning of the line, you can just type “fr” and then hit ; until you’re at the “r” in “letter”. Or hit $ since really you just want to get to the end of the line. Or “f.” since there’s only one period. Or…
> And also I use a lot of ctrl + f to move around, which I find quite reliable.
And in Vim you can use / to search ahead, or ? to search behind. And n/N to jump to the next/previous match. Maybe your cursor is on the word you want to find more of in the file? Just hit * to jump to the next instance of it and n/N to jump next/previous.
- grab my mouse and click where I want the cursor, fix the typo, and then click back to where I was (or hit End, or was it Ctrl+Right? Opt+End?)
- type <Esc>Faa<Delete><Delete>ar<Esc>$
Ok, that’s a lot of weird keystrokes, but in my brain my hands just did “jump back to the a in ‘rae’, delete the ‘ra’, type ‘ar’, jump to the end of the line”.
Over a decade of Vim later and these motions are second nature to me, and using my mouse is usually reserved for the times I’m not in Vim. I can’t say I’m faster or more efficient, but I know how to get my cursor to exactly where I want it and how to manipulate, move, copy, delete, etc, in a way that feels natural and intuitive.
2 + 2 + 2 + 2 = 8 keystrokes. It also works in every single text input on macOS
Your solution is 1+3+1+1+2+1+1 = 10 keystrokes and only works inside vim.
And every other tool that supports it. I use it everywhere, window manager, terminal and every terminal program I use (via readline), my browser, and the list goes on. I rarely have to reach for my mouse, if I do it's frustrating and breaks my flow and I will fix it next time I have a few minutes to spare. I even have a shell script to move the cursor out of the way.
My method is the default working method for every single piece of software.
Lots of tools for power-users come with vim keys today, and when I choose a tool it's one of the first things I look for.
Now do it for 3 different browsers and all browser-based services you need to use daily (Like Confluence, Jira and Github).
In my browsers I use vimium, and you can embed actual neovim into textboxes with a few different addons, one of them firenvim. I rarely use GUI though and that's my point, I don't have to since 95% of my work is in the terminal.
You can do as you want of course, but that feels like you're limiting yourself to the point of absurdity.
The main drawback of all the keypresses you see is that Vim is an imperative editor: You have to tell Vim how to edit text by glueing together lots of small commands.* IDEs are declarative editors, you say "rename this variable" and they do it.
* Ask your local Vim nerd to rename the file they're editing. It will be entertaining!
Oh that’s easy though, friend :)
:!git mv % new-name
> IDEs are declarative editors, you say "rename this variable" and they do it.
Most NeoVim setups I’ve tried recently include LSPs with code actions, so now I just hover a variable and do “<Space>ra” and I get a little popup window asking me for a new name. I type it, hit enter, and the reference is updated in all relevant files.
With an LSP integration you get the exact same functionality in Vim/Neovim.
The biggest "productivity" changes for me in any IDE/Editor is the ability to fuzzy find for an arbitrary symbol, a keybinding to search for and subsequently open a file, LSP features like "goto definition", "find all references" (and jump back to where I was quickly) etc.
I think maybe you shouldn't focus on the "productivity" - that's a fairly arbitrary metric, and difficult to measure - it often has more to do with how many bugs you have, how organized you are, and what you are trying to accomplish, how good friends you are with your boss/customer, and very little to do with which editor or what keybindings (or which language, even).
Instead, it is better to think about communication protocols - for a second consider something like the internet - something like handwaves, gestures, while theoretically analog and hence containing infinitely more data, they are very difficult to transcribe, send to the other side of the planet, and interpret.
I'm not saying these things cannot be done, but I imagine the internet would not exist if we had resorted to using thumbs up/down as our method of transferring information between "computers". We used a more appropriate, binary-based, protocol, and now we can send characters and have discussions! Maybe even include a couple hand-wave emojis!
Editors like vim/emacs are similar, they "feel" more productive because they are in some sense, "closer" to the code than a mouse can be. If I mainly am using a mouse (nothing else), then I probably should not be writing code at all and instead should be recording my program with hand waves, or something.
I'm not saying IDE's aren't useful, but that's because programming is neither about those mad FPS skills (mouse) or nor mad text editing skills, they are built to manipulate and mangle symbols, which is what we actually use (for better or worse) to program computers.
That's one reason why I find IDEs (often coupled with an emacs keybinding) mad "productive" - I can mash shortcuts all day long and most of my code writes itself (I'm not even using AI). I'm much closer to communicating with my code/debugger than having to mouse click around. Some of the transforms/translations are sometimes odd, or the UI environment is restrictive, so I'm using the mouse then for those situations. I often, frequently, find myself "out-coding" my peers.
But a good IDE is mostly aimed at being really good at modifying/generating symbols (in the context of a project). Its not very good at text formatting (usually handled by some plugin), for instance. And where it really falls apart, there's no control, i.e. usually it is a complicated product, with lots of pitfalls, speedbumps, "I screwed up and jacked my cache please restart me". And that nixes a lot of the "productivity" gained.
So that remains where a tool like vim/emacs/notepad++ etc shines, when you need to communicate with (roughly structured) text, they won't crash on you, they won't "get in your way", they won't need you to define an AST syntax in order to understand your little mini-language, and, at least of the extensible ones, you can define whatever it is you need or want to. IDEs are usually really, really bad at that sort of thing, if you find yourself needing to do that, you'll often 1) learn to cobble something together in a script 2) learn to cobble together something approaching that in an extensible editor 3) writing a language 4) writing a plugin to write your language in your IDE, to solve whatever it was....