5 ms·
The following has been repeated quite a lot on HN, but for people who are new to vim or new to reading HN it bears repeating. 1. Go to your terminal. 2. Type
by melvinroest 7y ago
The following has been repeated quite a lot on HN, but for people who are new to vim or new to reading HN it bears repeating.
1. Go to your terminal.
2. Type in vimtutor.
3. Spend half an hour.
4. Congratulations! You are now able to survive in vim, while you're by no means a master yet, you're probably around 80 to 90% as productive in vim as with a general text-editor without plugins.
IMO it's 30 minutes well spent.
- deleted 7y ago[deleted]
- Lio 7y agoThat's the simplest and best starting suggestion. I'd follow it with watching some editing videos on http://vimcasts.org/ http://vimcasts.org/ and by reading Practical Vim[1] gives a really good set of editing recipes in "pure" vim without plugins. Finally I'd also suggest the follow up Modern Vim find out about plugins and LSP support.[2] [1] https://pragprog.com/book/dnvim/practical-vim https://pragprog.com/book/dnvim/practical-vim [2] https://pragprog.com/book/modvim/modern-vim https://pragprog.com/book/modvim/modern-vim
- YeGoblynQueenne 7y agoI think the point of the OP was that they don't want to have to memorise a whole bunch of new commands before they can be productive with their new editor. This makes a lot of sense btw. Think of all the commands and shortcuts you need to know to be productive and quick in everyday programming work: OS shortcuts; terminal commands; git commands; IDE shortcuts; and now, a whole bunch of editor shortcuts _and_ commands. And, does vim's interface help you very much with remembering what you should type in to do what? Sometimes, yes (:w(rite); :q(uit);: x(it); :w/q/x/a(ll); etc). Sometimes, not so much, no (hjkl wtf? :y? :o? Is that a smily face?). And how much of that stuff in vimtutor are you going to use in the first week of use? 10%? 20%? 50%? The rest, you'll just forget immediately anyway. So that's half an hour that you probably can't afford and that you definitely don't need. So taking it easy and not trying to learn a whole bunch of stuff you're not sure you need is very good advice.
- melvinroest 7y agoApologies for the long comment, succinct writing is tough. I have a different opinion, but do understand your scepticism. If people would've told me this before "just type in vimtutor and 30 min. and boom you're ready" I'd have laughed at them. As a big proponent of vimtutor, I daresay that vimtutor is taking it easy. It took me 30 minutes during a subway ride and I've tried to learn vim a couple of times, and I think I even read this article among one of those failed tries. Yes, you learn a lot of commands, but the tutorial structures it relatively nicely. Also, they're grouped: hjkl are 4 different commands, but if you know one, you can infer the other three. The same goes for w and q. Yank and what I prefer to call "Open new line" were quite intuitive for me at the get go, but then again I had the habit of creating mnemonics. The first 4 chapters (I think it was the first 4) already give you the super powers to survive. Vim is indeed very unforgiving, which is why people need a tutorial. How much stuff did I use in the first week? Well since I did the tutorial several times, I can tell from memory what I remembered initially: The 5 essential commands: i - Insert ESC - Escape (aka please get me out of insert mode or whatever mode I'm in! :'( ) w - write q - quit q! - I really want to quit, I don't care what you do now! (and then immediately redoing the vim command with sudo vim filename.txt) Some text editing commands (not sorted on if I'm insert or browsing mode): dd - delete and copy (or delete and pop) $ - goes up or down or end of line? (I still forget that) gg - goes up or down or end of line? (I still forget that) G - goes up or down or end of line? (I still forget that) A - append (or small letter a) hjkl - Home row movement, not needing to lift the finger y - yank aka copy (as a non-native English speaker it was fun to learn that "yank" can mean copy) x - cut e - end of word b - beginning of word r - replace (not that I ever use it) From the top of my mind, I learned about 80% of these commands back then. IMO knowing these commands makes you survivable. Later on, I also learned a thing or two with vim visual mode. I kind of forgot that now. I vaguely remember it was something with CTRL + V or Shift + V and that you can select a block and indent it with Shift + I. I remember I went even into the vimrc file, or whatever it was called. But I decided to stick with Sublime Text and simply use this skill when I quickly need a terminal editor (oh, and also to not be annoyed by git). As you can see, in the demonstration of my very humble knowledge, I only vaguely know what the commands do as I don't use vim every day (more like every month to touch a line quickly). But I kind of know what they do and with some quick experimentation I figured it out again. I have the suspicion you already know vim. For other people, my suggestion is: just try vimtutor, you'd probably already have finished chapter 1 and 2 by now if you would have done vimtutor instead of reading my long comment.