Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_vim not working #280

Open
Math3mat1x opened this issue Sep 19, 2020 · 2 comments
Open

is_vim not working #280

Math3mat1x opened this issue Sep 19, 2020 · 2 comments

Comments

@Math3mat1x
Copy link

Math3mat1x commented Sep 19, 2020

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...

@christoomey
Copy link
Owner

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

@Math3mat1x
Copy link
Author

Math3mat1x commented Sep 20, 2020

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants