By neildaemond, an 'any-stack' hacking grasshopper.
Taking notes while tinkering with:
'Vim as My IDE' Continued: New Plugin Manager & Intellisense via coc.nvim + LSP
The Quest Continues
In 2012, I started blogging about Vim As My Ide. At that time, I was also going to try and focus on scala as it was all the rage. However, I didn’t like using clunky IDEs like Eclipse to develop in the java world and I didn’t have any pressing reason to continue. Today, I’m back on board the scala train for work purposes and I’m going to leverage some of the newfound support for scala that vim has.
Thanks to VSCode, we have the Language Server Protocol (LSP)
VSCode pioneered the usage of LSP, and, it seems that Vim’s version 8.0 (partial support) and 8.1 can now connect to Language Servers, providing the Holy Grail us programers search for: Intellisense (code completion, function lookups, etc.)
The Vim Plugin which enables the most advanced support at the moment appears to be coc.nvim.
At the moment, I’m preparing vim as my (scala) IDE so I look to Metals - a “Scala language server with rich IDE features”.
Upgrading vim to 8.1 for coc.nvim compatibility
My package manager on Ubuntu 18.04 didn’t have vim 8.1, so I had to install from source (where I was able to enabled more goodies like python, lua, and ruby), I followed this gist:
A new plugin manager?
Amoungst the reasearch, I’ve discovered that there is a new Plugin Manager in Town.
Since 2012, I’ve used various vim plugins and I’ve been installing them using Pathogen plus a ruby script which downloads plugins off of github. My vim setup is kept on neildaemond/np-vim and as of today, the README contains the following:
vim-plug is the real deal
Although through the years my ‘Pathogen + ruby script’ plugin strategy has served me well, It seems like the modern way of doing plugin management in Vim is via vim-plug. The major benefit of using this plugin manager is that you can install based on the plugin repo’s branch/tag/commit. The benefits listed on the github page are:
- Easier to setup: Single file. No boilerplate code required.
- Easier to use: Concise, intuitive syntax
- Super-fast parallel installation/update (with any of +job, +python, +python3, +ruby, or Neovim)
- Creates shallow clones to minimize disk space usage and download time
- On-demand loading for faster startup time
- Can review and rollback updates
- Branch/tag/commit support
- Post-update hooks
- Support for externally managed plugins
So far, I’m really enjoying the balance of simplicity and power that it offers.
Still wrestling with coc.nvim
I’ve been trying to use coc.nvim over the past week or so, but it’s been quite unstable for me so far - I’m pretty sure it has to do with my configuration. I’ve been trying to set it up to work for a variety of languages and filetypes to right away, and I think all of the setting and npm pacakges are conflicting with each other at times.
I think that I had better start using it for a language and fine tune the configurations over time to ensure a more stable environment.
Therefore, for now I’ll settle for the ‘out-of-the-box’ experience that VSCode can provide. See From Vim to VSCode
This way, I can focus on getting things done first and over time, ideally, I will tweak my vim setup for for specific languages as I go along.
#Vim #Metals #Scala #IDEs #Vim-Plug #Coc.nvim