Thanks, downloaded and read through it and I picked up a couple new tricks, even as a pretty experienced Vim user.
Some comments:
1) The order feels a little artificial. I like that inserting text isn't mentioned until a couple chapters in, but I think that the focus on saving/writing files at the start is misplaced. If I'm a newbie and I don't know how to change or insert text, I don't have the ability to meaningfully practice saving as I read.
2) There are some weird inconsistencies, like teaching :next (:n) for next file, but Ctrl+^ for previous file. :Next (:N) is easier to remember, works in vi and is shorter to type than the less-compatible :prev that I would otherwise suggest. :! is mentioned several times in different contexts, without a hint that it's the same command in each but with a different prefix or argument.
3) There's a focus on memorization of compound commands rather than understanding how motions and operators work. If you know how the cursor works and that "y" means "yank from cursor", you don't have to remember that "yl" means "yank a single character" because you can compose it from "yank from cursor" and "one character to the right". This composition of movement and operators is one of vi's greatest strengths, and I think that exposing new vi users to it as early as practically possible is a great way to get them to appreciate what they're learning.
All in all, it's a worthy read for someone who doesn't know any vi and needs a quick lesson in the basics, somewhat like the foreign language learning products that focus on teaching you enough conversational vocabulary for a vacation or business trip. If you want to immigrate to vi-land permanently, I'd suggest supplementing this with something like Drew Neil's "Practical Vim"[1] to learn the "bigger picture" stuff as well.
Pretty nice review and I agree with most of your comments.
I agree that it seems strange to teach Ctrl+^ for previous file. (Not symmetrical, and doesn't really mean previous anyway.) However, particularly for the purpose of teaching newbies, I think :Next would be even more confusing... and I could be wrong about this, but I think the number of people who need to care about learning vi (as opposed to vim) is really small, if it even extends beyond communities of people who think that things created 20 years ago are newfangled.
I agree about the vi vs. vim part, I just suggested :N since the book itself was (as far as I could tell) strictly staying vi-compatible. :Next going backwards compared to :next is a little confusing at first, but it actually fits the same pattern as some other commands that go in two directions (f and F, t and T, gg and G), if you think about the two commands as just :n and :N. Naturally, as you observed, it's probably better to use :prev if you're in a modern vi clone or vim.
If you switch to vim as the baseline, there's a bunch of other easier ways to do things too, like using :sav (:saveas) instead of :w <filename> followed by :e <filename>.
I've been using Vim for almost 2 years, now, and I'm very happy with it. Somehow, I'd like to try vi but I have no idea of where I could find the source.
Awesome. Thanks for sharing. I've been using vim for 6 months, but I still feel like a n00b. Looking forward to checking this out.
I started my vim experience using Janus
But I didn't understand how anything worked or why any of the plugins were there.
That led me to starting from scratch (I forked my cofounder's dotfiles) and now I feel like I know my vim config waaaay better. If you've been using janus, I'd highly recommend giving the ground up strategy a shot.
I wound up doing the same thing (not with Janus, but with a massive forked .vimrc).
One day I was SSH'd into a remote server and vim'd a directory by accident and I discovered Netrw. It wasn't the same as NERDTree, but it was good enough for me to get rid of that plugin. Eventually I just learned to enjoy the defaults with minor tweaks. Today my vimrc[1] is < 200 lines, mostly comments and navigation shortcuts.
Nice, I have a bit more (eg Pyflakes highlighting, Pysmell completion) but I share the same trend: barebone vim (no gui, no mouse, no pathogen infection).
I was looking for the rightbelow this, found it in your vimrc. Found it weird you don't have wildmenu...
I used NERDTree for a long time until I saw a simple tutorial to netrw - now I love netrw and don't want to ever go back to NERDTree. It's simple and to the point and just works really well for me.
Hm.. maybe I need to take another look at netrw. Last time I played with it, the big thing that led me to prefer NERDTree was the difficulty in opening a file you navigated to in the pane to the right. It kept replacing the netrw pane.
I haven't made the jump from arrows to hjkl. My cofounder's keyboard is arrowless, but my HHKB lite still has the arrows. Maybe in another 5 years I'll make the switch.
The hardware mod that made the most difference for me, typing-wise, was rearranging the tops of the keys. I'm not sure this is doable on modern laptop keyboards, but on desktop keyboards it's trivial, and I never realized just how much I looked at the keyboard until it would hurt, and the habit died quickly.
In addition, to deal with the issue that programs others than vi may require the use of arrow keys, I use Autohotkey on Windows to map Caps Lock + hjkl to the arrow keys! Thus, both in vi and outside(, in Word, say), I just use Caps Lock + hjkl to navigate. Thus, I never have to move my hand away from the "home" position to use the arrow keys.
I did that and it is actually incredibly easy to get used to (within a couple of hours). The bigger thing you have to get used to -- and which I suspect most will struggle with -- is not moving around when in insert mode.
hjkl may have started because the Joy was working on an ADM3A that had no home row, but the elegant and efficient consequence is that your hands fingers do not move from typing position.
you just have to map your tab key to escape to get the original layout back[1].
Not using the arrow keys was a no-brainer back in the day of slow dial-up connections. Sending ^[OA over the wire instead of just h was a really big deal and when your connection dropped a byte you ended up with garbage in your files if you used the arrow keys. Having that sort of pain associated with their use has stuck with me ever since.
Yeah, I let hjkl discipline slide for a long time, too; it's damn hard to interrupt a reflexive reach for the easier to align cluster whose labels actually correspond to what you want to do. Here's the part that finally pushed me over: arrow keys can supplement/mirror/tweak anything you find overly awkward, slow, or hard to remember in the "native" form. And you can remap them straight (no prefixes/modifiers) or build something arbitrarily deep and be certain you won't interfere with any other bindings.
See? the arrow key scan become four more user keys, and they have easy to remember direction/orientation if you need it. Having trouble navigating, swapping, and resizing, your layout (and accidentally hosing text with ^w in the wrong mode? I did, but 20 minutes after seeing someone else use a similar setup, I was using my own variant more comfortably than any console window management bindings I'd ever tried before.
tl;dr; Remap the arrow keys from movement to anything you struggle with normally, and be amazed how you survived before your four newest "user" keys were liberated!
(Also, if anyone wants me to, I'd be happy to post my re-binding config lines as a template/sample.)
Does this really make that much difference? I kind of view the hjkl vs arrow keys like I view the standard debate about motion commands vs. the mouse.
Lots of people say they are faster using motion commands, and I know I use search motions 85% of the time. But if I want to go somewhere that's visible on the screen, the mouse is almost always quicker. And I've used vi and derivatives for 20+ years now (although obviously they initially didn't have mouse support :-)).
Similar for hjkl, especially if you use single cell motion mixed with whole page motion (Fn-arrow on a macbook), I just don't see hjkl + ^D^U being quicker. It seems more like something that might be useful every once in a while, but not terribly useful 100% or even 50% of the time.
EDIT: And the book says this:
"type the number of characters or lines you want the cursor to move, followed by h, j, k, or l. This technique cannot be used with the arrow keys: left, right, up, and down."
For me the mouse is never quicker. I think that over time your brain kind of memorizes the number of lines (rows) and characters (columns) available in your screen and it certainly gets to a point where you don't really think about the science behind motions and you end up just using motions defined through past experiences. I amaze myself (and my coworkers) when I apply a seemingly random number to a motion and I end up exactly where I wanted to be. Last time a coworker asked me if I'm a math freak and I did the calculations in my head when doing a complex motion in a second, and even though I answer that I am (jokingly), I know that it's actually just a combination of muscle memory and past memories.
In any case, even though I don't agree with the school that says that to learn vi/vim you should forgo arrow keys and non vim (cmd + s to save, command + left arrow to go the left of the line, etc) key combinations, I think that a major point of inflection while learning the editor is choosing a trick/combination/command that you want to learn because it will increase your productivity and keep forcing it, even if it means not using the arrow keys or other combinations you're not used to, until it becomes second nature. And then do the next one and so on.
For me it's not about wall clock quicker, but perceived quicker. I use a couple of different keyboards throughout the day, and they all have the arrows in slightly different places (more variation than letter keys...) which makes it similar to the mouse...
Namely, the amount of concentration required to hit an arrow or get the mouse to do what I want feels slower because I have to pause my thoughts, rather than just queue up a nerve message to my fingers to "then go over there and...". Stopping the train of thought to manipulate the mouse - which requires a lot more visual feedback and focus than just knowing that the cursor will get there - makes me overall slower because I'm context switching.
It makes some difference. It is worth doing for some comfort and speed. But it isn't true that you can't get by without it. It's just much clumsier than it needs to be.
I'm late responding but I've been trying the arrow keys more because of your comment and many others who use them. In the older *nix and depending on the shell, it seemed they didn't always work. On Ubuntu though, they work great! I might switch to using them, thanks for the tip.
One quick way to change your behaviour is by remapping the arrow keys to a NOOP. Took be about two days of solid coding afterwords to completely change my habits and have been reaping the awards ever since!
I didn't use Janus, but I copied a really good, commented .vimrc from another Python and Ruby programmer. That was a mistake, but I didn't realise it at first because I thought "this does a lot of neat things that I need" but I had no idea what was really going on or how it was different from the default. So I did the same thing you did. Deleted it and started with blank dotfiles and no plugins.
I figured out that when you're in the learning stage with vim, you should always be editing your dotfiles because that's a big part of progressing up the learning curve.
I'm in the opposite boat: i stuck with Janus and actually dug in the source and played with it to understand exactly what was there. Janus is incredibly awesome and easy to extend, I'd highly recommend you gave it another chance and really read the docs and try to understand why it is what it is.
Must have plugins are also https://github.com/tpope/vim-surround and https://github.com/tpope/vim-repeat
Every once in awhile the state of DRM really hammers itself home, to me.
Case in point, when someone is literally giving a potentially interesting book away and I can't be arsed to take it because getting it onto my reader of choice is just too much hassle.
If you download it to any of the desktop apps, I think you should be able to convert it without a serial number; I've done it several times before and I don't have a Kindle. Here[1] are some Calibre plugins that automate it fairly easily. You could also use the Cloud Reader if you don't want to go through the hassle.
My issue (well, one of my issues) is that I'm on a rather pristine new work computer, and while I do use Calibre at home, I don't want to put it on this machine. Additionally, I don't want do deal with the hassle of creating a Kindle account and installing an application that I would literally use once.
In comparison, if it was a DRM-less epub, or even a PDF, it would be the work of maybe 30 seconds to SCP it to my iPad, open it in iFile, and load it into iBook. No extra applications, no obscure steps to remove the DRM.
The note about the Calibre plugins is appreciated, though, and I'll be sure to keep it in mind if this comes up again. It was more a point about the fact that I've don't recall having an experience with DRM so blatantly removing value from a product that it was the difference between consuming it and walking away.
That's fair; I also find trying to get books off of the Amazon store irritating. I personally have a nook, but I'll buy eBooks from any store. Regardless, I have to either go through the Kindle desktop app or (ugh) Adobe Digital Editions before I can get it into Calibre, and it's always more of a hassle than it should be.
+1 for cloud reader for programming books. It's open in one window, code in another, terminal in another. Drawbacks, however, include (1) is you can't copy-and-paste from the book; and (2) links don't work [which makes drawback (1) very annoying].
That's right. I only use Calibre for converting. I use the Python scripts from here [1] to remove DRM. The newer versions have GUIs; they should be friendly enough for most readers here.
If you'd like to make sure you know all your vi basics, I recommend my presentation "Vi Basics" at http://www.verticalsysadmin.com/vi/class/ -- it is based on Bill Joy's original paper introducting vi and covers the basics of vi according to its author and in the same order that the author covered them.
the link will, but often you'll have a "not available" message (commenting just because I tried yesterday to get an ukulele tuner which is available in .com but not in .it)
'available'. It is listed, but they do not sell it to everybody: "Due to copyright restrictions, the Kindle title you're trying to purchase is not available in your country: Netherlands"
(amazon.nl links through to amazon.co.uk)
Amazon.de also does not sell it to everybody: "Aufgrund urheberrechtlicher Bestimmungen ist der Kindle-Titel, den Sie kaufen möchten, in Ihrem Land nicht verfügbar: Niederlande"
Once every six months something inspires me to put a book on the Kindle that I received as a Christmas present two years ago. Then the frustrations begin. In this case, after finding the table of contents I try to use the up-down-joystick-button to navigate the TOC. It's just painfully slow and it's displaying definitions for every word I happen to be on (it starts off showing me the definition for "Table" in Table of Contents). The lag between pressing the button and the cursor actually moving is too frustrating for me to even use the damn device.
Perhaps the "two years old" is my problem and I just need a newer device but, boy, I just can't get myself to use this thing with any consistency.
I read almost twice as many books since I got my kindle for Christmas last year. I even prefer reading on the kindle to reading on a pc/tablet or a traditional book.
That said, for reference books, it's worse than the alternatives. I almost exclusively use it for reading books back-to-back (i.e. relying very little on the arrow keys)
I've found that a 10" tablet (a Touchpad in my case, though I imagine the experience with an iPad is equivalent) it pretty tough to beat for reference material. Doesn't have the navigation issues that the eink readers do, but it also allows me to make searchable annotations and highlights as I read.
You could try the kindle app for your computer/phone/tablet. I like reading books on my iPhone on my daily commute and it's quite nice (except for some technical books where the source code formatting is obviously quite bad with the small screen).
I have the current Kindle with joystick-button and although moving the cursor about isn't exactly smooth it moves quickly. The definition thing can be annoying.
Between the Kindle cloud reader, the mobile apps, and the desktop apps, the glass is free. I'm not saying I like DRM - I don't, I find it a huge pain in the ass, and I took care of it as soon as I downloaded the book - but you're misrepresenting the situation for the benefit of your argument.
Vim is one of those tools that I shied away from because of the steep learning curve. A co-worker convinced me to give it a try, and now I use Vim everyday. I'm constantly discovering useful commands and tricks. Looking forward to learning more from this free book - thanks Amazon.
On a related note, is there an easy way to find other free or dirt-cheap (US $0.99) E-books on Amazon?
The Amazon site likes to group things into "As low as <price>" sections, which means there's a least one item at that price, with most things costing more.
One way is to go to the kindle store, choose the kind of book you want (Amazon calls it a "Department") and sort by price. For instance, here are programming books:
Not to look a gift horse in the mouth but my TL;DR assessment of the first few pages makes me think this book is pretty poorly edited. None the less I'm looking forward to reading it and honing my vim skillset.
I understand you shouldn't judge a book by it's cover - but a Vim book that has Visual Basic on the cover (legacy VB6 no less) seems like a big, big warning sign.
Just a quick update for you guys. The second updated edition is already available so please follow the Amazon procedures outlined in the email they'll send you to get it. If you missed the second edition free promo, you can get the third edition at http://TheVimBook.com Thanks!
Download is easy enough, just click the transfer via usb option, and it'll download a .azw file. You can't read it without stripping out the DRM first, but that's not very hard either.
I just bought it using the button "Buy it with 1-Click" and I found it a bit scary. I mean, no confirmation and all. It's like just click and, BOOM, a confirmation email saying that you've already bought it. It's quite jarring as compared to buying stuff from other websites.
Oh, thank god for that. Generally I've lived without an Amazon account because they don't work outside the US. But this one, combined with the post that helped generate fake US addresses pushed me to do it.
Actually, now I'm pretty sure why Amazon would be upset when someone else copies their one-click patent. And the sneaky thing is, when you create a new account it's on by default!
Guys, thanks for all your comments. This book has been in print since 2008 and I have never received so many useful feedback. I have already prepared an update for it, but it's currently being blocked by Amazon. I hope to solve that problem this week.
I once tried (and succeeded!) at purchasing the Dragon Book for Kindle, but had to change to a US address. I bought the book, bu then Amazon wanted me to verify I had moved to the U.S.
I never bought another book from Amazon ever again.
Why? It's not Amazon's fault, but rather the decision of the publisher... And I guess it's your loss anyway. I had the same problem (I have to use amazon.de), but hey, better that than nothing!
Actually, if you sign up for a U.S. account with a plausible address, then there is really nothing that would stop you from buying an ebook from the U.S.
They wonder why folks pirate. I paid for that book, I would feel well within my rights to find a copy of the book in PDF format (non-DRM encoded) and use that instead. I haven't done that - but there you have it. I paid for a book, I didn't get a refund of about $100 and I can no longer read the book. They stole from me.
The Kindle app on my phone has increased the amount I read so much. I find all these random times throughout the day where I can read another chapter in whatever book I'm reading.
Waiting for a meeting to start or standing in line? I'll read the next dozen pages in my Clojure book or the latest fiction novel I'm working on.
When I first started reading on my phone I thought the bright display and small screen would bother me. It hasn't. I've read huge novels on my phone flipping small page after small page. If anything, I feel like I read faster.
Some comments:
1) The order feels a little artificial. I like that inserting text isn't mentioned until a couple chapters in, but I think that the focus on saving/writing files at the start is misplaced. If I'm a newbie and I don't know how to change or insert text, I don't have the ability to meaningfully practice saving as I read.
2) There are some weird inconsistencies, like teaching :next (:n) for next file, but Ctrl+^ for previous file. :Next (:N) is easier to remember, works in vi and is shorter to type than the less-compatible :prev that I would otherwise suggest. :! is mentioned several times in different contexts, without a hint that it's the same command in each but with a different prefix or argument.
3) There's a focus on memorization of compound commands rather than understanding how motions and operators work. If you know how the cursor works and that "y" means "yank from cursor", you don't have to remember that "yl" means "yank a single character" because you can compose it from "yank from cursor" and "one character to the right". This composition of movement and operators is one of vi's greatest strengths, and I think that exposing new vi users to it as early as practically possible is a great way to get them to appreciate what they're learning.
All in all, it's a worthy read for someone who doesn't know any vi and needs a quick lesson in the basics, somewhat like the foreign language learning products that focus on teaching you enough conversational vocabulary for a vacation or business trip. If you want to immigrate to vi-land permanently, I'd suggest supplementing this with something like Drew Neil's "Practical Vim"[1] to learn the "bigger picture" stuff as well.
[1]: http://pragprog.com/book/dnvim/practical-vim