gVim + Janus on Windows

Tagged:  

At work, I'm developing on Windows. At home, I love my MacVim and Janus, so I decided, "Why can't I have that love at work as well?"

To start, just download VIM from http://www.vim.org/download.php#pc and download GIT from http://code.google.com/p/msysgit/ and install. You will also need a ruby install with the rake gem installed.

Now, the first thing to note is that the directory names and a little different on Windows. Your .vimrc will be in $HOME\_vimrc and your .vim directory will be in $HOME\vimfiles.

Ok, now you kick off Git Bash and cd to $HOME and run:

git clone git://github.com/carlhuda/janus.git vimfiles

Once you have your vimfile directory, you need to open your Rakefile and comment out some sections.

First, these plugins have some issues on Windows, so comment them out. You may be able to get them to work, but I haven't tried yet. The section starts from line 127.

vim_plugin_task "taglist",          "git://github.com/vim-scripts/taglist.vim.git"
...
vim_plugin_task "gist-vim",         "git://github.com/mattn/gist-vim.git"
...
vim_plugin_task "command_t",        "http://s3.wincent.com/command-t/releases/command-t-1.2.1.vba" do
  Dir.chdir "ruby/command-t" do
    if File.exists?("/usr/bin/ruby1.8") # prefer 1.8 on *.deb systems
      sh "/usr/bin/ruby1.8 extconf.rb"
    elsif File.exists?("/usr/bin/ruby") # prefer system rubies
      sh "/usr/bin/ruby extconf.rb"
    elsif `rvm > /dev/null 2>&1` && $?.exitstatus == 0
      sh "rvm system ruby extconf.rb"
    end
    sh "make clean && make"
  end
end

The next starts at line 229 since these do things the windows dislikes. Don't comment out the task line and the corresponding end, just everything inbetween.

desc "Update the documentation"
task :update_docs do
  puts "Updating VIM Documentation..."
  system "vim -e -s <<-EOF\n:helptags ~/.vim/doc\n:quit\nEOF"
end

desc "link vimrc to ~/.vimrc"
task :link_vimrc do
  %w[ vimrc gvimrc ].each do |file|
    dest = File.expand_path("~/.#{file}")
    unless File.exist?(dest)
      ln_s(File.expand_path("../#{file}", __FILE__), dest)
    end
  end
end

Now, in your Git Bash Window run:

cd vimfiles
rake

Now, since we needed to skip the linking of ~/.vimrc, we now need to copy $HOME\vimfiles\vimrc to $HOME\_vimrc. Then we need to update that file, go to the section:

" Include user's local vim config
if filereadable(expand("~/.vimrc.local"))
  source ~/.vimrc.local
endif

And replace it with:

" Include user's local vim config
if filereadable(expand("$HOME/_vimrc.local"))
  source $HOME/_vimrc.local
endif

And replace the section:

" Directories for swp files
set backupdir=~/.vim/backup
set directory=~/.vim/backup

with

" Directories for swp files
set backupdir=$HOME/vimfiles/backup
set directory=$HOME/vimfiles/backup

I also add to the end of the _vimrc to get some Windows compatibility:

" Windows compatibility
source $VIMRUNTIME/mswin.vim
behave mswin

The Rakefile has changed dramatically. It is way more dynamic now. Can you provide an update on how you would install the latest version of Janus within a Windows environment?

Hi,

I'm at a new company and not developing under Windows any more, so I'm afraid I can't help you here!

Jeff

Hi, after following your suggestions I've successfully get gVimPortable to run on Windows (at office). But I have to do one more task... copying all the vimfiles dir and _vimrc to my %HOMEPATH%
Here you can download my _vimrc file http://dl.dropbox.com/u/2122030/_vimrc

Riccardo Fallico

Thank you for this short and helpful manual! :-)