preservim / vimux

easily interact with tmux from vim
MIT License
2.19k stars 158 forks source link

Vimux prepends "q" to all commands #209

Closed par4m closed 2 years ago

par4m commented 2 years ago

VimuxPromptCommand: image

VimuxRunCommand: image

Not sure why this is happening. I'm also using tmux.nvim for navigation

Here's my tmux config

# Prefix
    # Ctrl-A
set -g prefix C-a

# unbind C-b
# set-option -g prefix `
# bind ` send-prefix

# General Settings
set-option -sa terminal-overrides ',tmux-256color:RGB'
set -g mouse on
set -ag terminal-overrides ',*:cud1=\E[1B'
set -g default-terminal "tmux-256color"

# Ensure window index numbers get reordered on delete.
set-option -g renumber-windows on

# Start windows and panes index at 1, not 0.
set -g base-index 1
setw -g pane-base-index 1

# Plugins
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-copycat'
# set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# set -g @continuum-restore 'on'
run -b '~/.tmux/plugins/tpm/tpm'

# restore nvim session with resurrect
set -g @resurrect-strategy-nvim 'session'

# Vim and Tmux Setup
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h'  'select-pane -L'
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j'  'select-pane -D'
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k'  'select-pane -U'
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l'  'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
    "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\'  'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
    "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\'  'select-pane -l'"

bind-key -T copy-mode-vi 'M-h' select-pane -L
bind-key -T copy-mode-vi 'M-j' select-pane -D
bind-key -T copy-mode-vi 'M-k' select-pane -U
bind-key -T copy-mode-vi 'M-l' select-pane -R

# Theme
source ~/.gruvbox-test.tmux
# source ~/.gruvbox-material.tmux
alerque commented 2 years ago

I'm not able to replicate this. I'm guessing you have something amiss in your VIM config. Can you post your RC file that? Also how are you getting into VimuxPromptCommand? Are you manually typing it at the VIM command prompt or are you using some keybinding to run it? If the latter I suspect that q is coming in from there...

par4m commented 2 years ago

I don't have any Vimux configuration but here is my neovim config Yes I'm manually calling Vimux without any keybind. Realised that when no tmux window (where the command is run) is active it works fine but every other command after that has q prepended to it

Running VimuxPromptCommand when no tmux window below it is active

image

Output: image

After the first command when VimuxPromptCommand is run, when the tmux window is already active: image

Not sure why q is being prepended, could be my zsh config too im guessing so will check that Same thing happens when I run VimuxRunLastCommand when window is present but works when no window is present

1: When tmux split is not present and VimuxRunLastCommand is ran

image

2: When the window is created manually or the same window is used and then VimuxRunLastCommand is run again

image

par4m commented 2 years ago

Just checked it with bash and it works just fine, it has something to do with my zsh config but not sure what. Closing as it's unrelated.

par4m commented 2 years ago

Found out what was causing this, removing this from zsh config fixed it. Don't know why tho

bindkey  -r  "^u"