
The language of Vim - sanathkumar
http://stackoverflow.com/a/1220118
======
dustinupdyke
It's odd how often a SO link comes up here where the question is locked for
being off-topic, not constructive, etc.

I still think to some degree SE shoots themselves in the foot with the strict
enforcement of their rules every time this occurs.

~~~
Mahn
> I still think to some degree SE shoots themselves in the foot

Do they? The reality is that SO and SE sites are optimized as a _business_ ,
not so much as a _community_ : short, common and quickly answerable questions
generate much bigger traffic from search engines, and hence more ad revenue. I
can imagine Joel and Jeff realized this very early on, and thus set themselves
in a mission to encourage the questions that generated the most traffic and
punish the ones that fall in the opposite end of the spectrum. It's really a
pity, but SE is not a non-profit organization.

I'm still hoping someday someone will come up with an alternative that gathers
the people and the quality of SO where lengthy and thoughtful discussions are
welcome. Some argue that's Reddit, but I'm not entirely convinced.

~~~
icebraining
I think the common view of looking at great answers like this and thinking,
"wouldn't SO be great if discussion was allowed" is similar to looking at a
great work of graffiti art and thinking, "wouldn't be great if every kid with
a spray can could paint all over the city".

These answers are outliers, special snowflakes among a sea of crud that fills
the programming PHPBB boards out there. Joel and Jeff were trying to solve the
bigger problem - having a decent Q&A system -, and that can only be done by
looking at the average case and not the exceptions.

~~~
Mahn
> "wouldn't be great if every kid with a spray can could paint all over the
> city".

The thing is that, unlike in other places, people can upvote/downvote stuff on
SO/SE sites, and just like crappy questions and answers are quickly buried by
the community the same could happen to subpar discussions, so I don't really
think that's a valid excuse.

------
pmelendez
Well, Vim is 21 years old already and it still has a strong base of fan users.
Good example on how good software live long

~~~
dmix
+Well maintained and supported, good software.

------
curiousdannii
I've never understood the appeal of vi(m). Programming is a thoughtful,
creative, deliberate process. I'm never in a situation where I've got so much
to type that my productivity would drop if my fingers stopped touching the
keys. Rather the opposite in fact.

~~~
bollockitis
I think people overestimate how much time they spend doing repetitive tasks
like copying and pasting with definable patterns. I'm a Java programmer, and I
certainly do this, but I can almost always use a simple search and replace to
make it work in IntelliJ. But, for the sake of argument, let's say that if I
were to do this once a week, maybe for five minutes, copying and pasting
manually with a mouse, that five minutes might feel like an eternity. Vim
would do this quickly, but it would also slow me down when I do project-level
refactoring, like renaming a method, which IntelliJ does globally in a matter
of seconds. Sure, you can configure Vim to do this kind of stuff, and you can
combine it with other tools... but at what point are you getting diminishing
returns?

On top of it, as a web developer, I already need to know so much, from front
end with HTML, CSS, JavaScript, jQuery, to Servlets and Spring MVC, to SQL and
all of the glue that binds all of this mess together like XML and supporting
tools like SCMs. My head is absolutely full of information. In this
environment, I am convinced that Vim is a complete waste of my time. A good
IDE is ten times better at handling the vast majority of tasks I encounter
day-to-day.

If anything, I think Vim is like truck nutz for programmers. It's all about
projecting an image of competence and bravado.

~~~
weaksauce
A few examples of why vim has some non-obvious power:

* html you can change inside of a text object. If you are say anywhere inside of a link <a href="som|e link"> you can ci< and you have deleted the whole thing and are left with <|> (where the cursor is denoted by |) If instead you typed ci" you would be left with <a href="|"> this is a very powerful pattern * you can script little macros that do text editing on a macro scale very efficiently. This is more useful than a simple find and replace. you want to make a list that starts with a number, has that number in it and is incremented by one(or two or...) every time. Type the first sentence 1, xv001, "", more stuff. exit out of insert mode. jj or esc start recording the macro into register r: qr yank the line and paste it yyp go to the beginning of the line 0 or ^ increment by one and move one word right and increment the next number: ctrl-a w ctrl-a move down one line, j exit recording q run macro r 100 times 100@r

The nice thing is that if you mess something up you can paste whatever is in
register r, edit it, yank it back into register r and run it. It sounds like
it's slow but it's all real time editing and you are doing it interactive so
you don't have to do it blind.

There are many more things that make vim style interactions a boon to your
productivity but I don't have a lot of time to comment on it. hopefully I
touched on enough that it piques your interest to at least give it a shot.

Vim is so popular that you can get pretty good emulation in a lot of IDEs so
you can have the best of both worlds. vimemu for Visual studio is supposed to
be very good. eclipse has eclim, hell even emacs has evil mode.

~~~
weaksauce
Well the formatting got messed up and it's too late to edit it:

* html you can change inside of a text object. If you are say anywhere inside of a link <a href="som|e link"> you can ci< and you have deleted the whole thing and are left with <|> (where the cursor is denoted by |) If instead you typed ci" you would be left with <a href="|"> this is a very powerful pattern

* you can script little macros that do text editing on a macro scale very efficiently. This is more useful than a simple find and replace. you want to make a list that starts with a number, has that number in it and is incremented by one(or two or...) every time.

Type the first sentence 1, xv001, "", more stuff.

exit out of insert mode: jj or esc

start recording the macro into register r: qr

yank the line and paste it: yyp

go to the beginning of the line: 0 or ^

increment by one and move one word right and increment the next number: ctrl-a
w ctrl-a

move down one line: j

exit recording: q

run macro r 100 times: 100@r

------
lunchladydoris
Who needs bookmarks when the worthwhile posts keep turning up again and again!

I'm not complaining though. Learning Vim beyond the surface level is fun and
the more you know the more fun working with Vim becomes.

------
larrybolt
I always kept switching from Vim to Sublime text until I found this:

<http://vim.spf13.com/> The Ultimate Vim Distribution It's a collection of
plugins and common shortcuts such as :W becomes :w, :w!! for saving as root,
etc...

In the beginning it was mostly the file-drawler that make me want to leave Vim
but that was easy solved by using this version:
<https://github.com/alloy/macvim>

In combination with iTerm on mac it's my preferred way to develop, the only
thing I miss is an easy way to reload, visit pages etc in the chrome-window on
my second screen without having to lift my hands from my keyboard, but cmd+tab
and Vimium help me with that.

------
darkchasma
Learning to code with vim is much easier than learning to code without vim
once you've learned vim.

------
johnchristopher
I wish vim was a little bit more "international" because some commands that
involves {,^,[ combined with ctrl are tricky to trigger on non-us keymaps and
don't feel as natural as `yy`. Some obvious keys that only need 1 keystroke
for an US user requires a combination of alt-gr or something for french users.
Soon I'll be remapping my keyboard for coding but I also need those é,à,ç,è :)

~~~
antris
You can always switch to a US keyboard layout when coding, that's what I do
and it makes me faster.

~~~
h2s
For a time, I was working on gathering some good data on keyboard layouts. I
wanted to work out which keys were commonly available, which weren't, and so
on. I wanted to work out which characters were the most "i18n-friendly" for
developers worldwide.

One day, I happened to take a programming class in Brazil. I noticed that a
lot of students were simply switching their keyboard layout to US English in
order to write code. I ditched that project.

~~~
McP
That's a shame. I think your project still has a lot of value, even if the
results are used more for software that's end-user focussed.

------
dbbolton
It seems as though the asker doesn't know about mapping, which wasn't really
addressed and would answer the implied "I don't like how this feature works
and it's slowing me down" question. It only takes a few lines to work around
vim's "horrible" copying and pasting:

    
    
        let mapleader = ","
        let g:mapleader = ","
        noremap <leader>a ggVG
        noremap <leader>c "+y
        noremap <leader>v "+gP
        noremap <leader>x "+x

------
andyl
I love Vim. I understand the 'Vim is a language' concept, and use it every
day.

But I have to wonder: is this the best that Vim can do? Vim as a language is a
great concept. But IMHO, the execution sort of sucks. Twenty years have gone
by, and 'Vim as a language' is still a big mystery that takes a long long time
to understand...

Someone should take that concept and run with it. Surely 'editor as a
language' can be done better.

~~~
swift
The idea that really excites me is 'STRUCTURE editor as a language' - that is,
the same sort of grammar as Vim, but manipulating semantically meaningful
structures like expressions or functions instead of text. I'd love to see an
editor reenvisioned completely around that concept, with "normal" text editing
only as a fallback.

(Of course, Vim does have text objects, which are fantastic - one of the chief
reasons I use Vim. But they have limitations; I think you can go a lot
further.)

~~~
michaell2
so have I got a deal for you :) Anyway, my recently published "nestgrid"
framework is precisely that (among other possible uses). A mix of xml editor,
spreadsheet, direct manipulation of objects ui, and all around cool thing;
flash demo included. See <http://nestgrid.wordpress.com/nestgrid-paper/>

EDIT: fixed url as per @nocman's advice.

~~~
nocman
You muffed the URL -- here's the one that works

<http://nestgrid.wordpress.com/nestgrid-paper/>

:-D

