Closed jdhao closed 5 years ago
That article includes a simplified version of the number toggling. This plugin is a little smarter, and it includes support for things like this since https://github.com/jeffkreeftmeijer/vim-numbertoggle/commit/cfaecb9e22b45373bb4940010ce63a89073f6d8b. Could you try installing the plugin, to see if that solves your issue? I'll make sure to add a note about this to the article.
I have installed this plugin. It does not work.
I’m afraid I can’t reproduce this myself. I have set -g mouse on
in my .tmux.conf
, and toggling seems to work both when switching with the keyboard, and clicking the other pane with the mouse.
Could you make sure you have the most recent version of vim-numbertoggle installed, and have removed the code snippet from the article from your Vim configuration files?
Yes, I am using the latest version of vim-numbertoggle and have removed the the simpler code snippet. You can in the following image, line number does not change when I switch to another tmux pane.
I have filed an issue on Neovim repo and got the right answer.
We need to turn on the focus-events
for tmux. Edit the tmux config file ~/.tmux.conf
and add the following setting:
set -g focus-events on
I think this should be mentioned in the README
Does adding set-option -g focus-events on
still work? I have a Mac and a Linux machine, but I couldn't get the plugin to work correctly on either machine.
Running tmux 3.3a and Vim 9.0 on one machine and tmux 3.0a and Vim 8.1 on the other.
Looks like this issue is back, the mentioned fix does not work.
tmux 3.3a nvim 0.9.5
What worked for me was to install the 'tmux-plugins/vim-tmux-focus-events'
Vim plugin.
Although the plugin's README mentions that newer versions of Vim have native support for reporting focus events and, therefore, one should not need to install the plugin, installing it helped resolve the issue on all my machines.
I read your post here and the automatic number toggle works great. The settings I use:
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 to change tmux panes, if that information is relevant.