

Learn Vimscript the Hard Way - cabacon
http://learnvimscriptthehardway.stevelosh.com/

======
deckiedan
I think my biggest gripe with vim is vimscript... and next is that other
languages are optionally compiled in.

VIM with only lua, or, since regexps are weird in lua, guile, or heck, even a
fast ECMAscript but garrenteed to be the same on all platforms would be
great...

I've pondered the idea of a "VIM redux" project, not being backwards
compatible, but throwing out old cruft, such as vimscript, "embed all the
languages but unequally so you can never tell what plugins a system will
support!", vi-compatible default mode, and put on some different defaults like
syntax highlighting, etc.

I don't think I'll ever like vimscript... so maybe I should buy the book. :-)

~~~
Ziomislaw
yes vimscript is awful, and I wanted to share a way of dealing with it. Evil
is an emacs package that "implements vim on top of emacs". By using that you
basically exchange vimscript for elisp (At least I, just started 'using vim'
and didn't have any problems). I'm not saying it will fit everybody, just that
I didn't actually knew that the possibility existed - so I'm mentioning it.

------
darkchasma
I used his drafts extensively while he was writing it, and had built and epub
from the files for my own use. The day I could throw some money at him, I did.
If you've been using vim, have the modes and chords down, but would like to
eek out some more power and customization, buy this book. It explains
vimscript much better than any other resource I've read to date.

~~~
enry_straker
Part of the problem is vimscript itself. There is not too much external
documentation about it.

btw i disagree with you a bit. The best resource to learn vimscript is the
sources of popular vimscript plugins.

The next best thing is steve's book, which is brilliant.

------
frewsxcv
The title implies there's an easy way

~~~
otikik
My thoughts exactly.

------
kazagistar
Where is the "learn vim the hard way" guide (which this cleary states it is
not)? Doing a bazillion examples with random code manipulations might actually
allow me to get over the learning hump and remember something of vim...

~~~
cabacon
vimtutor is pretty good, actually.

Outside of that, [http://yanpritzker.com/2011/12/16/learn-to-speak-vim-
verbs-n...](http://yanpritzker.com/2011/12/16/learn-to-speak-vim-verbs-nouns-
and-modifiers/) has a nice explanation of the editing worldview, which ties in
with Steve's quote in
[http://learnvimscriptthehardway.stevelosh.com/chapters/16.ht...](http://learnvimscriptthehardway.stevelosh.com/chapters/16.html),
"The idea of operators and movements is one of the most important concepts in
Vim, and it's one of the biggest reasons Vim is so efficient. We're going to
practice defining new motions a bit more, because extending this powerful idea
makes Vim even more powerful."

Check out
[http://www.moolenaar.net/habits.html](http://www.moolenaar.net/habits.html),
[http://stackoverflow.com/questions/1218390/what-is-your-
most...](http://stackoverflow.com/questions/1218390/what-is-your-most-
productive-shortcut-with-vim/1220118#1220118), and maybe
[http://vimcasts.org/episodes/archive](http://vimcasts.org/episodes/archive)?

I've been using it for about a decade, so I think I've lost the beginner's
mind to evaluate whether these are really the right entry points. Lots of
people are passionate about vim, though; some googling should find you the
exercises that will help you the most.

------
cabacon
To seed a comment, here are some VIM links I have enjoyed recently:
[https://github.com/carlhuda/janus](https://github.com/carlhuda/janus) is an
easy way to pick up some nice plugins. I found it overwhelming the first time
I played with it, but I am back around to trying it again and liking it better
this time.

A set of crazy tips that made me learn to love the g commands:
[http://www.rayninfo.co.uk/vimtips.html](http://www.rayninfo.co.uk/vimtips.html)

I believe I went to that from
[http://vim.wikia.com/wiki/Vim_Tips_Wiki](http://vim.wikia.com/wiki/Vim_Tips_Wiki),
which isn't as fun to navigate as I would like it to be.

~~~
Watabou
As tempting it is to not avoid janus, newcomers to vim should just stick with
vanilla vim. If you just decide to install janus, you won't learn anything,
you will have bunch of things installed that you will never use and it just is
the wrong way of learning vim

If you want to actually learn vim, ditch janus and all the plugins when you
start. Start by going to a shell and typing 'vimtutor'. That will get you
started. Then build your own ~/.vimrc by scratch by adding some useful options
such as:

set number

syntax on

filetype plugin indent on

For other options, you can search around the internet, particularily other
people's dotfiles and see what they put in their own vimrc and you can freely
take if you like what you see.

and then you can experiment with plugins. You will gain a much better
understanding of how they work, what they do and you will be proud of yourself
because it's your own personal vimrc and you know every single line that is in
it.

~~~
cabacon
This seems to be the perpetual back-and-forth that shows up; I searched
"site:ycombinator.com janus" before I posted the link, and you'll find this
exact same line in history.

For myself, I knew core-vim pretty well, and was coming back to it after
taking textmate and sublime text for a spin. Janus was a fast way to bolt on
the IDE-alikes I liked from ST2. It was, indeed, too much on a first go, and I
uninstalled it. I am back to it, though, and appreciate that it brought
together the "big guns" like fugitive, nerdtree, syntastic, &c. as well as
things I'm not sure I would have found, like Tim Pope's excellent unimpaired
plugin.

Doing things like vimtutor is great for a newbie, but I don't think I care as
much whether they have Janus installed or not while they do it.

~~~
johncoltrane
Yes, this back-and-forth is perpetual because there's always someone who
advertises Janus and there's always a need for someone else to actually say
that Janus (like SPF13 and friends) is a piece of crap and that new users
should never install it if they are serious about learning Vim.

~~~
cabacon
If you're going to take that point of view, I guess I'd like to hear more
about why you think Janus is a piece of crap. I understand the POV of people
who say that learning fundamentals is the place to start, rather than starting
with the extensions, okay. But for someone who knows the editor but isn't that
plugged in to the vimscript ecosystem, what's wrong with aggregating a number
of useful and interesting plugins? I don't understand the vitriol.

I don't think I would have been as interested in reading this (interesting!)
book if I hadn't seen the power of things like NERDTree and TagBar, and I
wouldn't have seen those if I hadn't poked through Janus.

~~~
johncoltrane
Janus and all the other distributions share the same issues so Janus is only
one of many, and the most famous.

All those distributions started life as personal configurations. I honestly
have no idea what happened that made their authors entertain the idea of
turning them into so-called distributions but personal configs are what they
are. Those configs are someone else's config: whatever is there may or may not
fit your workflow or needs or cognitive capabilities or even physical ones.
The plugins featured in those configs are chosen by complete strangers
according to unknown criterias. The same goes with options and mappings.

When you use Janus, you basically are walking with someone else's shoes.
You'll get used to it after a while but they will never be your shoes.

Do you really need Gundo? Gist? NrrwRgn? Do you really need to interact with
Git from your text editor? Are you sure that SnipMate is the best choice for a
snippet engine? Are you sure that SuperTab is the best choice for completion?
Are you sure that you need NERDTree when you have netrw built-in? Are you
absolutely certain that you need an Ack plugin? What do you think of a
distribution that comes with two plugins with overlapping features and even
provides custom mappings that overlap with both?

Another problem with distributions is that, due to their very nature, they
have a crazy architecture with many .before and .after scripts and weird
directory structures that make the whole thing hard to debug or customize. Not
only you are walking with someone else's shoes but that someone is the only
person able to fix them or tie your laces.

New users should steer away from Janus and friends because:

* those distributions actively hide many default features/options

* they teach you how to use CtrlP and not default commands

* they hook you to plugins

* they hook you to options you don't know shit about

* they force someone's preferences on your

* they actively prevent you from learning Vim

Experienced users should avoid them because:

* well, they already have their own config tailored to their needs so why bother using someone else's?

* they already know how to find plugins (vim.org)

