To enable hybrid line number, add the following line to your init.lua
.
vim.wo.number = true
vim.wo.relativenumber = true
Code language: Lua (lua)
Save this file by doing a :w
or Shift + z
repeat z
.
The next time you open Neovim, you should see the hybrid line number enabled.
Hi Darryl, thanks for neovim tips.
Could you explain, how to automatically toggle between hybrid numbers and standart numbers with lua config?
Here is legacy vimrc config:
:set number
:augroup numbertoggle
: autocmd!
: autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != “i” | set rnu | endif
: autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
:augroup END