Skip to content

Commit c2dab18

Browse files
anematorchristoomey
authored andcommitted
Add troubleshooting note for interaction with docker containers
1 parent 48390f3 commit c2dab18

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,27 @@ detail.
332332
333333
[tmate]: http://tmate.io/
334334
335+
### Switching between host panes doesn't work when docker is running
336+
337+
Replace the `is_vim` variable in your `~/.tmux.conf` file with:
338+
```tmux
339+
if-shell '[ -f /.dockerenv ]' \
340+
"is_vim=\"ps -o state=,comm= -t '#{pane_tty}' \
341+
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'\""
342+
# Filter out docker instances of nvim from the host system to prevent
343+
# host from thinking nvim is running in a pseudoterminal when its not.
344+
"is_vim=\"ps -o state=,comm=,cgroup= -t '#{pane_tty}' \
345+
| grep -ivE '^.+ +.+ +.+\\/docker\\/.+$' \
346+
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)? +'\""
347+
```
348+
349+
Details: The output of the ps command on the host system includes processes
350+
running within containers, but containers have their own instances of
351+
/dev/pts/\*. vim-tmux-navigator relies on /dev/pts/\* to determine if vim is
352+
running, so if vim is running in say /dev/pts/<N> in a container and there is a
353+
tmux pane (not running vim) in /dev/pts/<N> on the host system, then without
354+
the patch above vim-tmux-navigator will think vim is running when its not.
355+
335356
### It Still Doesn't Work!!!
336357
337358
The tmux configuration uses an inlined grep pattern match to help determine if

0 commit comments

Comments
 (0)