thiagowfx's avatar

Β¬ just serendipity πŸ€ (not just serendipity)

β˜… vim β†’ nvim

β€’ 256 words β€’ 2 min β€’ updated

I am piloting a transition from vim to nvim.

Here is the least disruptive way I found to accomplish that.

First, install neovim.

shell
brew install neovim

Now, create ~/.config/nvim/init.lua. I decided to populate it based on my original ~/.vimrc, without attempting to share configuration settings between the two.

Multiple iterations with a LLM agent helped it achieve a decent shape, removing redundant settings and replacing some native VimL plugins with Lua ones.

The result: init.lua.

Some notable changes:

  • switch the package manager from vim-plug to lazy.nvim
  • remove vim-sensible
  • rewrite just_one_space in Lua
  • use nvim native OSC52 for yanking text
  • vim-signify -> gitsigns
  • add autopairs
  • add telescope (fuzzy finder), replace fzf
  • add oil (file manager), incorporates some functionality of vidir from moreutils
  • remove vim-commentary, given native support for gc in neovim
  • lightline -> lualine
  • highlight yanked text natively, replace vim-highlightedyank
  • automkdir upon saving a file whose parent directory does not exist, replace vim-mkdir

Now make it frictionless to use nvim instead of vim:

gitdiff
commit 058433b9503477c8c162cac5eba191c704cb9361
Author: Thiago Perrotta <{redacted}>
Date:   Tue Dec 23 12:13:54 2025 -0300

    nvim

diff --git profile/.profile.d/env.sh profile/.profile.d/env.sh
index 1c6507e..c6117a9 100644
--- profile/.profile.d/env.sh
+++ profile/.profile.d/env.sh
@@ -10,4 +10,6 @@ path_munge "$HOME/.bin" "$HOME/bin" "$HOME/.local/bin"
 export CLICOLOR=1

 # Set preferred text editor.
+# nvim should be preferred to vim if it is installed.
 hash vim >/dev/null 2>&1 && export EDITOR="vim" VISUAL="vim"
+hash nvim >/dev/null 2>&1 && export EDITOR="nvim" VISUAL="nvim" && alias vim=nvim

We can still access vim with \vim (or unalias vim if needed).

Now let’s evaluate whether the nvim switch is worth it.