Neovim installation on WSL2 Debian Windows 11
Table of Contents
1. Neovim
1.1. Philosophy
I've been using Vim since ~2008, but Neovim has meanwhile gathered a very vibrant plugin community for writing and notes, which is my main Vim use case. So decided to look into how I can set up neovim to support that. These are my notes how to set up Neovim to support note taking and writing. These notes mainly serve me to understand how I can setup a reproducible config on Windows 11 running Debian Sid in WSL within Windows Terminal.
1.2. Installation
Neovim is in Debian but its latest stable lags several major versions behind the upstream stable, so installing with bob.
Install dependencies for bob:
$ sudo aptitude install rustup
$ cd ~/sources
$ unzip bob-linux-x86_64.zip
$ wget https://github.com/MordechaiHadad/bob/releases/download/v2.8.3/bob-linux-x86_64.zip
$ cd bob-linux-x86_64/
$ ./bob use stable
Nvim is now installed. Check version installed:
$ nvim -V1 -v
NVIM v0.10.0-dev-2947+ge1ca7a7bf Build type: RelWithDebInfo LuaJIT 2.1.1710088188 Compilation: /usr/bin/gcc-10 -O2 -g -Og -g -flto=auto -fno-fat-lto-objects -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fsigned-char -fstack-protector-strong -Wno-conversion -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -DUNIT_TESTING -DHAVE_UNIBILIUM -D_GNU_SOURCE -DINCLUDE_GENERATED_DECLARATIONS -I/home/runner/work/neovim/neovim/.deps/usr/include/luajit-2.1 -I/home/runner/work/neovim/neovim/.deps/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include -I/home/runner/work/neovim/neovim/build/cmake.config -I/home/runner/work/neovim/neovim/src -I/usr/include system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/local/share/nvim" Run :checkhealth for more info
Then keep your installation up-to-date:
$ ./bob update |nightly|stable|--all|
1.3. Post-installation tasks
1.3.1. DONE symlink nvim
So that sudo nvim works.
$ sudo ln -s /home/pyyhttu/.local/share/bob/nvim-bin/nvim /usr/bin/nvim
1.3.2. DONE Install nvim config
$ git clone https://github.com/meuter/nvim ~/.config/nvim
After this you have relatively sane config under $XDG_CONFIG_HOME/nvim/lua:
$ tree
Refactor the plugins to only include these:
Then add org-mode, x and y:
1.3.3. DONE Install clipboard support
So that copying / pasting into / to nvim works. Easiest way to do this is with Winget and win32yank.
Then launch cmd.exe and issue:
winget install win32yank
After this also mouse right click and copy/paste works as well as "*y yanking.
1.4. Plugins
.config/nvim/lua/plugins/orgmode.lua:
return { "nvim-orgmode/orgmode", event = "BufRead", -- replace VeryLazy, otherwise syntax highlighting won't work config = function() -- Setup orgmode require("orgmode").setup({ -- org_agenda_files = "~/orgfiles/**/*", org_agenda_files = "~/orgfiles/*", org_default_notes_file = "~/orgfiles/refile.org", }) -- NOTE: If you are using nvim-treesitter with `ensure_installed = "all"` option -- add `org` to ignore_install -- require('nvim-treesitter.configs').setup({ -- ensure_installed = 'all', -- ignore_install = { 'org' }, -- }) end, }
Install with these plugins:
1.5. Maintenance
1.6. Troubleshooting
1.7. Observations and future direction
1.7.1. DONE init.vim and init.lua
Both files are not supported at the same time, but I can "nest" init.vim config into init.lua, so write config with that.
Here's a helpful lua-guide to get started. There's also kickstart.nvim which goes through the config. Here's vhyrro's video on undetstanding Neovim.