Neovim

Call me late to the party if you want, but I recently adopted Neovim as my new full-time text editor for work, and I have to say I’m very pleased of having done so.

In case you don’t know (which given my audience, I’d be surprised to hear) Neovim is a successor of Vim, built since 2014 on a fork of version 7 point something of Vim.

The good news is that it is almost 100% compatible with Vim, and that means I could reuse my good old .vimrc, using the following initialization file in ~/.config/nvim/init.vim

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc

And that’s it. The only line in my .vimrc that didn’t work in Neovim was the following:

set guitablabel=%t

Which to be honest, I don’t remember why it was there.

Most of the Vim plugins I had installed with Pathogen worked off-the-box, with the exception of Gundo, which had trouble accessing my Python environment; so I had to install a separate Python package for that:

$ pip3 install --user --upgrade pynvim

In my Fedora 44, I also installed the neovim-qt package, which provides a similar experience to Gvim on my desktop; this app uses its own configuration file, ~/.config/nvim/ginit.vim, which in my case ended up looking like this:

" Define your default font name and size
let s:default_fontsize = 15
let s:current_fontsize = s:default_fontsize
let s:font_name = "BlexMono Nerd Font"

function! AdjustFontSize(amount)
  let s:current_fontsize = s:current_fontsize + a:amount
  execute "GuiFont! " . s:font_name . ":h" . s:current_fontsize
endfunction

function! ResetFontSize()
  let s:current_fontsize = s:default_fontsize
  execute "GuiFont! " . s:font_name . ":h" . s:current_fontsize
endfunction

" Mappings for Increasing Size (Ctrl + Plus / Ctrl + Equals)
nnoremap <C-+> :call AdjustFontSize(1)<CR>
nnoremap <C-=> :call AdjustFontSize(1)<CR>
nnoremap <C-kPlus> :call AdjustFontSize(1)<CR>

" Mappings for Decreasing Size (Ctrl + Minus)
nnoremap <C--> :call AdjustFontSize(-1)<CR>
nnoremap <C-kMinus> :call AdjustFontSize(-1)<CR>

" Mapping for Reset (Ctrl + Zero)
nnoremap <C-0> :call ResetFontSize()<CR>
nnoremap <C-k0> :call ResetFontSize()<CR>

" Toggle Fullscreen with F11
let s:my_fs_state = 0

function! ToggleFullScreen()
    if s:my_fs_state == 0
        call GuiWindowFullScreen(1)
        let s:my_fs_state = 1
    else
        call GuiWindowFullScreen(0)
        let s:my_fs_state = 0
    endif
endfunction
nnoremap <silent> <F11> :call ToggleFullScreen()<CR>

" Enable standard GUI clipboard shortcuts
nnoremap <C-S-v> "+p
vnoremap <C-S-v> "+p
inoremap <C-S-v> <C-r>+
cnoremap <C-S-v> <C-r>+

call ResetFontSize()

Neovim feels nice, snappy, fast, very convenient, and with a much more interesting roadmap ahead.