10 ms·
A little background. I am familiar with vi and use it only when I ssh into a server. But I never really felt it was more convenient or an improvement over a GU
by anondon 10y ago
A little background. I am familiar with vi and use it only when I ssh into a server.
But I never really felt it was more convenient or an improvement over a GUI based text editor or IDE on my development machine. Eg- gedit for simple text editing, Android Studio for android development, Atom for python coding. Everything works out of the box with minimal tweaking required.
Genuine questions:
-At what point on the learning curve do you feel using vim is an advantage for speed of development, if at all?
-The common argument of only keyboard, no mouse when using vim... I don't get. Is using a mouse such a major factor that slows you down or affects you negatively?
- exDM69 10y ago> -At what point on the learning curve do you feel using vim is an advantage for speed of development, if at all? Text editing is not a bottleneck in my development workflow, so I'd say never. This said, I wouldn't change to a different editor, especially one that doesn't have Vi-like modal editing. > Is using a mouse such a major factor that slows you down or affects you negatively? Yes and it's also an ergonomics disaster. Vim isn't great when it comes to IDE-like features but it's a great text editor once you grok the paradigm. If you use it like a "normal" editor, it kinda sucks. Once you can keep your hands on the home row at all times, you don't want to go back. Vim's killer feature, not found in any other editor I know, is repeat (.) . I use vim in tmux with a curses debugger and it gets a lot of IDE benefits but is language agnostic. Changing to a different editor/IDE depending on language/target platform/project just sounds awful.
- xur17 10y agoI've been using it as a plugin for pycharm and sublime text. I still end up using my mouse for larger, more involved editing, but I find it really useful to stay on the keyboard when moving around a file.
- clifanatic 10y agoWell, it depends on what you're doing. For example, if I want to duplicate a line in vi, I can type 'yyp' and _bam_: duplicate line. With a keyboard and a mouse, I have to reach over, select the whole line (being careful not to over or under select), hit Ctrl+C, move the cursor down to the beginning of the next line, and hit Ctrl+V. If I want to change the contents of a quoted string, I can type 'f"lct"' and start typing. Again, with a mouse, I have to select what I want to change: if I select too much, I can back up the mouse, but if I accidentally started the selection on the second rather than the first character, I have to abort the whole selection and start over again. If I want to change each line from the current line to the next blank line to a continuous quoted string, I can type ':.,/^$/s/\(.*\)/"\1" +/'. With a mouse, I have to click the beginning of each line and cut+paste the quotes into place, probably undoing at least a couple of times because I clicked the wrong place, etc. etc. I know, I'm talking about milliseconds (or nanoseconds) here, but when I use vi, it's just, sort of "constant", like playing the piano. I never break my rhythm.
- munificent 10y ago> With a keyboard and a mouse, I have to reach over, select the whole line (being careful not to over or under select), hit Ctrl+C, move the cursor down to the beginning of the next line, and hit Ctrl+V. Sure, but who does that? In any text editor on the Mac its: - Command-Left to move to the beginning of the line - Shift-Command-Right to select to the end of the line - Command-C to copy - Command-V to paste One annoying thing about that, though, is that it doesn't copy the newline itself, so if you want to paste the line and the line terminator multiple times, you need to do something more like: - Command-Left to move to the beginning of the line - Shift-Command-Right to select to the end of the line - Shift-Right to select the newline - Command-C to copy - Command-V to paste But, of course, most full-featured text editors make that easier. In Sublime and Atom, it's: - Command-L to select the current line - Command-C to copy - Command-V to paste
- travv0 10y agoSublime, at least, has a duplicate line command. I believe you can also use the copy command with no text selected to copy the current line. None of your examples seem nearly as effective as pressing yy to copy the line and p to paste below.
- splouk 10y agoAtom is the same.
- GrinningFool 10y ago- [2] Command-Left to move to the beginning of the line - [3] Shift-Command-Right to select to the end of the line - [2] Command-C to copy - [2] Command-V to paste Total keypresses: 9 Total keypresses for yyp: 3 (4 if you have to esc to normal mode first) My point being that even the simple and straightforward actions you provided are more complex than they seem.
- aninhumer 10y ago
- sheer_horror 10y agoI have replied to the other commenting wondering about Vim but I will say it here as well: Learning to get fast with Vim is incredibly rewarding. It is tough to memorize everything, sure. But it's all in pursuit of speed and efficiency that become huge multipliers over your career. You use so much less hand effort, and it runs straight from the terminal which means you need fewer running applications.
- fredleblanc 10y agoI just recently switched to vim full time, maybe 4 months ago, after my existing IDE switched to a subscription model following two updates that made the software more and more buggy. I don't have definitive answers, just experiences: 1. The first two weeks were hell. It felt like learning to use a keyboard all over again. I've tried to get started with vim multiple times, leaving because I needed something faster. This time, I just happened to catch a break in work where there was no one breathing down my neck to get stuff out the door yesterday. After two weeks or so, you start to learn the vim mindset. It's hard to explain, but vim is both a language (via movements and interacting) and a way of thinking (via modes). I'm still adjusting to all of those, but it's gotten to the point where I think of a task, attempt it with the shortcuts I know (the "language"), and 2/3 of the time, it just works. 2. Is there speed over previous IDEs and text editors? It's about the same for me, with the added benefit that I'm no longer tied to a system I have to pay for, it's cross-platform, and pretty available in most sports. For Mac at least, there are things like MacVIM where I believe they let you use your mouse to click around. I did all of my learning from the Laracasts vim series, and I really like his approach of doing what works for you. MacVIM adds shortcuts like command-S to save instead of :w and stuff. If it works for you, cool. I took the approach that I want to learn the base system (plus plugins) because that is a more common cross-platform interface. From using an IDE, I don't know if I'm saving time by not using the mouse or not, but I know that I can more quickly get places within the code if I know where I'm going. I assume the benefit of not reaching over to use the mouse is helping, but I can't really tell. For me, there were other reasons, but I don't regret the switch at all. I'm still quite the novice, but I've switched to using it nearly exclusively for projects. (If I just need to quickly open a file from the Mac Finder, I double-click and something non-vim opens. I'm OK with that, I'm no purist.) The only place it bites you is when you use vim for a while and then go back to something like Code or SublimeText and you're typing vim commands into the screen as characters. Make sure you double-check your work so that you're not pushing ":w"'s up to production. :)
- pedrosorio 10y agoSublimeText allows you to edit text using vim modes as well.
- MichaelGG 10y agoThe best comparison I have is: You know how when you are helping someone that doesn't know how to use a computer? How frustrating it is as they slowly mouse around, looking for stuff - makes you wanna just sit down and take over? Well that's how I now feel when someone else is editing a file without Vim.
- baldfat 10y agoMy simple whys. No mouse needed is the biggest. It is like when you watch someone not use short cuts in your OS or they use mouse to select the word and then right click for copy. diw to delete whole word. yy then 5p to repeat the line 5 times instead of copy paste. / for search is really nice. gg to go to the top or G to go to the bottom. These things make it worth using vim for me. I use vim mode on all the editing programs (RStudio and VS Code)
- aninhumer 10y agoBut most modern editors have similarly efficient shortcuts for all those things that fit alongside modern UI shortcuts. e.g. in Sublime: <Ctrl-D><Bksp> to delete a word. <Ctrl-Shift-D> to duplicate a line. [0] <Ctrl-F> for search. <Ctrl-Home/End> to go to the top or bottom. I'm increasingly unconvinced that vim has much to offer in terms of shortcuts when compared to actual modern editors, rather than some kind of strawman notepad. [0] No numeric repetition, but I was never convinced by that feature TBH. In most cases, the mental overhead of working out the appropriate number for a situation was greater for me than just spamming a button a few times.
- jjcm 10y agoThe biggest thing with vim is it provides a language for actions rather than individual actions itself. This allows for far greater action control than a standard editor via shortcuts. For example, maybe you need to delete the next two words (d2w - delete 2 words). Or maybe you want to delete the next four words, then replace them with something else (c4w - change 4 words). Or maybe you need to change the every letter of the next ten lines to uppercase, until you hit the letter 'a' on each line (qq0gUtaj10@q). VIMs shortcuts aren't better because they're more powerful, they're better because there's an infinite combination of them.
- aninhumer 10y agoAs I mentioned above, I'm not really convinced that numeric repetitions are that useful, because counting instances, even at a glance, is more mental overhead than just pressing a button a few times. Because most of the time I don't want to "delete n words", I want to delete these words, and there happen to be n of them. More generally, my experience of vim is that I'd spend longer working out how to do something with one command than I'd have taken to just use a few simpler actions. And that didn't really get better with time (I used it as my primary editor for a few years), because sufficiently complicated editing tasks just don't arise that often. And personally, I find Sublime's multiple selections much easier to apply in ad-hoc ways to unusual editing scenarios than vim's vocabulary. A common scenario I encounter, is that I realise I need to make a change in many matching places, but I don't know immediately whether it applies to the entire file, or whether there are some edge cases. In Sublime, I select one instance, step through adding matching ones to the selection and excluding any I don't want, and then make the edit confident that I'm changing exactly the things I want to. In vim, my experience was that I'd write a substitution, discover it was too general when it broke something, and then try to work out how to exclude the cases I didn't want, which was often nontrivial. EDIT: Thinking about it now, I guess the vim way to do the above would be to / for the first case, make the change in insert mode and then use /. for the others. Although if it's a complicated edit, it might not be effective to use insert mode, so I'd need a macro maybe? I found those kinda fiddly tbh.
- greenshackle2 10y ago>-The common argument of only keyboard, no mouse when using vim... I don't get. Is using a mouse such a major factor that slows you down or affects you negatively? Yes, it hurts my wrist. If I use it continuously for too long it becomes disabling. I use awesome window manager, tmux, vim, vimium browser plugins so that I never have to touch the mouse. Keyboards hurt my wrists too but it's much more manageable. I havn't measured actual speed/efficiency, but once I got used to keyboard shortcuts for everything using the mouse feels slow, clunky and inaccurate.
- Avshalom 10y agoHow are you using your mouse? like writing and well everything actually 90% or more of the movement should come from your shoulder/elbow.
- Avshalom 10y agoIn college I used something like 10 systems on 6 networks of which I had control over 2. VIM was already everywhere, that's when it's worth learning. When ubiquity is a compelling feature
- scelerat 10y agoIt took me about six months of using vim every day to feel like I was as efficient as I had been with Textmate or BBedit (the best options available to me at the time). I was already very agile using the keyboard shortcuts in BBEdit and other Mac text editors, but now for text editing I really do prefer vim's modal style. And yes, after having been using vim 95% of the time for a few years, it really is faster to keep hands on the keyboard instead of using the mouse. MacVim lets you point and click to position the cursor, just like any other text editor. I almost never do, though.
- neokya 10y agoThis is exactly what I feel too. After watching Bret Victor's talk https://vimeo.com/67076984 https://vimeo.com/67076984, I feel like Vim way of using computers is backward. I am probably wrong because I never got proficient with Vim. Using it only when I SSH to remote server.
- weaksauce 10y agofor text editing and specifically text editing code... vim's command set is amazing. it's short verbs for editing text that are easily remembered. d delete c change t 'til f find a after i insert u undo o open a new line p paste or put n next occurance b back a word y yank (copy) v visual ect. coupled with an object that are less friendly to learn but there aren't that many of them w word e end of word ( sentence { paragraph text blocks are directly what you want to change " double quotes ' single quotes ( parenthesis { curly brackets t tag ci( change inside the ( da" deletes around the double quote, etc. it's easy to compose sentences for editing text. this person does more to explain why: http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118 http://stackoverflow.com/questions/1218390/what-is-your-most...
- appleiigs 10y agoI often code with my laptop while I ride an exercise bike. Can't use a mouse there. Trackpad is terrible when hands are sweaty. Move too much for home row, so I two-finger type. Vim is great for this.
- flukus 10y agoAnother feature is that it's the easiest editor to configure and extend to be just how you like it. Parsing company specific log files for example, can be done in a few lines of code.