October 30, 2015
Recently I’ve decided to try to set up a C# development environment on my Raspberry Pi 2 using Vim and OmniSharp. It has been a long process, so I wanted to document each of the problems I faced (and the solutions) here for the next time I try this.
I’m using Raspbian at the following version:
I have mono 3.2.8 installed, and I started off with the latest version of Vim available in a package for Raspbian (but we’ll see later that had to change).
I’ll go through each problem I had while I tried to set up an OmniSharp development environment with Vim.
I found that the vim-nox package is built with Python support, so I installed it.
When I opened a C# source file and tried to use omni-complete with
<C-x><C-o> I saw this error:
It turns out that the vim-nox package does not have a new enough version of Vim to use with OmniSharp. It is at version 7.3.547, but OmniSharp uses
pyeval in Vim, which is at 7.3.569. So I installed Vim from source.
Vim needs to be compiled with Python support (see Problem 1 above).
I first had to install the
Then I followed some good instructions to get Vim built correctly with Python support.
I next had to make Vim built from sources the default version used on my machine. It installed to
I ran these commands:
I also had to add /usr/local/bin to my
PATH environment variable value.
Ready for everything to work now, I tried omni-complete again. When I did
<C-x><C-o> and got this error:
It turns out the omnisharp-vim installation via Vundle did not actually build the Omnisharp.exe server.
I changed to the
~/.vim/bundle/omnisharp-vim/server directory and ran the xbuild command to build the OmniSharp.exe server.
I still did not have omni-complete! The OmniSharp server did start automatically from Vim because I was testing a
.cs file that was not part of a project and solution file.
I was able to start the OmniSharp server manually. It starts automatically if I open Vim with a
.cs file that is in project and a solution.
I attempted to set up grunt-init (as recommended on the omnisharp-vim site). I first tried to install the node and npm packages manually.
But that does not work, as the npm package is too old.
So I then followed these instructions to get a working npm system. Then I could install grunt.
After these seven problems were solved, I was able to get omni-complete with C# working in Vim on my Raspberry Pi 2. Now to write some code!