Vim and Vi Tips: Essential Vim and Vi Editor Skills, free on Amazon today only
amazon.com
amazon.com
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.
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.
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 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.
" Disable arrow keys
noremap <Up> <nop>
noremap <Down> <nop>
noremap <Left> <nop>
noremap <Right> <nop>
It'll be super annoying for the first day or two, vexing for the rest of the week, then you'll just forget it's even there.Staying on the home-row vs having to move your hand over and back constantly affects your speed and accuracy in a big way.
Here's an easy way to switch: never, ever use the arrow keys to move the cursor again. Done!
you just have to map your tab key to escape to get the original layout back[1].
Really, more things just need vi-like interfaces :(
that was the first link on a ddg search. there were other articles. https://duckduckgo.com/?q=zsh+vi+mode+prompt
- XCode
- Chrome
- Filthy XCode
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."
Which is not correct.
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.
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.
inoremap <Left> <NOP>
inoremap <Right> <NOP>
inoremap <Up> <NOP>
inoremap <Down> <NOP>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.)
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.
See :help netrw_browse_split for other options.
PI was looking for the rightbelow this, found it in your vimrc. Found it weird you don't have wildmenu...
I love reading other people's vimrc as I usually always find something new that I'm willing to try out. Mine is here in case someone wants to take a look: https://github.com/PatrickLerner/dotfiles/blob/master/vimrc
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.
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.
[1] http://apprenticealf.wordpress.com/2010/02/11/hello-world/
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.
More irony is ironic: there's no Kindle reader for Linux, which is one of the platforms on which vi/vim are most likely to be found.
Thanks for nothing, Amazon.
Unofficially, it's easy to use Calibre to convert them to epub. (DRM add a few minutes of extra work.)
[1]: http://apprenticealf.wordpress.com/2010/02/11/hello-world/
It sucks, but it'll do in a pinch.
(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"
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 find the reading experience is quite smooth. Navigation and the UI is a bit slow, but that is a secondary feature to me.
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)
Kindle is great for cover-to-cover reading, but for reference I will always prefer dead-tree (but will settle for searchable pdfs)
Unlike Stallman, though, I cannot resist the temptation of free beer.
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.
http://www.amazon.com/s/ref=sr_st?bbn=726697011&qid=1345...
It's not perfect but you can find good deals this way.
This title is not available for customers from your location in: Asia & Pacific
What will it cost when it's released later?
∃x{ x | x ∈ Nerdtalk ∧ (x ∈ India ⊂ Asia ∧ Pacific) }
You can get a refund within 7 days though if you do click by accident.
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!
I never bought another book from Amazon ever again.
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.
Vi reminds me of the crazy-old wordstar days.
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.
<wish I was in the US>