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

Can not navigate between tmux panes when in vim insert mode #106

Open
HaomingFu opened this issue Oct 12, 2023 · 1 comment
Open

Can not navigate between tmux panes when in vim insert mode #106

HaomingFu opened this issue Oct 12, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@HaomingFu
Copy link

HaomingFu commented Oct 12, 2023

Problem

Say I open multiple Tmux panes, the pane under focus is running Neovim in insert mode. I am not able to navigate to other panes using keyboard shortcuts. I have to switch to normal mode in Neovim and only then can I navigate from the pane running Neovim to another pane.

Expected behavior

With proper settings, I hope that I can navigate between Tmux panes freely using keyboard shortcuts, even when the pane is running Neovim/Vim in insert mode.

Screenshots

image

Versions

Tmux 3.3a
tmux.nvim commit 673782b (2023 Sept 6)

My settings

Tmux settings:

is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' { if -F '#{pane_at_left}'   '' 'select-pane -L' }
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' { if -F '#{pane_at_bottom}' '' 'select-pane -D' }
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' { if -F '#{pane_at_top}'    '' 'select-pane -U' }
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' { if -F '#{pane_at_right}'  '' 'select-pane -R' }
bind-key -T copy-mode-vi 'C-h' if -F '#{pane_at_left}'   '' 'select-pane -L'
bind-key -T copy-mode-vi 'C-j' if -F '#{pane_at_bottom}' '' 'select-pane -D'
bind-key -T copy-mode-vi 'C-k' if -F '#{pane_at_top}'    '' 'select-pane -U'
bind-key -T copy-mode-vi 'C-l' if -F '#{pane_at_right}'  '' 'select-pane -R'

Neovim settings:

local status_ok, tmux = pcall(require, "tmux")
if not status_ok then
	return
end

tmux.setup {
  navigation = {
    cycle_navigation = false,
    enable_default_keybindings = true,
    persist_zoom = false,
  },
  resize = {
    enable_default_keybindings = false,
  },
}

Question

Is there any way in which I can navigate between Tmux panes freely using keyboard shortcuts, even when the pane is running Neovim/Vim in insert mode? If so, how? Thanks!

@aserowy aserowy added the enhancement New feature or request label Oct 28, 2023
@aserowy
Copy link
Owner

aserowy commented Oct 28, 2023

Heho,

this must get implemented. Feel free to file a pr.

keymaps.register("n", {

Here would be the line. Maybe you can extend options to specify which scopes should get bound with n as default.

Kind regards
Alexander

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants