Window switching stops working in python virtual environment
Hi @aserowy thanks for this great plugin!
I'm running into some unexpected behavior currently. If I have a tmux session and open nvim, <c-j> et all. works. However, if I first run poetry shell it no longer works. The mapping is set, but now nothing happens.
It must have something to do with poetry since if I activate the environment manually with source .venv/bin/activate it does work.
Any ideas? I believe poetry shell spawns a subshell, (though $TMUX remains set) and that might have something to do with it.
Hmmm, sounds weirdo. I am not working with python anymore (stopped at 2.7.^^). Maybe file a pr, if you'll find whats causing it.
Regards Alexander
i had the same problem. maybe there is an error in the line:
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
i found a solution here: https://github.com/christoomey/vim-tmux-navigator/issues/295
this work for me:
is_vim="children=(); i=0; pids=( $(ps -o pid= -t '#{pane_tty}') ); \
while read -r c p; do [[ -n c && c -ne p && p -ne 0 ]] && children[p]+=\" $\{c\}\"; done <<< \"$(ps -Ao pid=,ppid=)\"; \
while (( $\{#pids[@]\} > i )); do pid=$\{pids[i++]\}; pids+=( $\{children[pid]-\} ); done; \
ps -o state=,comm= -p \"$\{pids[@]\}\" | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
@duongapollo
Heho,
nice finding. Can you push a pr, thus we can get the fix upstream?
Regards Alexander
@aserowy i have updated the "is_vim" script in ~/.tmux.conf from:
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
to
is_vim="children=(); i=0; pids=( $(ps -o pid= -t '#{pane_tty}') ); \
while read -r c p; do [[ -n c && c -ne p && p -ne 0 ]] && children[p]+=\" $\{c\}\"; done <<< \"$(ps -Ao pid=,ppid=)\"; \
while (( $\{#pids[@]\} > i )); do pid=$\{pids[i++]\}; pids+=( $\{children[pid]-\} ); done; \
ps -o state=,comm= -p \"$\{pids[@]\}\" | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
it worked well in nested shell (in this case is pipenv shell)