3 ms·
Apologies 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 befor
by melvinroest 7y ago
Apologies 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.
- neoncontrails 7y agoOne of the nice, well-thought things about $ (end of line) and its inverse, ^ (beginning of line), is they have exactly the same meaning in normal mode as they do in regular expressions (with a small caveat that ^ ignores whitespace, so it's not so much the beginning of the line as it is the beginning of text on that line).
- melvinroest 7y agoI never thought about that. Thanks!
- YeGoblynQueenne 7y agoYes, I already know vim- it's the only text editor I've used for the last eight years or so [1]. OK, I accept that some users will find vimtutor helpful, like you did. On the other hand- I would never have learned to use vim if it meant I had to read 4 chapters before I could "survive" in it. The way I learned vim was ... to not try to learn vim. This is much like the article above describes it. Before vim I was using Notepad++. At some point, I switched to vim and just did all the things I was doing in Notepad++, except I did them using vim. That meant I only had to climb the smoothest learning curve and my productivity never dropped from having to stop and search for advanced stuff. I was a bit annoyed originally by the Mikado of escape slashes in regexes, but I got used to them reasonably quickly. Then at some point, when I needed to do more advanced stuff that I'd never have considered doing with Notepad++ [2] I looked that stuff up and learned how to do it, but only as and when I needed it. In the first year or so I was keeping a notes file with all the weird-syntax commands that I needed with enough frequency that I wanted to keep handy, but I couldn't bother to memorise. I still occasionally consult this file, e.g. when I need to remember the syntax for look-ahead or look-behind regexes. It turns out, you can go a _long_ way without really, really having to do a lookahead. I should say, I also tried a few vim plugins here and there, but mostly they seemed to mess up my install, so I was turned off them for good. Pretty much the only plugin I use nowadays is the excellent highlight script from the vim wiki (https://vim.fandom.com/wiki/Highlight_multiple_words https://vim.fandom.com/wiki/Highlight_multiple_words). It's just perfect for highlighting logs and, er, logs. So while I appreciate that vimtutor can be useful to some users, it is by no means the only, or the simplest, way to get to a point where you're feeling comfortable using vim. ________________ [1] The one exception is the Emacs-based editor in the Swi-Prolog IDE, which has a very good Prolog mode that actually compiles your code so it flags errors and so on. It'd take a while to do this in vim, and there's no real reason to. Although I miss being able to scroll with Ctrl+E/Y. [2] Like using netrw to edit files directy on a remote server over a powershell remote session, which got me some impressed comments by a senior dev in my company, since everyone else just RDP'd to the server.