Git Rebase and Vim

When collaborating with Git, I find the git fetch, git rebase pattern suits me. I like the cleaner history. Sometimes I'll switch to cherry-pick for applying specific changes for safe deployments.

I used to get into a mess with Vim when using this workflow, because I typically have a lot of open files spread across tabs and windows, so Vim would complain about changes to active buffers. You're probably familiar with this error:

WARNING: The file has been changed since reading it!!!

Sometimes the file isn't even different in terms of content, it's just that Git has moved things around on the filesystem. The solution is simple: reopen the file with :e filename. However, doing that for every file is too much work -- it'd be easier to restart Vim.

Read More →

Oh My Vim!

Oh My Vim! is a Vim plugin manager inspired by the widely used oh-my-zsh. It requires Python, but has some interesting features like a plugin registry. You can view the registry on GitHub.

It can be used from within Vim through the :OhMyVim command, which also supports completion. This allows you to issue commands like :OhMyVim install and :OhMyVim remove.

If you want to submit your own Vim plugins to the plugin registry make a change to ohmyvim/config.ini and submit a pull request.

Read More →

Script Roundup: Ultimate Colorscheme , clever-f.vim

Ultimate Colorscheme

It can be hard to find just the right colour scheme, and Vim doesn't exactly make it easy to quickly switch between them. Ultimate Colorscheme (GitHub: biskark / vim-ultimate-colorscheme-utility, License: MIT) by Kevin Biskar allows you to browse your colour schemes, and favourite them. Favourites can be associated with filetypes, so you could use different schemes based on programming language.

clever-f.vim

clever-f.vim (GitHub: rhysd / clever-f.vim, License: MIT) by Linda Rhysd is a variation on fFtT that makes it easier to repeat the previous command:

clever-f.vim extends f mapping for more convenience. You may be able to forget the existence of ;. And you can use ; for another mapping.

Read More →

Square's Vim Enthusiasts

When you start working at a new job, it takes a while to get used to the house style. Some companies have dotfiles to get you started, others have... Maximum Awesome.

In Fly Vim, First-Class, Vim enthusiasts at Square discuss this collection of Vim scripts:

Maximum Awesome comes with many of the features you expect from a full IDE: syntax highlighting, code completion, error highlighting, etc. There are also some components included beyond Vim. Maximum Awesome comes with iTerm 2, a replacement for Terminal, a tmux config, and the Solarized color scheme. This just scratches the surface, though. Hop over to the README for a more exhaustive list.

Read More →

VsVim

VsVim

VsVim (GitHub: jaredpar / VsVim, License: Apache 2.0) by Jared Parsons is an extension for Visual Studio 2010 and above that adds a Vim emulation layer. It can be downloaded and installed from Microsoft's extension site, and requires Visual Studio to be restarted first before use.

Once it's installed you should be able to use Command-line mode, Normal mode, Insert mode, and Visual mode. Visual block requires some settings changes, as outlined in the VsVim FAQ. There is even beta support for the extremely popular ReSharper tool.

Read More →

Script Roundup: fixkey, nextfile

fixkey

fixkey (GitHub: drmikehenry / vim-fixkey, License: Vim) by Michael Henry helps console Vim access metakeys that are usually difficult to map correctly.

It takes a fair bit of work to set up: the fixkey documentation has guides for each popular terminal type, including tmux and screen. If I understand the source correctly, it seems to map new keys to <F13> to <F37>, and then <S-F13> to <S-F37>, giving 50 possible keys.

Once it's set up, :nnoremap can be used to map previously inaccessible metakeys, just like gVim.

Read More →

EditorConfig

EditorConfig is an editor-agnostic file format for defining coding styles. It allows multiple editors to use the same settings. That means if you're working in Vim, but you sometimes switch to an IDE like Visual Studio, then you can keep the same coding style between editors.

Settings are synced using "plugins" -- there's one for each editor that you want to use. The plugins will read an .editorconfig file. This .editorconfig is an example from the project's homepage:

# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# 4 space indentation
[*.py]
indent_style = space
indent_size = 4

# Tab indentation (no size specified)
[*.js]
indent_style = tab

# Indentation override for all JS under lib directory
[lib/**.js]
indent_style = space
indent_size = 2

EditorConfig files use an INI format, so it's easy to parse, which should help if you want to add support for a new editor. Most of the popular ones are already supported, including Sublime Text, TextMate, and IntelliJ.

Read More →

Script Roundup: Move, Hardtime

Move

Move

Move (GitHub: matze / vim-move, License: MIT) by Matthias Vogelgesang is a plugin for quickly moving text in Normal or Visual mode:

It's annoying to delete and paste parts of a text just to move it up and down a bit. There is the :m[ove] command but it is quite awkward to use by todays standards. vim-move is a Vim plugin that moves lines and selections in a more visual manner.

Read More →

Vim 7.4

After a successful beta, Vim 7.4 was released. The main feature of this release is a faster regular expression engine, but as Bram points out there are over a thousand fixes and small improvements.

If you want to upgrade, you can download it from the Vim download page. I upgraded my local version with Homebrew:

brew update
brew upgrade vim

The help page (:help version-7.4) has more details on the new regular expression engine:

Read More →