is_vim not working
Hello,
I tried to use the plugin as explained on the Vim Integration section on upcase/tmux, however, it doesn't work. When I am outside of vim, I can move between panes. When I'm inside vim, I can move between splits, however my cursor is blocked on vim when I enter the program.
Here's what I added in my tmux configuration file (I changed some keyboard shortcuts due to my keyboard layout):
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" bind-key -n 'C-c' if-shell "$is_vim" 'send-keys C-c' 'select-pane -L' bind-key -n 'C-t' if-shell "$is_vim" 'send-keys C-t' 'select-pane -D' bind-key -n 'C-s' if-shell "$is_vim" 'send-keys C-s' 'select-pane -U' bind-key -n 'C-n' if-shell "$is_vim" 'send-keys C-n' 'select-pane -R' tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
On the internet, I heard that vim creates a new thread each time you create a split, this can be found using ps and that's what is_vim does.
Do you know how to fix the issue?
Thanks in advance!
NB: I'm on ArchLinux, maybe it is a problem with compatibility with macOS...
Hi @Math3mat1x, base on being able to switch around outside of vim, and within vim splits makes me think that it is not an OS incompatibility. Can you clarify what you mean by the following?
my cursor is blocked on vim when I enter the program
Thanks for your answer! On your video on upcase, you showed how you were able to move between the vim splits and tmux's panes seamlessly by using a vim-plugin. However in my case, the cursor stays on vim and it is impossible to switch back to a different tmux pane with, say, a zsh shell in it: the keybinding C-l is recorded by vim and and not tmux. I have another problem though. I use an alternative keyboard layout, bépo, which is totally incompatible with the defaults gestures of vim: I have to replace hjkl with ctsr. This causes issues because using Control-r makes returning back to a change impossible in vim and it is impossible to close a program using Control-c in tmux because it is already taken by tmux. So I have to change my keybindings: Control-bpfn to navigate between panes in tmux, and Control-ctsn in vim to move between splits. If you have any ideas on how I could improve those keybindings, it would be very kind of you that you share them to me! Have a nice day!