Cross platform vim script development
I’ve developed vim-project on my Mac and I wanted to be sure that it worked on Windows too. I bought a Windows 8 license some time ago for only 29,99 € to update my Acer from Windows Vista. I could try the plugin in my Acer, but I wanted to have something similar to a Vagrant setup. So I’ve created a VirtualBox for Windows 8, but I’ve encountered some obstacles.
Uninstall windows 8
You can have only one installation of Windows 8. So I followed the instructions to uninstall the Windows 8 license from my Acer from How-To Geek
It wasn’t enough. I had to call Microsoft to activate Window 8.
Windows 8 upgrade with an empty disk
If you install windows 8 on an empty partition, you cannot activate your Windows 8. I have found how to fix the problem in the Microsoft forum
Installation of Vim
I’ve installed this version of vim
Setup of vundle in Windows
I’ve followed the instructions from Vundle for Windows to setup Git and Curl.
Shared Folder with VirtualBox
This is the hard part. I wanted to be able to modify my plugin from MacVim and then restart Gvim to test it.
To achive this, you need to configure a VirtualBox shared folder. Then you need to setup a network unit in Windows. The problem is that the network unit must be visible by all users, because the symbolic links are created as Administrator while vim is started as normal user.
I’ve found the solution on stackoverflow:
For this hack you will need
psexec SysinternalsSuite by Mark Russinovich:
Open an elevated cmd.exe prompt (Run as administrator). Press the
right command. Write
Elevate again to root using PSExec.exe: Navigate to the folder containing SysinternalsSuite and execute the following command
psexec -i -s cmd.exeyou are now inside of a prompt that is
nt authority\systemand you can prove this by typing
-iis needed because drive mappings need to interact with the user
Create the persistent mapped drive as the SYSTEM account with the following command
net use z: \\VBOXSVR\gvim /persistent:yes
Now you can create the links, but you have to do this hack everytime you restart Windows.
Creating symbolic links in NTFS
My Gvim setup is in
gvim from now on.
gvim/_vimrc is a link to
vimfiles is not a link, but a
real directory, because I use Vundle. But
gvim/vimfiles/bundle/vim-project is a link to
Z: in Windows 8.
Using an elevated cmd.exe (
1 2 3 4 5
Then I removed my plugin from
vimfiles/bundle and I have created a link
~/.vim/bundle/vim-project to be able to use the same code in MacVim
Powerline with Consolas font
Here you find a patched consolas for powerline
Some configurations are specific to one manchine. I’ve used the function
hostname() in this way.
1 2 3 4 5
air.local is the Mac and
TOSHIBA is the Windows 8.
With this setup I can write my plugins in MacVim and test them on Gvim and
MacVim at the same time without any copy and paste of files or any commit and
pull. I could use Gvim, but I use a lot of shortcuts starting with the
command in MacVim and the
left command used by VirtualBox is a dead key
inside the guest os.