Alternate VIM Reloaded

A little over 6 years ago, or just 2 posts below :), I wrote about how I use VIM from the command-line to invoke a GUI version of VIM, where each file would appear in a separate tab. I've stuck with that setup to this day, where VIM is still my main IDE whether working on Linux or macOS.

Recently I bought a pine64 based PINEBOOK Pro laptop which is powered by a low-cost ARM64 Single Board Computer (SBC). This came pre-installed with Manjaro KDE edition of Linux. Though this laptop is no slouch (I find myself using it more thanks to 8hrs+ battery), I wanted to keep it lean without loading too many GTK apps.

KDE, being built on Qt, I decided to try neovim-Qt, which is powered by neovim, a somewhat newer rewrite of VIM, that is pretty slick and fast. This is how I got neovim-Qt working in a similar manner to that of vim / gvim.


Install packages

First, install neovim-qt. On Manjaro, this would involve pacman.

sudo pacman -Sy neovim-qt

Next, the secret sauce ;), a project called neovim-remote. Fortunately, it can be installed quite easily via pip. But first I had to install pip.

sudo pacman -Sy python-pip
pip3 install neovim-remote

This exposes a command nvr but because I use mvi with the VIM setup, I just aliased mvi to nvr so it behaves much like how I'm used to. I also had to add ~/.local/bin to my $PATH variable.

echo "alias mvi='nvr --remote-tab'" >> ~/.bashrc
echo 'export PATH="~/.local/bin:$PATH"' >> ~/.bashrc

Finally, we need to start a neovim server so I added a shell script to do that as well.

echo "NVIM_LISTEN_ADDRESS=/tmp/nvimsocket nvim-qt" > ~/bin/start-nvim.sh
chmod +x ~/bin/start-nvim.sh

Using it

Usage is simple enough. First I'd launch neovim-qt as a server using the shell script.

~/bin/start-nvim.sh

Then open files using the mvi alias.

mvi /etc/passwd /etc/hosts

That's it! Checkout my ~/.nvimrc for how I've customized it.

Comments

Popular posts from this blog

Why KDE4 (might) suck!

Track Your New Year Resolutions With ii.do

I want my CDMA! How my rights were violated.