This is a quick post about an incredible plug-in that I found today that makes VSCode and VIM Mode work better. Not perfect, but better.
First of, start by using VSCodium. Stay away from VSCode if you can. There’s not much more that I can tell instead of “shady practices, non-open code despite what they say, strange agreements between plug-ins and other things, and always-on telemetry”. Then, install VSCode NeoVim plug-in, and install the release version of NeoVim (the only requirement is that the NeoVim is at least on version 0.5.0).
Then, install Plug, to manage NeoVim plug-ins. Open up ~/.config/nvim/init.vim
(or create if, it doesn’t exist) and add the following lines:
call plug#begin('~/.vim/plugged')
Plug 'eraserhd/parinfer-rust', {'do': 'cargo build –release'}
Plug 'kovisoft/slimv'
call plug#end()
Make sure that you can compile RUST code. If you can’t, don’t install parinfer-rust
(delete the second line above). Run, on NeoVim, :PlugInstall
and then you’re good to go. Now, on VSCodium, open up the NeoVim plug-in settings and add the full path of NeoVim binary. Restart VSCodium, and things should work
Key Bindings
You can add normal-mode, visual-mode, etc keybindings on ~/.config/nvim/init.vim
. Unfortunately, I haven’t found a way to reload the file (you need to reload VSCode completely) but you can bind commands that only exist on VSCode with this technique – below the plug-in installation part, type:
if exists('g:vscode')
noremap <Space>c :call VSCodeNotify('clover.connectSocketRepl')<CR>
endif
This, for example, will add support for Connect Socket REPL
from Clojure package binding the keys space
– c
.
Why?
Most VSCode plug-ins do not play nice one with another. Bizarrely, there are some plug-ins that are clumsy, don’t work correctly, fall into limitations on VSCode API, etc. Even being a text-based editor and with lots of limitations, VIM in general is more flexible.
This approach allows you to install plug-ins from the NeoVim world into VSCode. There are a bunch of packages that work better, or even possible, on Vim that are not that good or don’t work that well (or at all) in VSCode. So why not take advantage of it?