christoomey / vim-tmux-navigator

Seamless navigation between tmux panes and vim splits
MIT License
5.07k stars 319 forks source link

Vim -> Tmux doesn't work! #387

Open alex-belost opened 2 months ago

alex-belost commented 2 months ago

Output from :TmuxNavigatorProcessList

Ss+  zsh (qterm)

Nvim build: LazyVim

Tmux config:

set -g base-index 1 
setw -g pane-base-index 1

set -s escape-time 0
set -g status-interval 0

setw -g automatic-rename on 
set -g renumber-windows on 

set -g set-titles on      
set -g focus-events on

set -g status-position top

# better splitting
bind | split-window -h -c "#{pane_current_path}"
bind _ split-window -v -c "#{pane_current_path}"

unbind r
bind r source ~/.tmux.conf \; display 'Reloaded!'

unbind g 
bind g display-popup -d '#{pane_current_path}' -w 80% -h 80% -E lazygit

bind h select-pane -L
bind l select-pane -R
bind j select-pane -D
bind k select-pane -U

set -g mouse on

set-window-option -g mode-keys vi

set -g @catppuccin_user "on"

set -g @catppuccin_flavour 'mocha'
set -g @catppuccin_status_modules_right "session date_time battery"

set -g @catppuccin_date_time_text "%d %B %Y"

# Tmux plugins manager installation https://github.com/tmux-plugins/tpm
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'catppuccin/tmux'
set -g @plugin 'tmux-plugins/tmux-battery'

set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'christoomey/vim-tmux-navigator'

# Run Tmux plugins manager
run -b '~/.tmux/plugins/tpm/tpm'

Output from ps:

 PID TTY           TIME CMD
[id] ttys000    0:31.20 zsh (qterm)
[id] ttys001    0:00.01 tmux
[id] ttys001    0:05.25 /bin/zsh --login
[id] ttys001    0:00.01 /bin/zsh --login
[id] ttys001    0:00.14 /Users/[user_name]/.cache/gitstatus/gitstatusd-darwin-x86_64 -G v1.5.4 -s
[id] ttys002    0:00.13 zsh (qterm)
[id] ttys003    0:00.34 /bin/zsh --login
[id] ttys003    0:00.01 /bin/zsh --login
[id] ttys003    0:00.00 /Users/[user_name]/.cache/gitstatus/gitstatusd-darwin-x86_64 -G v1.5.4 -s
[id] ttys003    0:00.03 nvim
[id] ttys004    0:00.10 zsh (qterm)
[id] ttys005    0:00.32 /bin/zsh --login
[id] ttys005    0:00.01 /bin/zsh --login
[id] ttys005    0:00.00 /Users/[user_name]/.cache/gitstatus/gitstatusd-darwin-x86_64 -G v1.5.4 -s
[id] ttys008    0:34.33 zsh (qterm)
[id] ttys009    0:00.59 /bin/zsh
[id] ttys009    0:00.00 /bin/zsh
[id] ttys009    0:00.17 /Users/[user_name]/.cache/gitstatus/gitstatusd-darwin-x86_64 -G v1.5.4 -s
[id] ttys009    0:00.13 nvim
[id] ttys010    0:32.05 zsh (qterm)
[id] ttys011    0:00.38 /bin/zsh
[id] ttys011    0:00.01 /bin/zsh
[id] ttys011    0:00.16 /Users/[user_name]/.cache/gitstatus/gitstatusd-darwin-x86_64 -G v1.5.4 -s
[id] ttys012    0:32.28 zsh (qterm)
[id] ttys013    0:00.39 /bin/zsh
[id] ttys013    0:00.01 /bin/zsh
[id] ttys013    0:00.15 /Users/[user_name]/.cache/gitstatus/gitstatusd-darwin-x86_64 -G v1.5.4 -s
[id] ttys014    0:31.46 zsh (qterm)
[id] ttys015    0:01.29 /bin/zsh
[id] ttys015    0:00.01 /bin/zsh
[id] ttys015    0:00.17 /Users/[user_name]/.cache/gitstatus/gitstatusd-darwin-x86_64 -G v1.5.4 -s

command: tty: /dev/ttys005 command: tmux display '#{pane_tty}' -> /dev/ttys004

christoomey commented 1 month ago

A couple of questions just to confirm:

  1. You do have the vim plugin installed in addition to the tmux plugin, right?
  2. Have you checked for conflicting keymaps in vim as per these instructions?

Presuming neither of those resolve it, can you test out the following:

  1. With vim open in the first pane (pane 0 in tmux)
  2. In a split terminal pane, run ps -o state= -o comm= -t $(tmux display -p -t 0 '#{pane_tty}')
  3. Share what the output is?

I'm seeing the following output, for context.

Ss   zsh
S+   vim
ahmedsayedabdelsalam commented 1 month ago

it's not working with me too. am using nvchad

khalil-chermiti commented 3 weeks ago
  -- No longer needed, using tmux navigation integration 

-- navigate = {
--  { mode = "n", keymap = "<C-l>", action = "<C-w>l", desc = "pane left" },
--  { mode = "n", keymap = "<C-h>", action = "<C-w>h", desc = "pane right" },
--  { mode = "n", keymap = "<C-j>", action = "<C-w>j", desc = "pane up" },
--  { mode = "n", keymap = "<C-k>", action = "<C-w>k", desc = "pane down" },
-- },

hey @alex-belost

I had my keymaps to navigate between neovim panes, I think this made a conflict with vim-tmux-navigator if you have a similar keymaps, try removing them and check if it solves your problem

I want to mention the the above mappings didn't cause me any trouble at a certain point, this happened recently

I am using:

TriDEntApollO commented 6 days ago

it's not working with me too. am using nvchad

I am also using Nvchad and it doesnt work, the command works fine but the keybinds don't.