Sensible plugin for Vim

Sensible is a super simple plugin for Vim by Tim Pope. It is nothing but a set of sensible settings for your vimrc. It is a great way to start off on a new system where you do not have access to your fully featured vimrc. I only wish he explained some of the choices he made for the options in this file.

If I have a local account on the remote or new computer, I find it far easier to just replicate my vimrc, and other dot files, using GNU Stow.

How to use vimrc with VsVim

The VsVim extension for Visual Studio supports a lot of the Vim commands that are commonly used. A Vim user should feel comfortable navigating and editing in Visual Studio using this extension. If you want to save your Vim settings or load your Vim settings in VsVim, you can do that from a vimrc file.

VsVim looks for a file named .vsvimrc, _vsvimrc, .vimrc or _vimrc to load Vim settings. You can put your favorite Vim settings into this file and use them with VsVim. You can check which directories that VsVim looks for this file in by using the command :set vimrcpaths?. This is typically the HOME, VIM or USERPROFILE directories. Place your vimrc file in one of these directories, restart Visual Studio and VsVim will load those settings. You can verify which vimrc file is currently loaded in VsVim by using the command :set vimrc?

Tried with: VsVim 1.4.2.0, Visual Studio 2010 and Windows 8 x64

How to show cursorline only in active window of Vim

I find it very useful to have the cursorline enabled in Vim. However, if you are using split windows, the cursorlines of multiple windows can get distracting. Also, this makes it difficult to know which is the active window.

One solution to these problems is to display the cursorline only in the active window. To do that add this to your vimrc:

Tried with: Vim 7.3 and Ubuntu 12.04 LTS

Vim: Location of vimrc

Problem

Users of Vim use the vimrc file for settings that they want to be applied whenever an instance of the editor is launched. If you are sitting at the computer of a friend and using his Vim, how do you find out the location of the vimrc that was used to launch his editor?

Solution

The path of the vimrc file that used to launch an instance of vim is stored in the environment variable named $MYVIMRC. The value stored in this variable can be viewed using :echo $MYVIMRC

Tried with: Vim 7.3 on Windows 7 64-bit

ViM: Always Maximized

As I increasingly try to work in a distraction-free mode, I find myself using applications with their windows maximized. To make ViM always open its window maximized, add this command to your vimrc file:

autocmd GUIEnter * simalt ~x

autocmd is used to add a command to ViM that is triggered on a certain event. The event here is GUIenter, which is the event of opening a ViM window. The * represents the files on which to trigger the command, which is all files for our case. simalt ~x is the Alt-Space + x command, the command to trigger on the window open event. That is, Alt-Space which shows the control menu of the window in Windows, followed by x, which chooses the Maximize option.