As I start my slog through K&R's Second Edition of the C Programming Language (*affiliate link), setting up an IDE early on makes sense; rather than trying to spot every single missed semi-colon myself.
I already knew this should be based around vim; having used it extensively with LaTeX for a research project. Rather than straight vim though I opted for neovim, which is a fork of the original project with a more community-driven flavour. And also rather than investing days in endlessly tweaking it; I wanted something that worked out of the box - Oni therefore looked like a great choice. An IDE with neovim as a back end, perfect. Seen as I had just installed a clean version of Ubuntu 18.04 LTS, I thought great, I'll download and I'm away. Not so simple, here's what I did to get it working:
Install Oni. So this is fairly straightforward. Head to their downloads page and install the deb package via Ubuntu Software. Easy enough but opening the application will get an error:"Uh oh! Unable to launch Neovim... Neovim v0.2.1 is required to run Oni."
Install Neovim. There are a number of ways to do this, the default one is to install an appimage. I'm hesitant about appimages; a good idea but not entirely sure how you are meant to update them. Instead elsewhere on the downloads page there is an Ubuntu Personal Package Archive (PPA). Unfortunately, at time of writing, the stable PPA isn't at the current version, while the unstable version breaks Oni. To install the stable version of neovim:
sudo add-apt-repository ppa:neovim-ppa/stable
sudo apt update
sudo apt install neovim
This will get you a working version of Oni, but will not get you IDE features for C or C++.
clangand is an implementation of the Language Server Protocol intended to "provide language 'smartness' features like code completion... for... C/C++ editors." There are PPAs for both in Ubuntu that can be installed with:
sudo apt install clang
sudo apt install clang-tools
Although you might think this would do it - it doesn't. When Oni initialises it expects to find
/usr/bin/directory, however the name of the file the PPA installs is different:
clangd-6.0(referring to the version number). To solve this a symlink can be created referencing the expected file:
sudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-6.0 1000
And wallah, Oni works for C and C++. So far I'm really enjoying it (I'm writing this in it); it scratches a real itch for vim as a modern looking, easy to use IDE.