5 ms·
What is the consensus on productivity with Vim? I have thought about trying out the keyboard only approach, but haven't wanted to invest time in it yet. When I
by mewpmewp2 2y ago
What is the consensus on productivity with Vim? I have thought about trying out the keyboard only approach, but haven't wanted to invest time in it yet. When I see people on YouTube using Vim it slightly feels like there's a whole lot of keypresses happening, but not a lot is actually gained compared to using a mouse or even frequently it seems it takes a while to do something that is much quicker with the mouse. I understand half the point is to be able to keep your hands focused in one place, but how do people feel about the productivity?
- keyle 2y agoIn my experience non-vim people are neither more or less productive than vim people. Pick your poison. Productivity comes down to so much more than typing/navigating/yanking fast. Especially when it comes to programming, which is 95% thinking, 4% swearing internally and 1% typing.
- 0x1ceb00da 2y agoSpot on. The smartest guy I know uses cmd.exe and barebone emacs as notepad with tabs.
- katzenversteher 2y agoOh, the swearing is supposed to be internal? That's probably why my colleagues give me these strange looks...
- dcre 2y agoOnce you start using it, you can’t edit any other way. I don’t think it’s well established whether it’s actually faster or better in any objective sense. It certainly feels faster than using a mouse, or if not faster, maybe less frustrating. 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.
- fragmede 2y agoThe difference in productivity is hard to measure. What's really gained by vim bindings is not having to leave flow state to move the cursor over there and then change that word for a different one. The same operating can be done with a cursor, but in having to leave home row and then come back to it, your mind has a chance to wander and you start thinking about whatever else is going on in life. Like why you're using a mouse and not vim keybindings.
- mewpmewp2 2y agoOne thing I'm concerned about is that, if I'm moving around the files, then there's already very quick keyboard commands available for that. 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.
- phatskat 2y agoI hear you and I raise you > 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.
- stevebmark 2y agoThere is no objective evidence that Vim makes you a more productive programmer. There is no evidence that avoiding a mouse makes you a more productive programmer. Use the editor you want! Vim is faster at some things and slower at some things. 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!
- phatskat 2y ago> 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.
- deleted 2y ago[deleted]
- stevebmark 2y agoI was indeed entertained with your imperative instructions to move the file, which is also slightly more annoying if your file is not at the top level!
- phatskat 2y agoSlightly, but you can tab expand the % and then just edit the name at the end of the path
- xigoi 2y agoAsk your local IDE nerd to rename a variable in a language that is not supported by their IDE ;)
- 2y ago
- smaudet 2y ago> how do people feel about the productivity 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....
- phatskat 2y agoVery simply, for me, keeping my hands on the keyboard feels right and means less movement overall. If I’m typing and want to correct something two words back, say “how rae you?” I can either - 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.
- theshrike79 2y agooption-left arrow twice, delete 2 times, type 'ar' and cmd-right arrow to get where you are. 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.
- worksonmine 2y ago> 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.
- theshrike79 2y agoSomeone still has to specifically add vim-support and you need to enable it. My method is the default working method for every single piece of software.
- worksonmine 2y ago
- nyarlathotep_ 2y agoPersonally, I'm just used to the bindings and I strongly prefer the editing experience, and think about navigating text via Vim bindings as a matter of habit. 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.