I use the following setting for automatic line number toggle.
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
augroup END
But it seems that this setting does not work inside tmux. If I open two tmux panes side by side and open a file with Neovim in one pane and then switch to another tmux pane, the relative line number in Neovim does not change to absolute number. How to fix this issue?
Besides, I use set -g mouse on
inside ~/.tmux.conf
so that I can use mouse clicks to change tmux panes, if that information is relevant.
FocusGained/Lost
event mean. Before I ask this question, I have never heard of these events. I don't think the new title is useful for new users. For experienced user, they may have solved this issue themselves and do not need answer here.