Previous Post | Top | Next Post |
TOC
Nvim configuration retrospective
I have been updating Nvim configuration with AstroNvim as described in Re-learning Vim (5) and Re-learning Vim (6).
I also build the latest Nvim in Building Neovim to be compatible with the latest packages.
Although AstroNvim provided me with great features with simple and consistent customization mechanism, they were still a bit overwhelming and sometimes too much. I needed a simpler baseline Neovim configuration platform which offers most features as opt-in.
LazyVim
A new baseline Neovim setup system LazyVim is published by the upstream of the new smart delayed package loader 💤lazy.nvim.
Its guide is available at www.lazyvim.org.
LazyVim functions as a nice baseline Neovim configuration system similar to AstroNvim but with less complication. -> So I decided to switch over to this.
- LazyVim is designed to install a trivial bootstrap code and empty
configuration template files in
~/.config/nvim
. The template files are meant to be customized by the user. - LazyVim package contains non-trivial baseline configuration files and utility codes.
- LazyVim package itself is installed under the
~/.local/share/nvim/lazy
together with all other packages including the package manager 💤lazy.nvim. - Installed lua packages can be managed by
:Lazy
(alternatively,<SPACE>l
).
Terminal emulator
The current gnome-terminal
seems to support true color and undercurls without
much issues.
Just to be sure, I also installed kitty
and alacritty
which are officially
supported by www.lazyvim.org.
The colorscheme
for them was adjusted to match gnome-terminal
to ensure
readability for programs such as mc
.
Key bindings
- You can reach Normal mode by pressing
<ESC>
-key. - In Normal mode,
which-key.nvim
displays the key binding.- for the second and following keys as you type.
- for the first keys just by pressing
<BS>
-key after any random keys such as<SPACE>
-key.
- Notable first keys used by native Neovim and user defined commands:
<SPACE>
-key: user defined utility commandsg
-key: MOVE-type commandsz
-key: FOLD-type commands[
-key: PREVIOUS-type commands]
-key: NEXT-type commands<SPACE>l
-key: Lazy lua package manager<SPACE>cm
-key: Mason binary command manager
NOTE: The comment-out command is gc
for LazyVim (it is <SPACE>/
for AstroNvim).
Colorscheme of Lazyvim
The default colorscheme
for Lazyvim
is tokyonight
.
Now Neovim default to vim.go.background = "dark"
. (as of 0.9.0+)
mason.nvim
support
mason.nvim
manages binary commands used by null-ls.nvim
. It can be started
by :Mason
(alternatively, <SPACE>cm
). To update binary commands to the
latest, just press “U”.
Basically, this helps us to install requested <packagename>
package into
~/.local/share/nvim/mason/packages/<packagename>/
and make its executable
<progname>
program accessible from Neovim in
~/.local/share/nvim/mason/bin/<progname>
. So executable programs from Neovim
plugins are not the one on the main system.
As I see my situation with :checkhelth mason
.:
mason: require("mason.health").check()
========================================================================
## mason.nvim report
- OK: neovim version >= 0.7.0
- OK: **Go**: `go version go1.19.6 linux/amd64`
- OK: **cargo**: `cargo 1.65.0`
- OK: **luarocks**: `/usr/bin/luarocks 3.8.0`
- OK: **Ruby**: `ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu]`
- OK: **RubyGem**: `3.3.15`
- WARNING: **Composer**: not available
- WARNING: **PHP**: not available
- OK: **npm**: `9.2.0`
- OK: **node**: `v18.13.0`
- OK: **python3**: `Python 3.11.2`
- OK: **pip3**: `pip 23.0.1 from /usr/lib/python3/dist-packages/pip (python 3.11)`
- WARNING: **javac**: not available
- OK: **java**: `openjdk version "17.0.6" 2023-01-17`
- WARNING: **julia**: not available
- OK: **wget**: `GNU Wget 1.21.3 built on linux-gnu.`
- OK: **curl**: `curl 7.88.1 (x86_64-pc-linux-gnu) libcurl/7.88.1 OpenSSL/3.0.8 zlib/1.2.13 brotli/1.0.9 zstd/1.5.4 libidn2/2.3.3 libpsl/0.21.2 (+libidn2/2.3.3) libssh2/1.10.0 nghttp2/1.52.0 librtmp/2.3`
- OK: **gzip**: `gzip 1.12`
- OK: **tar**: `tar (GNU tar) 1.34`
- WARNING: **pwsh**: not available
- OK: **bash**: `GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu)`
- OK: **sh**: `Ok`
- OK: GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: Tue 07 Mar 2023 01:45:13 AM JST.
I ended up to install following Debian packages as required system programs.
luarocks
npm
nodejs
cargo
python3-pip
python3-venv
curl
wget
See more :h mason.nvim
In order to make mason.nvim
generated programs accessible from shell
prompt, I have modifies ~.profile
to include the following:
# set PATH so it includes mason.nvim's private bin if it exists (Neovim/mason.nvim)
if [ -d "$HOME/.local/share/nvim/mason/bin/" ]; then
PATH="$HOME/.local/share/nvim/mason/bin:$PATH"
fi
I also added ~/.editorconfig to cope with sources using editorconfig.
I also create bash aliases:
v
to startnvim -u NORC
v0
to startnvim -u ~/.nvim
(very simple setting)
LazyVim customization
I created folked LazyVim starter with
my changes in osamu
branch to keep backup of my local configuration. I
intend to git push -f
. It now contains following changes.
Update .gitigonore
I excluded lazy-lock.json
from git repo.
Opening Gzip files
Since Debian ships most documentation files as Gzipped, I enabled “gzip”
plugin for view
purpose.
Extra features as opt-in features
I made following extra features disabled as started. These can be enabled via key bindings.
- input suggestions (
nvim-cmp
, Toggle with<leader>u<tab>
) - input pairs (
mini.pairs
, Toggle with<leader>u'
) - auto format on save (
nvim-lspconfig
, Toggle with<leader>uf
)
I also made <leader>uu
as NOP to avoid accidental undo u
.
Unicode codepoint in statusline
I replaced clock display in statusline with unicode codepoint such as [+U0044]
.
Vimdoc help files
I add access to many hidden help files available under LOCAL ADDITIONS:
by
running
vimdoc-lazy.
Treesitter and LSP
It is a bit confusing what is all about Treesitter and LSP. Reddit gave me good intro: Treesitter vs LSP. Differences ans overlap.
The nvim-treesitter playground plugin is now integrated into Neovim v0.9, so :InspectTree
works without installing this plugin.
Previous Post | Top | Next Post |