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

Prevent control key pass-through when docker is running #326

Merged
merged 1 commit into from
Nov 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,27 @@ detail.

[tmate]: http://tmate.io/

### Switching between host panes doesn't work when docker is running

Replace the `is_vim` variable in your `~/.tmux.conf` file with:
```tmux
if-shell '[ -f /.dockerenv ]' \
"is_vim=\"ps -o state=,comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'\""
# Filter out docker instances of nvim from the host system to prevent
# host from thinking nvim is running in a pseudoterminal when its not.
"is_vim=\"ps -o state=,comm=,cgroup= -t '#{pane_tty}' \
| grep -ivE '^.+ +.+ +.+\\/docker\\/.+$' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)? +'\""
```

Details: The output of the ps command on the host system includes processes
running within containers, but containers have their own instances of
/dev/pts/\*. vim-tmux-navigator relies on /dev/pts/\* to determine if vim is
running, so if vim is running in say /dev/pts/<N> in a container and there is a
tmux pane (not running vim) in /dev/pts/<N> on the host system, then without
the patch above vim-tmux-navigator will think vim is running when its not.

### It Still Doesn't Work!!!

The tmux configuration uses an inlined grep pattern match to help determine if
Expand Down