4 ms·
> [I] found the "hjkl" navigation difficult That's because you're doing it wrong! Hjkl are fallbacks to move a few characters, it has only a minor advantage ov
by Aachen 4y ago
> [I] found the "hjkl" navigation difficult
That's because you're doing it wrong! Hjkl are fallbacks to move a few characters, it has only a minor advantage over arrow keys are is probably not worth the effort of re-learning how to move a cursor.
I would not recommend learning that as your first vim move. Just stick to cursors for moving individual characters at first.
The real magic is in going back/forward words (b/w/e) without needing to reach for control at the edge of your keyboard, jumping to an exact point you need (f/F/t/T) if it has a unique character (like the ')' within 'if (uid == 0)'), moving between paragraphs ({/}), going to matching parens/braces/brackets (%), going to the next/previous word under the cursor (*/#), etc. This is what will make you faster, not the switching from arrows to hjkl.
And that's just cursor moving. For editing, things like S to replace the line or C to replace the rest of the line after the cursor, di) to cut the part within parentheses and p (paste) it elsewhere, repeating the previous action with dot, searching with n/N instead of a function key, all those things are what makes vim nicer as a text editor. One of the least-appreciated things that I also use a lot is filename completion with ctrl+xf (sysadmins, take note!).
But I don't recommend learning everything at once. If you know how to go into insert mode (i), how to leave insert mode (escape), and how to save a file, then you basically have the equivalent of a text editor, especially with mouse mode enabled (the default nowadays, I think). From there, learn one command every week. Takes 1 minute per week and you'll know more vim than 99% of developers within a year.
Or go a bit faster and try to learn one command every morning, or every second day perhaps. Try it for one month and see if you want to go back to standard editors. Odds are, you'll want the best of both worlds, start looking for vim key binding plugins in IDEs, and end up like me with missing vim after all because those keybind plugins are usually not so great ^^'
> mostly using Java IDEs, and lately some vscode (for go, typescript, rust)
Do you need intelligent autocompletion, debugging, and other such IDE features?
There are plugins that, so far as I know, can do a lot of what an IDE can do, but I have never bothered to set them up myself. It all seems hacky and niche, but others can tell you more if this is the type of things you're looking for. I am not a real developer myself but I write a lot of scripts (things small enough to keep a full understanding in my head) as well as documents (reports for pentests) in vim, and for that it is perfect.
- gjulianm 4y ago> There are plugins that, so far as I know, can do a lot of what an IDE can do I want to add that the converse is true too: there are a lot of plugins (for IDEs) that do a lot of what Vim can do. I personally use the neovim integration for VSCode and it's really nice.
- Aachen 4y agoHave you used the real vim a lot in the past? More than a few days of trying it out, I mean. Probably you replied around the same time as I edited in: >> Try it for one month and see if you want to go back to standard editors. Odds are, you'll want the best of both worlds, start looking for vim key binding plugins in IDEs, and end up like me with missing vim after all because those keybind plugins are usually not so great It might just be me who got too used to vim bindings by now so that the suboptimal implementations are annoying. Or maybe the vim bindings in VSCode are particularly good, I haven't tried those. (I've tried them in real visual studio in ~2015 and it was so bad that I ended up using plain visual studio instead, then went back to plain vim on linux after my C# internship.)
- gjulianm 4y agoThe VSCode neovim plugin is really good because under the hood it's just using neovim to manage the buffer, so everything that works on Neovim works on VSCode. It's true that some plugins are suboptimal but the VSCode one (and the one for Sublime when I used it) are really good.
- lloeki 4y ago> things like S to replace the line what is this barbaric default binding, s/S shall be bound to the indispensable vim-surround! ;) built in text objects are already nice combined with modifiers (e.g cw, ciw, caw, cW, ciW, caW), ramping it up a little bit with argument (ca, cia, daa), surround (cs"', cs([, ci", ca", viWS<tag>, dst), and indent (vii>) is stupidly powerful. Once the [verb][modifier]{object} pattern clicked for me my mind was hopelessly infected and I could not ever go back to non-vim editors. To me that's the risk of learning vim: if it starts clicking for you (which it may not, as pure personal fit, not elitism) then it becomes excruciatingly annoying to edit non trivial amounts of text and not have vim.