- In vim I have split navigation mapped to
ctrl+h/j/k/l
.
- In tmux I navigate splits with
prefix + ctrl+h/j/k/l
.
- Ideally I would be able to navigate between vim and tmux splits transparently using only
ctrl+h/j/k/l
.
- I haven't figured that out yet, but I have figured out how to jump out of vim into the next tmux split if I am at the boundary of vim and tmux, without having to prefix jump, which is pretty ace. ie:
*=cursor position
----------- ----------- ----------- -----------
| vim * | | vim | | vim | | vim |
----------- ----------- ----------- -----------
| vim | <c-j> -> | vim * | <c-j> -> | vim | prefix<c-k> -> | vim * |
=========== =========== =========== ===========
| term | | term | | term * | | term |
----------- ----------- ----------- -----------
- I have no idea how to go from a terminal into vim without using the prefix though. I know I can bind keys without the prefix using
-n
but that breaks the above behaviour.
- What I think I need is to for
<ctrl-j>
in tmux bound to a function which checks if the current pane is running vim, if so it send-keys ctrl-j
to vim, otherwise it jumps the pane like normal.
- But I have no idea how to do that, do you?
Ok, based on your idea I have written a few scripts that do what you want, check it out.