This article is well written, but it has nothing to do with mastering Vim. It goes no further than running "vimtutor" at the command line. It has all the same tips and shortcuts as any other vanilla Vim tutorial. This is a common problem among Vim articles and tutorials. Authors title them as if it will give you Vim mastery, but instead it only offers the basics.<p>Mastering Vim means going beyond vanilla movements and learning all of Vim's nasty warts to replace good GUI features. It means learning the wonky, dead Vimscript language. It means knowing how to use the arcane arglist. It means knowing how to go into insert-normal mode, and when to use the expression register. It means knowing everything about very magic search, and why default search is poorly designed. These are all randomly chosen examples, because mastering Vim involves mentally juggling a very large playbook of oddball features to complete editing tasks.<p>The main resources to help you master Vim are the book "Practical Vim" by Drew Neil, and if you're ever in the unfortunate position of needing to write or edit a Vim plugin, "Learn Vimscript the Hard Way" is invaluable <a href="http://learnvimscriptthehardway.stevelosh.com/" rel="nofollow">http://learnvimscriptthehardway.stevelosh.com/</a>
My issue with getting better at vim is that I've gotten to the point where I'm comfortable moving around text, copying/pasting, and everything I would normally do with a mouse. I know vim is so much more than that, but it's one of those things where "you don't know what you don't know" and because of that, I don't have the incentive to continue learning. Hopefully this post will inspire me to incrementally advance my vim usage.
I consider myself at least an intermediate user of Vim, and I'm glad that you mentioned the "f" motion (along with its cousins "t" and ";"). I don't think these keys get enough exposure among beginner Vim users (they aren't mentioned in vimtutor), but they allow you to quickly and efficiently move across files and do things like "ct(" (change text up to first left parentheses), which is super useful for changing function names.<p>Shameless plug: I wrote a plugin (<a href="https://github.com/unblevable/quick-scope" rel="nofollow">https://github.com/unblevable/quick-scope</a>) that facilitates the use of "f" and family that even beginners can take advantage of.
The thing that always frustrated me about Vim (and command-line apps in general) is that it punishes you for being a GUI power user. The more mastery you have of conventional GUI keyboard shortcuts to highlight, jump words, copy/paste, etc., the more often you will reflexively hit them and do the wrong thing while trying to use Vim. You have to unlearn a lot of perfectly good skills before you can really master Vim, and that's frustrating.<p>Of course it's not Vim's fault that the standards established by vi were not taken up by the early GUI systems, but I wish there was a better way to deal with this problem than a figurative grizzled old console cowboy going "suck it up, n00b, it builds character." I'm aware that people have made command sets that make Vim and the *nix console in general more GUI-standards-friendly, but these are never presented to actual CLI newbies, so by the time you're aware of them you've done half the work already...
> inoremap jk <ESC><p>Using two keystrokes instead of ESC to leave insert mode is definitely a personal preference and not necessarily more efficient or comfortable.
From the article: "Arguably the most brilliant thing about vim is that as you use it you begin to think in it."<p>Bill Joy, regarding vi: "It's like one of those pinatas--things that have candy inside but has layer after layer of paper mache on top. It doesn't really have a unified concept. I think if I were going to go back--I wouldn't go back, but start over again."<p>Hunter S. Thompson, on an unrelated topic: "That was the fatal flaw [...] the desperate assumption that somebody--or at least some force--is tending the Light at the end of the tunnel."<p>I think vim is a useful tool. It's available on most systems and is powerful. But trying to grok it and appreciate its UI isn't really something I want to do.
While a tweaked configuration can be a great productivity boost, it has a major drawback. My main reason for using vim is its ubiquitousness. Whenever I need to ssh into a box to check something out, I can trust that it's there. However, I cannot trust that its configuration has been tweaked like I expect. Hence, I stay away from getting used to non-standard key mappings.
This is a really good introduction to vim. It is better to think of it as a grammar to manipulate text.<p>A few additional things that have saved me keystrokes...<p>replace mode (<i>R</i>)<p>insert normal mode (<i><c-o></i>)<p>paste from a register in insert mode (<i><c-r>reg</i>)<p>expression register (<i>=</i>)<p>clipboard and active selection registers (<i>+</i>, <i></i>* respectively)<p>command ranges (e.g. <i>10,+5s/foo/bar/g</i>)<p>miscellaneous commands (<i>:global</i>, <i>:argdo</i>, <i>:normal</i>, etc...)
I have my interns setup Vim on their first day, and it's usually their editor of choice by the end of the summer. Apparently it gives them mad credit among their peers at school too.
Great tutorial. About 20 years ago, I was a Level 4 user (by the article's definition), but that knowledge faded with disuse. When I switched back to a Linux/UNIX machine about a decade ago, I started using vim again (well, I started using <i>vi</i> again, but it was vim), and remembered a lot of Level 1 and 2 stuff, and could recall being able to do more, but never had the motivation to crawl through the man page to force myself to recall how I did more.<p>This article is so logically laid out I think anyone could get to at least Level 3 with the article and a few hours diligent practice. Level 4 would then beckon....<p>When I became a serious sed - and then ed - user, I became a much better (faster, more productive) vi/vim user when I didn't need to be in visual mode all the time.
Which plugins do people find valuable? EasyMotion was recently recommended to me:<p><a href="http://code.tutsplus.com/tutorials/vim-essential-plugin-easymotion--net-19223" rel="nofollow">http://code.tutsplus.com/tutorials/vim-essential-plugin-easy...</a>
from config: <i>"I remap it to Ctrl at an operating system level. This way my left pinky can simply slide to the left by one key to execute Ctrl-whatever."</i><p>Been a while since I used emacs, ctrl-<i>everything</i> is an emacs idiom [0] and a pinky killer. I guess the best bit is it's configurable. Really like this tute Daniel, found a nice add for my .vimrc already.<p>[0] <a href="http://mally.stanford.edu/~sr/computing/emacs.html" rel="nofollow">http://mally.stanford.edu/~sr/computing/emacs.html</a>
I agree that knowing basics of Vim is of great help and adds value to a programmer's skill set.<p>I don't agree that it should be the only thing one uses for all development/writing tasks.<p>Yes, vim is ubiquitous. However, no one uses vim without high levels of customization. So i think there is a bigger dependency issue here.<p>Also, I've seen millennials struggling to cope with vim - it's like handing a cassette to a person who's grown up with an iPod.<p>As long as the work gets done, an editor does not matter.
Learning vim is easy, I've done it a thousand times! (As Mark Twain might say)<p>This time around I've been keeping a list of the stuff I miss from my usual workflow. Here's two of the most maddening:<p>1. Searching for literal text. Is there a way to avoid having to manually escape special characters?<p>2. Maintaining cursor position when scrolling. Maybe I want to go look at another part of the file and come back. How can I scroll without it moving my cursor?<p>As far as I can tell, I'm SOL on both counts.
Thanks for this tutorial. I'm at Level 1 having switched from an IDE (PyCharm) and I find this helpful. Any reason why you use Pathogen vs Vundle for managing plugins? Does it even matter?
Is there a way to navigate words taking camel case into consideration? helloWorld should be treated as two words when I want to delete or move, at least sometimes when I want to edit.
This has been one of my favourite articles on Vim for beginners. I'd recommend this to any beginner or a user of any other text editor.<p>Great post.
Vim is a regular expression system hooked to a 1970s user interface. If you need to apply regular expressions to text files, vim is useful. I used vi to write code for years, but that was decades ago. There's been some progress since the 1970s.