Contact

Ryan Cox

Popular Posts

java.util.uuid FAQ
XPath Engine Comparison
Author Tips

 RSS Feed

Jun
13th
Tue
permalink

Vim7 Feature Roundup

I noticed Emacs 22 getting some press lately. So figured it was time to spread a little vim7 love .

Here is a grab bag of features I noticed.

Omni Complete


Completion now comes to vim. <ctl-x><ctl-o> and vim does it’s best to complete the symbol. It’s not perfect. The implementations look like they are mostly regexp’ing around. No knowledge type systems. Based on the contents of $VIM/autoload it looks like there’s out of the box support for: XML, HTML, CSS, C, JavaScript, PHP, Python, Ruby, and SQL. Sorry Java!

Quoted Text Select


New quoted text selection shortcuts while in select mode. With cursor in a string <ctl-q>i” will select all the text within double quotes. If you want the quotes <ctl-q>a” will do the trick.

:vimgrep


Vim now comes out of the box with a grep implementation that works well with existing errorlist functionality.Recursively look for all the FIXME tags in the ruby source tree.:vimgrep /FIXME/j C:/ruby/src/**.rb

View the hits and step through them

:cope

Tabs


Enable this feature and you’ll feel like you walked into a room with 3 switches that control the same light. It looks nice, but when cycling through buffers with :bnext and you can see any buffer in any tab. It’s there if you want it, but I suspect this will largely go unused by most gvim people.To open a new tab:

:tabnew

Spell Check


It’s 2006! I want a jetpack not spell checker!

Nothing too surprising here. Ships with English support. You can grab OpenOffice dictionaries and use the :mkspell to convert it into something vim can cope with. Notice red squiggles under the spelling errors and blue under the punctuation errors.

:setlocal spell spelllang=Fr_fr

Undo Branches


This is an excellent feature with a confusing name. Think of it as restore to any point in time during an edit session. It will save your bacon when you make some edits, undo a few levels, make some more edits and realize you wanted something back from before the undo. New commands support restoring to a text state based on time:

  • g+ / g- This is like u / CTRL-R except it will walk across all changes over time. Good candidates for mapping.
  • :earlier 5m Restore to state 5 minutes ago
  • :later 1h Restore to state 1 hour later
  • :undolist Show leaves in undo / redo tree

:MkVimball

Package and distribute plugins and vim macros into vba files with this new command. When opening vim will recognize the vba files and prompt to extract. Uninstall would be a nice addition.

:GetLatestVimScripts

A very lightweight package manager is now included. Make sure you have a version of wget in your path. Then create a file $VIM/getlatest/GetLatestScripts.dat that looks like:

ScriptID SourceID Filename
————————–

A call to :GetLatestVimScripts will then attempt to update all plugins aware of this new functionality.

It will update the file with version and date information. Note that vim ships with more plugins than this, but GLVS, netrw and vimball are the only ones aware of this new feature.

ScriptID SourceID Filename
————————–
642 5228 :AutoInstall: GetLatestVimScripts.vim
1075 5814 :AutoInstall: netrw.vim
1502 5828 :AutoInstall: vimball.vim

Script Enhancements

Vim’s macro language continues to evolve. Things like this are now possible:

:let num = { 1: ‘one’, 2: ‘two’, 3: ‘three’ }
:echo num[2]

One step closer to emacs convergence?

Comments (View)    
blog comments powered by Disqus