
Vim 7.4 is released - sramsay
http://www.vim.org/
======
sramsay
:help version7.4 has all the details, but the two most significant ones cited
are "New regexp engine" and "A more pythonic Python interface."

Of the former, the help file says:

What is now called the "old" regexp engine uses a backtracking algorithm. It
tries to match the pattern with the text in one way, and when that fails it
goes back and tries another way. This works fine for simple patterns, but
complex patterns can be very slow on longer text.

The new engine uses a state machine. It tries all possible alternatives at the
current character and stores the possible states of the pattern. This is a bit
slower for simple patterns, but much faster for complex patterns and long
text.

Most notably, syntax highlighting for Javascript and XML files with long lines
is now working fine. Previously Vim could get stuck.

~~~
zeckalpha
It sounds like someone read Russ Cox's work on regexp.

[http://swtch.com/~rsc/regexp/](http://swtch.com/~rsc/regexp/)

To future regexp implementors: Do it this way first!

~~~
danieldk
_It sounds like someone read Russ Cox 's work on regexp._

Russ Cox? You know that regular expressions have existed since Kleene's first
proposals, and everyone with a CS degrees knows that you can compile them to
deterministic finite state automata. Right?

~~~
kenko
And that's why the RE2 implementation has existed equally long!

Oh, wait.

~~~
dlisboa
Cox's work builds on Thompson's work from the 60s. He says so himself.

~~~
mjn
The basic implementation methods are well-known and quasi-standard, but Cox
did make some useful practical additions, in addition to writing up a clear
and accessible exposition.

The classic DFA engines, like in Thompson's version of grep, provide a fairly
minimal regex language (later standardized as POSIX regexes), not much fancier
than the regular-language syntax used in textbooks. Perl-style regular
expressions get such widespread usage even outside of Perl in part because
they have a more full-featured syntax, which provides conveniences people find
useful. Cox implemented a significant subset of this functionality as
syntactic sugar on top of a classic automaton regex engine, so RE2, unlike
POSIX regexes, supports named matches, named character classes like \d (plus
Unicode character classes), non-greedy matches, etc. Basically everything that
can be done without making the language nonregular, so excluding lookahead,
lookbehind, and backreferences.

Since vim regexes (a custom dialect) support some of those supra-POSIX
features, those implementation techniques were likely useful for them to look
at. Indeed they link to Cox's article somewhere or other in the design docs.

Vim does have lookahead/lookbehind syntax, though; I wonder how they supported
that. Fallback to the backtracking engine?

------
AlexanderDhoore
I've been digging deeper and deeper into vimscript and also scripting vim with
python. It's so amazing what you can do with just a few lines of hacky
vimscript!

Today I made it so that every time I open a .markdown file, vim compiles it to
html and opens it in my browser (using 'open' command on OS X). It also
updates it automatically every time I save or leave insert mode.

I've also hacked together a python REPL inside a vim window. (Wasn't very
hard, as vim has python built-in.)

Once you realise that Vim is just an extension of the command line, a new
world opens up. Everything you can do from the command line, you can do from
Vim. Throw in Python and the options are endless... So much POWER!!

BTW: I also discovered vim has MzScheme built-in, so don't go for emacs just
because of lisp... Vim has a nicer lisp! Come to the dark side, we have
cookies! (And lisp.)

~~~
bosie
share the markdown code if you don't mind?

~~~
AlexanderDhoore
This is VERY hacky, but that was kind of the point I was making. Hack together
what you need! Here you go:
[http://pastebin.com/sPmPsCgY](http://pastebin.com/sPmPsCgY)

Edit: Safari reloads the existing tab, so set the default browser to Safari if
you want that.

~~~
bosie
that is quite clever. works here too. any idea how you could convince firefox
to reload the tab rather than creating a new one?

~~~
mharju
You can use AppleScript to accomplish that. See for example
[https://github.com/mharju/vim-
fiddle/blob/master/template/fi...](https://github.com/mharju/vim-
fiddle/blob/master/template/fiddle.vim) for hints on how to do it.

~~~
bosie
thank you. and thanks to alex too ;)

------
rcarmo
I've just updated my unofficial Mac OS X build (featuring alloy's native
sidebar with a file tree):

[https://github.com/rcarmo/macvim/releases/tag/7.4](https://github.com/rcarmo/macvim/releases/tag/7.4)

It's a tad controversial, I know, but I find it vastly more friendly than
NERDTree, and I know quite a few people were looking for alloy's builds a
while back.

EDIT: screenshot, from an older build:

[https://f.cloud.github.com/assets/392683/793013/469e0c62-ebd...](https://f.cloud.github.com/assets/392683/793013/469e0c62-ebd7-11e2-8245-ab6a34c65979.png)

~~~
clumsysmurf
The link above should mention this requires 10.8 and above.

~~~
rcarmo
Yeah, that was only in the README. Fixed.

------
Millennium
Bad form to require someone to install your program just to see your
changelog, though. Please put up a page, or put the latest help docs online
(the current set is still for 7.3) and link to the relevant section, instead
of "see :help version7.4".

~~~
mjhea0
ftp://ftp.vim.org/pub/vim/patches - should be up shortly

you can also get it here -
[https://gist.github.com/mjhea0/6200588](https://gist.github.com/mjhea0/6200588)

------
lcedp
Script to assemble last vim from source under Debian/Ubuntu:
[https://gist.github.com/liverlin/5274228](https://gist.github.com/liverlin/5274228)

~~~
lubomir
It is already in Debian unstable.

~~~
lcedp
Ok then, I'm using Ubuntu atm.

------
StavrosK
Very nice! Does anyone remember that nifty syntax highlighting script from a
while ago that required a recentish version of Vim? I'll install 7.4 and want
to try that out, but I don't remember what it was...

~~~
bpierre
It’s not syntax highlighting, but it needs a recent version of Vim:
[http://valloric.github.io/YouCompleteMe/](http://valloric.github.io/YouCompleteMe/)
?

~~~
madsravn
Is it any good? It looks good, but stuff sometimes disappoint.

~~~
ics
If you like autocompletion then yes, it's very good. At one point I had issues
with startup time that I was pretty sure had been caused by it, but it's
highly likely it had more to do with Clang than YCM (I can't remember the
outcome fully, since I ended up moving to Emacs shortly after).

------
farslan
Complete Changelog ftp://ftp.vim.org/pub/vim/patches/7.3/README (it includes
all changes from 7.3 up to 7.4)

New patches for 7.4 will be in the patches/7.4 folder.

~~~
dezgeg
Wow. Actual .patch files. In 2013.

This is ridiculous.

~~~
mjn
They're managed (or can be) using Bram Moolenaar's own system, Aap:
[http://www.a-a-p.org/](http://www.a-a-p.org/)

------
wubbfindel
Going to wait for the update to come via chocolatey:

[http://chocolatey.org/packages/vim](http://chocolatey.org/packages/vim)

~~~
unknownian
How is Chocolatey? Does it feel Unixy enough for someone moving from Unix to
Windows?

~~~
wubbfindel
I can't say from the perspective of Unix to Windows, I'm the reverse, but I
know that since learning to love apt-get (and similar managers), I'm willing
to accept chocolatey despite it's weaknesses.

Just the other day I was able to update a whole load of software on my laptop
using the 'cup' command - which worked almost perfectly. It broke my
installation of Libre Office - which I then had to install the old fashioned
(for windows) way. But that was still a considerable amount of time saved for
me!

------
dasil003
It doesn't appear as though MacVim for 10.7 and 10.8 is released yet though
the 10.6 is:

[http://code.google.com/p/macvim/downloads/list](http://code.google.com/p/macvim/downloads/list)

~~~
tbrock
I use it every day on 10.8. Use homebrew and have less grey hairs: brew
install macvim

~~~
sigzero
7.4 is still the beta version in homebrew.

~~~
nilsbunger
Looks updated now! (make sure to do "brew update" first to get updated package
list).

~~~
nXqd
thanks for the update :D

------
sigzero
I am glad its Python support is better. I wonder if it would help or hurt if
something like Lua came along with it as its 2nd default scripting engine?
From what I have read Lua is small, fast and relatively easy to learn.

------
lsiebert
So if I previously compiled from source in ubuntu (which I did for
YouCompleteMe) can I just recompile and install?

------
kseistrup
Is there a PPA for Ubuntu users (et al.)?

------
zhufenggood
MacVim dont't have lion or moutain lion style native scrollbar still.

~~~
Yoshino
I turned them off completely. I found that the line numbers and file position
in the status line was more than enough to get my bearings, and it looks nicer
without the scrollbars.

In ~/.gvimrc:

    
    
      " no toolbar
      set go-=T
      " no right scrollbar
      set go-=r
      " no left scollbar
      set go-=L

~~~
sigzero
You can put those on one line...and I do the same. :)

~~~
graywh
Only if the order is the same. E.g.

    
    
      :set go=aAcegimtv
      :set go-=vtmigecAa
      :set go? " guioptions=aAcegimtv

~~~
dlitz
You can do it like this, though:

    
    
      set go-=T go-=r go-=L

------
gosukiwi
I installed vim on Ubuntu using apt-get, any tips on how to upgrade it?

------
alexhancock
Spell checking. Nice!

The undo branching feature seems like it could be useful as well.

~~~
reustle
Doesn't ":set spell" already work?

------
gaving
I love vim, but:-

[http://www.vim.org/](http://www.vim.org/)

[http://www.sublimetext.com/](http://www.sublimetext.com/)

Which one would you want to use?

~~~
dsrguru
Without a question, the one with text objects. Productivity is far greater
with vim. Actually to be fair, Sublime's vim emulation mode implements a few
text objects, but the proprietary source means no adding our own.

~~~
venus
> Productivity is far greater with vim

I don't agree with that at all. Vim is useful, perhaps, for a few text
matching tricks but typing speed is rarely the bottleneck in programming. It's
optimising for the wrong thing.

The only people advocating for vim are those who have already gone through the
pointless pain of 5 years learning to use the thing. It's basically a cult, or
at least a club. And frankly, watching these vim "power users" is usually
quite frustrating - they struggle to do trivial tasks which can be
accomplished in sublime with a simple right mouse click.

It is important to know the basic vim commands for when you are editing text
via ssh but for everyday use sublime text is, IMO, superior in every way.

~~~
dsrguru
It takes several days, not 5 years, to train your muscle memory to the point
where the vim editing model is much faster for raw edits than the default
editor in Sublime [1].

> typing speed is rarely the bottleneck in programming

You're right, especially if you're using a language that doesn't require a lot
of boilerplate. But between the UNIX shell and the normal vim add-ons, even
higher-level editing tasks, i.e. those that aren't strictly about raw editing,
shouldn't give vim users trouble.

As with negatmx, I'm convinced you haven't met people who use vim properly.
Name a task on which you've either seen or you'd imagine a ST user to
outperform a vim "power user". I'll let you know the logical way to do it in
vim.

[1] To obtain solid proficiency with the vim editing model, just work through
the interactive vimtutor, read up on text objects, and spend a couple hours
acclimating yourself to using the following motions and commands in place of
hjkl (sort of but not necessarily in order of usefullness):

/ ? n N f F t T # *

gg G <n>G (e.g. 42G)

H M L

^ 0 $ { } ( ) w W b B e E

C-f C-b C-d C-u

zt zz zb

~~~
venus
> Name a task on which you've either seen or you'd imagine a ST user to
> outperform a vim "power user". I'll let you know the logical way to do it in
> vim.

Selecting code and copy and pasting it into a chat client for discussion.

Grabbing someone else's code from a chat client and editing it, then copy and
pasting it back to show them my interpretation.

Copying an error message and pasting it into a web browser.

Installing or updating any kind of plugin or package.

Doing anything out of the ordinary (vim users will be googling for the arcane
sequence of commands and don't try the "no true scotsman" defence for that -
they all do)

Scrolling smoothly through a large file looking for a certain method you will
know by shape.

Quickly navigating a tree of files at the side of the window.

Changing the font to something post-1980.

Make it look good (this willl take infinite time)

I could go on, and on, and on.

Anyway, I have no doubt that for some tasks it's possible to train yourself to
be very fast in vim, and if you find that measurably speeds up some aspect of
your productivity you care about, then more power to you. However, I haven't
really observed this being the case.

It's sort of like Linux vs MacOSX on the desktop. Linux people can and do
customise their machines to an amazing extent, all sorts of crazy window
managers and weird shell extensions, all promising great improvements in
window management and shell completion, etc. But at the end of the day, I
don't notice linux-using programmers as being any more productive, as a rule,
than mac users, who tend to not fetishize the tool so much and just want to
get on with the job. If anything, it's the opposite. I admit I'm biased
against vim because of how ugly it is, which is sort of why the linux vs mac
analogy works for me. I love linux by the way and use it on the server, and I
also edit on the server with vim : P

Anyway, I'm making much bigger a deal about the matter in this thread than I
actually feel! I just don't think vim is a slam dunk, is all.

~~~
dsrguru
> Selecting code and copy and pasting it into a chat client for discussion.

Note, due to HN's treatment of asterisks as formatting characters, I'm going
to represent a literal asterisk as [asterisk].

In gvim, selecting code to copy into the system clipboard is as easy as
"[asterisk]y plus the motion or text object (e.g. `"[asterisk]y3}' for the
next three paragraphs or `"[asterisk]yat' for the current HTML/XML tag). You
can even configure console vim to copy into the X clipboard:
[http://vim.wikia.com/wiki/Accessing_the_system_clipboard](http://vim.wikia.com/wiki/Accessing_the_system_clipboard)

> Grabbing someone else's code from a chat client and editing it, then copy
> and pasting it back to show them my interpretation.

I run vim and irssi from inside GNU screen, so it's as simple as `C-o [' (my
screen prefix is `C-o') to access the scrollback buffer, spacebar to start
selection, use screen's vim-like selection commands, spacebar again to yank
the selection, switch screens, and then `C-o ]' to paste. The whole process is
instinctive and takes no more than five seconds.

> Copying an error message and pasting it into a web browser.

See the above two answers.

> Installing or updating any kind of plugin or package.

The vundle package manager takes care of that.

> Doing anything out of the ordinary (vim users will be googling for the
> arcane sequence of commands and don't try the "no true scotsman" defence for
> that - they all do)

No, they'd most likely use some combination of the brilliantly orthogonal
editing language that is Vim and the brilliantly orthogonal computing
environment that is UNIX to reach a solution in time that would amaze a
Windows user. In fairness, most Sublime users I know would do the same.

> Scrolling smoothly through a large file looking for a certain method you
> will know by shape.

How would Vim and Sublime differ on this one?

> Quickly navigating a tree of files at the side of the window.

Vim users do the same. It's called the NERD tree plugin. I personally find it
faster to navigate with autojump from the command-line and then open files in
vim from the command-line, but many Vim users like the tree approach.

> Changing the font to something post-1980.

You add a line to your ~/.Xdefaults or ~/.Xresources for console vim or to
~/.gvimrc for gvim. It's no harder than changing fonts in Sublime. I
personally like 14-pt Bitstream Vera Sans Mono. It looks similar to Sublime's
default iirc.

> Make it look good (this willl take infinite time)

I don't know if by "it" you mean the font or the colorscheme, but as with
Sublime, some fonts and colorschemes are really nice and some aren't. It
sounds like your criticism here, as with virtually all of your points, is that
vim's default settings, unlike Sublime's, are not optimized for use as an IDE.
That is correct. However, instead of bashing vim for this use case with
uninformed, antagonistic statements like making it look good will take
infinite time, all you have to do is ask or google how to configure vim for
such a use case. A lot of vim plugin writers are ex-Sublime users, so it
should be pretty easy to make vim simulate the default Sublime feature set, if
you really wanted to. If you're more comfortable with Sublime, it makes total
sense to stick with it. Perhaps Sublime Text's greatest strength is that its
default configuration is excellent for software development. As you pointed
out, typing isn't normally the bulk of development time, so if you're already
happy with an editor, you really don't need to switch to a faster one. Just
don't tell others who do use one that's said to be faster that you, someone
who has only used their editor in a console/ssh capacity (and from the sound
of it, a casual capacity at that), knows their editor's shortcomings for
development better than they do.

> It's sort of like Linux vs MacOSX on the desktop. Linux people can and do
> customise their machines to an amazing extent, all sorts of crazy window
> managers and weird shell extensions, all promising great improvements in
> window management and shell completion, etc. But at the end of the day, I
> don't notice linux-using programmers as being any more productive, as a
> rule, than mac users, who tend to not fetishize the tool so much and just
> want to get on with the job.

I know quite a few Mac OS X users who care very much about their programming
environment/toolset, and I do think they're more productive than those who
don't.

> I admit I'm biased against vim because of how ugly it is

But it's not! If you're running it on ssh and if your console font is ugly,
then yes, it will be ugly. But that's like saying that ST is ugly if you set
it to use whatever ugly font your shell is set to. Vim is configurable, and a
sane vim/gvim set-up looks clean and beautiful. Since you're a Linux server
user, you should know the power of configuration!

------
pearjuice
And still no viable competitor to emacs.

~~~
pekk
We were talking about text editors, not wonky lisp interpreters.

