vim-tmux-navigator icon indicating copy to clipboard operation
vim-tmux-navigator copied to clipboard

Vim -> Vim does not work in nix package vim_configurable

Open bobismijnnaam opened this issue 4 years ago • 3 comments

I cannot switch between vim panes when using the vim_configurable package in nix. I think this is because the process name is different/unknown to vim-tmux-navigator. I used the command from #195 to check this

ps -o state= -o comm= -t $(tmux display-message -t 1 -p '#{pane_tty}')

This prints in my case:

S bash
S .vim-wrapped

As a sanity check, the :TmuxNavigateDown and others work fine. It's just that <C-j> and others move to the next tmux pane instead of vim pane. As another sanity check, I installed the regular vim package from nix, and that one does work.

I tried to resolve this by adding . and -wrapped to the is_vim command in my .tmux.conf, but I couldn't get it to work. I would be fine with having to modify the command to fit my kind of vim, but currently I am not sure what I have to add/modify to make it work. For reference, this is what I tried changing the is_vim to:

is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|\.?n?vim?x?(-wrapped)?)(diff)?$'"

What do I have to change is_vim to to make it work with vim_configurable?

bobismijnnaam avatar Jun 05 '20 08:06 bobismijnnaam

Hmm, I'm not sure what exactly you would need to change the pattern to. You're very much in the right ballpark as the process name does not seem to be matching. I'd suggest continuing to tweak there, but you could also try the original process matching check (less functionality, but easier to work with, I think).

christoomey avatar Jun 05 '20 12:06 christoomey

I fiddled a bit, and turns out that the pattern I wanted to use works. The problem is that if I change the is_vim pattern in .tmux.conf, it is not updated in my terminals?

$ tmux display-message -p '#{is_vim}'
ps -o state= -o comm= -t '#{pane_tty}'     | grep -iqE '^[^TXZ ]+ +(\S+\/)?g?(view|n?vim?x?)(diff)?$'

I am quite sure that my .tmux.conf contains the right value for is_vim (i.e. the original grep, but with -wrapped added). What could be the cause of this?

EDIT: Added my tmux.conf (with mangled name to make github accept it)

bak.tmux.conf.txt

bobismijnnaam avatar Jun 05 '20 13:06 bobismijnnaam

Well, turns out the is_vim var was updated after one or more reboots, since it suddenly started working. So the adjustment I initially tried does indeed work. The issue is now resolved as far as I'm concerned.

bobismijnnaam avatar Jun 08 '20 08:06 bobismijnnaam