{"id":13419961,"url":"https://github.com/christoomey/vim-tmux-navigator","last_synced_at":"2025-05-08T23:37:57.411Z","repository":{"id":7993452,"uuid":"9400229","full_name":"christoomey/vim-tmux-navigator","owner":"christoomey","description":"Seamless navigation between tmux panes and vim splits","archived":false,"fork":false,"pushed_at":"2025-04-25T01:49:47.000Z","size":102,"stargazers_count":5708,"open_issues_count":77,"forks_count":347,"subscribers_count":45,"default_branch":"master","last_synced_at":"2025-05-08T20:55:31.137Z","etag":null,"topics":["tmux","vim"],"latest_commit_sha":null,"homepage":null,"language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/christoomey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-04-12T17:53:07.000Z","updated_at":"2025-05-08T08:37:54.000Z","dependencies_parsed_at":"2023-01-13T14:36:00.328Z","dependency_job_id":"dd854790-d30e-410b-8369-df6a8e9cc257","html_url":"https://github.com/christoomey/vim-tmux-navigator","commit_stats":{"total_commits":89,"total_committers":48,"mean_commits":"1.8541666666666667","dds":0.6853932584269663,"last_synced_commit":"a9b52e7d36114d40350099f254b5f299a35df978"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christoomey%2Fvim-tmux-navigator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christoomey%2Fvim-tmux-navigator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christoomey%2Fvim-tmux-navigator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christoomey%2Fvim-tmux-navigator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christoomey","download_url":"https://codeload.github.com/christoomey/vim-tmux-navigator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253156056,"owners_count":21862804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["tmux","vim"],"created_at":"2024-07-30T22:01:23.489Z","updated_at":"2025-05-08T23:37:57.372Z","avatar_url":"https://github.com/christoomey.png","language":"Vim Script","funding_links":[],"categories":["Vim Script","Shell","Vim script","编辑器","\u003ca name=\"tools\"\u003e\u003c/a\u003eTools and session management"],"sub_categories":["资源传输下载"],"readme":"Vim Tmux Navigator\n==================\n\nThis plugin is a repackaging of [Mislav Marohnić's](https://mislav.net/) tmux-navigator\nconfiguration described in [this gist][]. When combined with a set of tmux\nkey bindings, the plugin will allow you to navigate seamlessly between\nvim and tmux splits using a consistent set of hotkeys.\n\n**NOTE**: This requires tmux v1.8 or higher.\n\nUsage\n-----\n\nThis plugin provides the following mappings which allow you to move between\nVim panes and tmux splits seamlessly.\n\n- `\u003cctrl-h\u003e` =\u003e Left\n- `\u003cctrl-j\u003e` =\u003e Down\n- `\u003cctrl-k\u003e` =\u003e Up\n- `\u003cctrl-l\u003e` =\u003e Right\n- `\u003cctrl-\\\u003e` =\u003e Previous split\n\n**Note** - you don't need to use your tmux `prefix` key sequence before using\nthe mappings.\n\nIf you want to use alternate key mappings, see the [configuration section\nbelow][].\n\nInstallation\n------------\n\n### Vim\n\nIf you don't have a preferred installation method, I recommend using [Vundle][].\nAssuming you have Vundle installed and configured, the following steps will\ninstall the plugin:\n\nAdd the following line to your `~/.vimrc` file\n\n``` vim\nPlugin 'christoomey/vim-tmux-navigator'\n```\n\nThen run\n\n```\n:PluginInstall\n```\n\nIf you are using Vim 8+, you don't need any plugin manager. Simply clone this repository inside `~/.vim/pack/plugin/start/` directory and restart Vim.\n\n```\ngit clone git@github.com:christoomey/vim-tmux-navigator.git ~/.vim/pack/plugins/start/vim-tmux-navigator\n```\n\n### lazy.nvim\n\nIf you are using [lazy.nvim](https://github.com/folke/lazy.nvim). Add the following plugin to your configuration.\n\n```lua\n{\n  \"christoomey/vim-tmux-navigator\",\n  cmd = {\n    \"TmuxNavigateLeft\",\n    \"TmuxNavigateDown\",\n    \"TmuxNavigateUp\",\n    \"TmuxNavigateRight\",\n    \"TmuxNavigatePrevious\",\n    \"TmuxNavigatorProcessList\",\n  },\n  keys = {\n    { \"\u003cc-h\u003e\", \"\u003ccmd\u003e\u003cC-U\u003eTmuxNavigateLeft\u003ccr\u003e\" },\n    { \"\u003cc-j\u003e\", \"\u003ccmd\u003e\u003cC-U\u003eTmuxNavigateDown\u003ccr\u003e\" },\n    { \"\u003cc-k\u003e\", \"\u003ccmd\u003e\u003cC-U\u003eTmuxNavigateUp\u003ccr\u003e\" },\n    { \"\u003cc-l\u003e\", \"\u003ccmd\u003e\u003cC-U\u003eTmuxNavigateRight\u003ccr\u003e\" },\n    { \"\u003cc-\\\\\u003e\", \"\u003ccmd\u003e\u003cC-U\u003eTmuxNavigatePrevious\u003ccr\u003e\" },\n  },\n}\n```\n\nThen, restart Neovim and lazy.nvim will automatically install the plugin and configure the keybindings.\n\n### tmux\n\nTo configure the tmux side of this customization there are two options:\n\n#### Add a snippet\n\nAdd the following to your `~/.tmux.conf` file:\n\n``` tmux\n# Smart pane switching with awareness of Vim splits.\n# See: https://github.com/christoomey/vim-tmux-navigator\nis_vim=\"ps -o state= -o comm= -t '#{pane_tty}' \\\n    | grep -iqE '^[^TXZ ]+ +(\\\\S+\\\\/)?g?\\.?(view|l?n?vim?x?|fzf)(diff)?(-wrapped)?$'\"\nbind-key -n 'C-h' if-shell \"$is_vim\" 'send-keys C-h'  'select-pane -L'\nbind-key -n 'C-j' if-shell \"$is_vim\" 'send-keys C-j'  'select-pane -D'\nbind-key -n 'C-k' if-shell \"$is_vim\" 'send-keys C-k'  'select-pane -U'\nbind-key -n 'C-l' if-shell \"$is_vim\" 'send-keys C-l'  'select-pane -R'\ntmux_version='$(tmux -V | sed -En \"s/^tmux ([0-9]+(.[0-9]+)?).*/\\1/p\")'\nif-shell -b '[ \"$(echo \"$tmux_version \u003c 3.0\" | bc)\" = 1 ]' \\\n    \"bind-key -n 'C-\\\\' if-shell \\\"$is_vim\\\" 'send-keys C-\\\\'  'select-pane -l'\"\nif-shell -b '[ \"$(echo \"$tmux_version \u003e= 3.0\" | bc)\" = 1 ]' \\\n    \"bind-key -n 'C-\\\\' if-shell \\\"$is_vim\\\" 'send-keys C-\\\\\\\\'  'select-pane -l'\"\n\nbind-key -T copy-mode-vi 'C-h' select-pane -L\nbind-key -T copy-mode-vi 'C-j' select-pane -D\nbind-key -T copy-mode-vi 'C-k' select-pane -U\nbind-key -T copy-mode-vi 'C-l' select-pane -R\nbind-key -T copy-mode-vi 'C-\\' select-pane -l\n```\n\n#### TPM\n\nIf you prefer, you can use the Tmux Plugin Manager ([TPM][]) instead of\ncopying the snippet.\nWhen using TPM, add the following lines to your ~/.tmux.conf:\n\n``` tmux\nset -g @plugin 'christoomey/vim-tmux-navigator'\n```\n\nTo set a different key-binding, use the plugin configuration settings\n(remember to update your vim config accordingly).\nMultiple key bindings are possible, use a space to separate.\n\n``` tmux\nset -g @vim_navigator_mapping_left \"C-Left C-h\"  # use C-h and C-Left\nset -g @vim_navigator_mapping_right \"C-Right C-l\"\nset -g @vim_navigator_mapping_up \"C-k\"\nset -g @vim_navigator_mapping_down \"C-j\"\nset -g @vim_navigator_mapping_prev \"\"  # removes the C-\\ binding\n```\n\nTo disable the automatic mapping of `\u003cprefix\u003e C-l` to `send C-l` (which is\nintended to restore the \"clear screen\" functionality):\n\n```tmux\nset -g @vim_navigator_prefix_mapping_clear_screen \"\"\n```\n\nDon't forget to run tpm:\n\n``` tmux\nrun '~/.tmux/plugins/tpm/tpm'\n```\n\nThanks to Christopher Sexton who provided the updated tmux configuration in\n[this blog post][].\n\nConfiguration\n-------------\n\n### Custom Key Bindings\n\nIf you don't want the plugin to create any mappings, you can use the five\nprovided functions to define your own custom maps. You will need to define\ncustom mappings in your `~/.vimrc` as well as update the bindings in tmux to\nmatch.\n\n#### Vim\n\nAdd the following to your `~/.vimrc` to define your custom maps:\n\n``` vim\nlet g:tmux_navigator_no_mappings = 1\n\nnnoremap \u003csilent\u003e {Left-Mapping} :\u003cC-U\u003eTmuxNavigateLeft\u003ccr\u003e\nnnoremap \u003csilent\u003e {Down-Mapping} :\u003cC-U\u003eTmuxNavigateDown\u003ccr\u003e\nnnoremap \u003csilent\u003e {Up-Mapping} :\u003cC-U\u003eTmuxNavigateUp\u003ccr\u003e\nnnoremap \u003csilent\u003e {Right-Mapping} :\u003cC-U\u003eTmuxNavigateRight\u003ccr\u003e\nnnoremap \u003csilent\u003e {Previous-Mapping} :\u003cC-U\u003eTmuxNavigatePrevious\u003ccr\u003e\n```\n\n*Note* Each instance of `{Left-Mapping}` or `{Down-Mapping}` must be replaced\nin the above code with the desired mapping. Ie, the mapping for `\u003cctrl-h\u003e` =\u003e\nLeft would be created with `nnoremap \u003csilent\u003e \u003cc-h\u003e :\u003cC-U\u003eTmuxNavigateLeft\u003ccr\u003e`.\n\n##### Autosave on leave\n\nYou can configure the plugin to write the current buffer, or all buffers, when\nnavigating from Vim to tmux. This functionality is exposed via the\n`g:tmux_navigator_save_on_switch` variable, which can have either of the\nfollowing values:\n\nValue  | Behavior\n------ | ------\n1      | `:update` (write the current buffer, but only if changed)\n2      | `:wall` (write all buffers)\n\nTo enable this, add the following (with the desired value) to your ~/.vimrc:\n\n```vim\n\" Write all buffers before navigating from Vim to tmux pane\nlet g:tmux_navigator_save_on_switch = 2\n```\n\n##### Disable While Zoomed\n\nBy default, if you zoom the tmux pane running Vim and then attempt to navigate\n\"past\" the edge of the Vim session, tmux will unzoom the pane. This is the\ndefault tmux behavior, but may be confusing if you've become accustomed to\nnavigation \"wrapping\" around the sides due to this plugin.\n\nWe provide an option, `g:tmux_navigator_disable_when_zoomed`, which can be used\nto disable this unzooming behavior, keeping all navigation within Vim until the\ntmux pane is explicitly unzoomed.\n\nTo disable navigation when zoomed, add the following to your ~/.vimrc:\n\n```vim\n\" Disable tmux navigator when zooming the Vim pane\nlet g:tmux_navigator_disable_when_zoomed = 1\n```\n\n##### Preserve Zoom\n\nAs noted above, navigating from a Vim pane to another tmux pane normally causes\nthe window to be unzoomed. Some users may prefer the behavior of tmux's `-Z`\noption to `select-pane`, which keeps the window zoomed if it was zoomed. To\nenable this behavior, set the `g:tmux_navigator_preserve_zoom` option to `1`:\n\n```vim\n\" If the tmux window is zoomed, keep it zoomed when moving from Vim to another pane\nlet g:tmux_navigator_preserve_zoom = 1\n```\n\nNaturally, if `g:tmux_navigator_disable_when_zoomed` is enabled, this option\nwill have no effect.\n\n#### Tmux\n\nAlter each of the five lines of the tmux configuration listed above to use your\ncustom mappings. **Note** each line contains two references to the desired\nmapping.\n\n### Additional Customization\n\n#### Ignoring programs that use Ctrl+hjkl movement\n\nIn interactive programs such as FZF or the built-in Vim terminal, Ctrl+hjkl can be used instead of the arrow keys to move the selection up and down. If vim-tmux-navigator is getting in your way trying to change the active window instead, you can make it be ignored and work as if this plugin were not enabled. Just modify the `is_vim` variable(that you have either on the snipped you pasted on `~/.tmux.conf` or on the `vim-tmux-navigator.tmux` file). For example, to add the program `foobar`:\n\n```diff\n- is_vim=\"ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\\\S+\\\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$'\"\n+ is_vim=\"ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\\\S+\\\\/)?g?(view|l?n?vim?x?|fzf|foobar)(diff)?$'\"\n```\n\n#### Restoring Clear Screen (C-l)\n\nThe default key bindings include `\u003cCtrl-l\u003e` which is the readline key binding\nfor clearing the screen. The following binding can be added to your `~/.tmux.conf` file to provide an alternate mapping to `clear-screen`.\n\n``` tmux\nbind C-l send-keys 'C-l'\n```\n\nWith this enabled you can use `\u003cprefix\u003e C-l` to clear the screen.\n\nThanks to [Brian Hogan][] for the tip on how to re-map the clear screen binding.\n\n#### Restoring SIGQUIT (C-\\\\)\n\nThe default key bindings also include `\u003cCtrl-\\\u003e` which is the default method of\nsending SIGQUIT to a foreground process. Similar to \"Clear Screen\" above, a key\nbinding can be created to replicate SIGQUIT in the prefix table.\n\n``` tmux\nbind C-\\\\ send-keys 'C-\\'\n```\n\nAlternatively, you can exclude the previous pane key binding from your `~/.tmux.conf`. If using TPM, the following line can be used to unbind the previous pane binding set by the plugin.\n\n``` tmux\nunbind -n C-\\\\\n```\n\n#### Disable Wrapping\n\nBy default, if you try to move past the edge of the screen, tmux/vim will\n\"wrap\" around to the opposite side. To disable this, you'll need to\nconfigure both tmux and vim:\n\nFor vim, you only need to enable this option:\n```vim\nlet  g:tmux_navigator_no_wrap = 1\n```\n\nTmux doesn't have an option, so whatever key bindings you have need to be set\nto conditionally wrap based on position on screen:\n\n```tmux\nis_vim=\"ps -o state= -o comm= -t '#{pane_tty}' \\\n    | grep -iqE '^[^TXZ ]+ +(\\\\S+\\\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$'\"\nbind-key -n 'C-h' if-shell \"$is_vim\" { send-keys C-h } { if-shell -F '#{pane_at_left}'   {} { select-pane -L } }\nbind-key -n 'C-j' if-shell \"$is_vim\" { send-keys C-j } { if-shell -F '#{pane_at_bottom}' {} { select-pane -D } }\nbind-key -n 'C-k' if-shell \"$is_vim\" { send-keys C-k } { if-shell -F '#{pane_at_top}'    {} { select-pane -U } }\nbind-key -n 'C-l' if-shell \"$is_vim\" { send-keys C-l } { if-shell -F '#{pane_at_right}'  {} { select-pane -R } }\n\nbind-key -T copy-mode-vi 'C-h' if-shell -F '#{pane_at_left}'   {} { select-pane -L }\nbind-key -T copy-mode-vi 'C-j' if-shell -F '#{pane_at_bottom}' {} { select-pane -D }\nbind-key -T copy-mode-vi 'C-k' if-shell -F '#{pane_at_top}'    {} { select-pane -U }\nbind-key -T copy-mode-vi 'C-l' if-shell -F '#{pane_at_right}'  {} { select-pane -R }\n```\n\n#### Nesting\nIf you like to nest your tmux sessions, this plugin is not going to work\nproperly. It probably never will, as it would require detecting when Tmux would\nwrap from one outermost pane to another and propagating that to the outer\nsession.\n\nBy default this plugin works on the outermost tmux session and the vim\nsessions it contains, but you can customize the behaviour by adding more\ncommands to the expression used by the grep command.\n\nWhen nesting tmux sessions via ssh or mosh, you could extend it to look like\n`'(^|\\/)g?(view|vim|ssh|mosh?)(diff)?$'`, which makes this plugin work within\nthe innermost tmux session and the vim sessions within that one. This works\nbetter than the default behaviour if you use the outer Tmux sessions as relays\nto different hosts and have all instances of vim on remote hosts.\n\nSimilarly, if you like to nest tmux locally, add `|tmux` to the expression.\n\nThis behaviour means that you can't leave the innermost session with Ctrl-hjkl\ndirectly. These following fallback mappings can be targeted to the right Tmux\nsession by escaping the prefix (Tmux' `send-prefix` command).\n\n``` tmux\nbind -r C-h run \"tmux select-pane -L\"\nbind -r C-j run \"tmux select-pane -D\"\nbind -r C-k run \"tmux select-pane -U\"\nbind -r C-l run \"tmux select-pane -R\"\nbind -r C-\\ run \"tmux select-pane -l\"\n```\n\nAnother workaround is to configure tmux on the outer machine to send keys to\nthe inner tmux session:\n\n```\nbind-key -n 'M-h' 'send-keys c-h'\nbind-key -n 'M-j' 'send-keys c-j'\nbind-key -n 'M-k' 'send-keys c-k'\nbind-key -n 'M-l' 'send-keys c-l'\n```\n\nHere we bind \"meta\" key (aka \"alt\" or \"option\" key) combinations for each of\nthe four directions and send those along to the innermost session via\n`send-keys`. You use the normal `C-h,j,k,l` while in the outermost session and\nthe alternative bindings to navigate the innermost session. Note that if you\nuse the example above on a Mac, you may need to configure your terminal app to\nget the option key to work like a normal meta key. Consult your terminal app's\nmanual for details.\n\nA third possible solution is to manually prevent the outermost tmux session\nfrom intercepting the navigation keystrokes by disabling the prefix table:\n\n```\nset -g pane-active-border-style 'fg=#000000,bg=#ffff00'\nbind -T root F12  \\\n  set prefix None \\;\\\n  set key-table off \\;\\\n  if -F '#{pane_in_mode}' 'send-keys -X cancel' \\;\\\n  set -g pane-active-border-style 'fg=#000000,bg=#00ff00'\n  refresh-client -S \\;\\\n\nbind -T off F12 \\\n  set -u prefix \\;\\\n  set -u key-table \\;\\\n  set -g pane-active-border-style 'fg=#000000,bg=#ffff00'\n  refresh-client -S\n```\n\nThis code, added to the machine running the outermost tmux session, toggles the\noutermost prefix table on and off with the `F12` key. When off, the active\npane's border changes to green to indicate that the inner session receives\nnavigation keystrokes. When toggled back on, the border returns to yellow and\nnormal operation resumes and the outermost responds to the nav keystrokes.\n\nThe code example above also toggles the prefix key (ctrl-b by default) for the\nouter session so that same prefix can be temporarily used on the inner session\ninstead of having to use a different prefix (ctrl-a by default) which you may\nfind convenient. If not, simply remove the lines that set/unset the prefix key\nfrom the code example above.\n\n#### netrw\n\nVim's builtin file explorer, named the netrw plugin, has a default keymapping\nfor `\u003cC-l\u003e`. When using `vim-tmux-navigator` with default settings,\n`vim-tmux-navigator` will try to override the netrw mapping so that `\u003cC-l\u003e` will\nstill be mapped to `:TmuxNavigateRight` as it is for other buffers. If you\nprefer to keep the netrw mapping, set this variable in your vimrc:\n\n``` vim\nlet g:tmux_navigator_disable_netrw_workaround = 1\n```\n\nAlternatively, if you prefer to work around the issue yourself, you can add the\nfollowing to your vimrc:\n\n``` vim\nlet g:tmux_navigator_disable_netrw_workaround = 1\n\" g:Netrw_UserMaps is a list of lists. If you'd like to add other key mappings,\n\" just add them like so: [['a', 'command1'], ['b', 'command2'], ...]\nlet g:Netrw_UserMaps = [['\u003cC-l\u003e', '\u003cC-U\u003eTmuxNavigateRight\u003ccr\u003e']]\n```\n\nTroubleshooting\n---------------\n\n### Vim -\u003e Tmux doesn't work!\n\nThis is likely due to conflicting key mappings in your `~/.vimrc`. You can check\nthis by running `:verbose nmap \u003cC-h\u003e` (similar for each of the key bindings).\nYou should see vim-tmux-runner as the source listed for the key binding, but if\nyou see something else, you've got a conflict and will need to remove the other\nkey binding or otherwise restructure your vim config.\n\nAnother option is that the pattern matching included in the `.tmux.conf` is\nnot recognizing that Vim is active. To check that tmux is properly recognizing\nVim, use the provided Vim command `:TmuxNavigatorProcessList`. The output of\nthat command should be a list like:\n\n```\nSs   -zsh\nS+   vim\nS+   tmux\n```\n\nIf you encounter a different output please [open an issue][] with as much info\nabout your OS, Vim version, and tmux version as possible.\n\n[open an issue]: https://github.com/christoomey/vim-tmux-navigator/issues/new\n\n### Tmux Can't Tell if Vim Is Active\n\nThis functionality requires tmux version 1.8 or higher. You can check your\nversion to confirm with this shell command:\n\n``` bash\ntmux -V # should return 'tmux 1.8'\n```\n\n### Switching out of Vim Is Slow\n\nIf you find that navigation within Vim (from split to split) is fine, but Vim\nto a non-Vim tmux pane is delayed, it might be due to a slow shell startup.\nConsider moving code from your shell's non-interactive rc file (e.g.,\n`~/.zshenv`) into the interactive startup file (e.g., `~/.zshrc`) as Vim only\nsources the non-interactive config.\n\n### It doesn't work in Vim's `terminal` mode\n\nTerminal mode is now supported :)\n\n### It Doesn't Work in tmate\n\n[tmate][] is a tmux fork that aids in setting up remote pair programming\nsessions. It is designed to run alongside tmux without issue, but occasionally\nthere are hiccups. Specifically, if the versions of tmux and tmate don't match,\nyou can have issues. See [this\nissue](https://github.com/christoomey/vim-tmux-navigator/issues/27) for more\ndetail.\n\n[tmate]: http://tmate.io/\n\n### Switching between host panes doesn't work when docker is running\n\nImages built from minimalist OSes may not have the `ps` command or have a\nsimpler version of the command that is not compatible with this plugin.\nTry installing the `procps` package using the appropriate package manager\ncommand. For Alpine, you would do `apk add procps`.\n\nIf this doesn't solve your problem, you can also try the following:\n\nReplace the `is_vim` variable in your `~/.tmux.conf` file with:\n```tmux\nif-shell '[ -f /.dockerenv ]' \\\n  \"is_vim=\\\"ps -o state=,comm= -t '#{pane_tty}' \\\n      | grep -iqE '^[^TXZ ]+ +(\\\\S+\\\\/)?g?(view|l?n?vim?x?)(diff)?$'\\\"\"\n  # Filter out docker instances of nvim from the host system to prevent\n  # host from thinking nvim is running in a pseudoterminal when its not.\n  \"is_vim=\\\"ps -o state=,comm=,cgroup= -t '#{pane_tty}' \\\n      | grep -ivE '^.+ +.+ +.+\\\\/docker\\\\/.+$' \\\n      | grep -iqE '^[^TXZ ]+ +(\\\\S+\\\\/)?g?(view|l?n?vim?x?)(diff)? +'\\\"\"\n```\n\nDetails: The output of the ps command on the host system includes processes\nrunning within containers, but containers have their own instances of\n/dev/pts/\\*. vim-tmux-navigator relies on /dev/pts/\\* to determine if vim is\nrunning, so if vim is running in say /dev/pts/\u003cN\u003e in a container and there is a\ntmux pane (not running vim) in /dev/pts/\u003cN\u003e on the host system, then without\nthe patch above vim-tmux-navigator will think vim is running when its not.\n\n### It Still Doesn't Work!!!\n\nThe tmux configuration uses an inlined grep pattern match to help determine if\nthe current pane is running Vim. If you run into any issues with the navigation\nnot happening as expected, you can try using [Mislav's original external\nscript][] which has a more robust check.\n\n[Brian Hogan]: https://twitter.com/bphogan\n[Mislav's original external script]: https://github.com/mislav/dotfiles/blob/master/bin/tmux-vim-select-pane\n[Vundle]: https://github.com/gmarik/vundle\n[TPM]: https://github.com/tmux-plugins/tpm\n[configuration section below]: #custom-key-bindings\n[this blog post]: http://www.codeography.com/2013/06/19/navigating-vim-and-tmux-splits\n[this gist]: https://gist.github.com/mislav/5189704\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristoomey%2Fvim-tmux-navigator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristoomey%2Fvim-tmux-navigator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristoomey%2Fvim-tmux-navigator/lists"}