I recently switched over to using the vscode-neovim extension for VSCode.
What wasn’t obvious though was how to get a plugin manager and plugins / vim customisations working.
I’ll add here quickly my plugins setup as I’m using vim-surround
, and a bunch of Tim Pope plugins:
I’m on Linux / Ubuntu 22.04, with nvim installed via apt
with ppa-neovim/unstable
– you need this to get the current required nvim v0.8+.
I moved from Vim to Neovim and I still use my .vimrc
and amazingly this kind of setup seems to work with vscode-neovim too.
As per the :help nvim-from-vim
have the following ~/.config/nvim/init.vim
:
This happily loads my ~/.vimrc
file for terminal nvim
and then loads ~/.vimrc.vscode
for vscode-neovim – which also appears to load:
- It sets my leader to
<space>
- It loads Plug
- It loads my custom key mappings
- It loads
vim-surround
and andvim-repeat
- I know it loads these because I have a command
map <leader>' ysiw'
- This puts single quotes around the current word
- This works (so
vim-surround
works) - I can then ‘repeat’ my adding quotes with
.
which meansvim-repeat
is working in combination with it.
- I know it loads these because I have a command
I have massively stripped my .vimrc
file down and renamed it to ~/.vimrc.vscode
:
Some interesting things that do work:
- vim-plug works!
- Basically it’s just really really cool that you can use a
.vimrc
- This means almost tons of
remap
s should work
- This means almost tons of
:buffers
works but it’s kind of ugly:nohlsearch
works (removing the highlight):vsplit
works and moving with<C-w>[hjkl]
Lots of things don’t work like:
- I got a conflict between my vim-plug config for VSCode and for neovim
- By running
:PlugClean
inside VSCode this wiped all my neovim vim-plug directories - Effectively I think this means its better to maintain your plugins via neovim
- Then use a subset within VSCode
- By running
- preview, quickfix and location windows
- so vim-fugitive won’t work
- I don’t think
:windo diffthis
works - You have the same problem as with VSCode Vim that undoing all changes doesn’t get rid of the file ‘dirty bit’ so you have to save it to fully undo
:bd
doesn’t work as you expect – you need to use:q
instead- I found the
:e <type file path>
didn’t work with auto-complete beyond the current directory – just useCtrl + P
instead. There is no command history – you can’t use the up arrow to go to previous ex commands that you typed – I’m surprised about this so maybe there is a config setting somewhereCtrl + N/Ctrl + P are used instead of up/down
I’ll try to list more as I go further.
For a couple of hours spent setting it up and to have 90% of the plugins I need working is really great.
Until I can get fugitive and vim diffs (in combination with fugitive) working I will still want to use terminal nvim, but that fits quite easily into my coding process for now.