sainnhe/tmux-fzf

wierd behavior of window renaming and switching

amirrezasadeqi opened this issue · 6 comments

Hit there. first thanks for your nice plugin.

when i want to rename a window, sometimes(actually mostly), it does not put the window name in popup automatically. so I set terminal-overrides in my config file to st-256 color. but it had no effect and actually caused some options like window switch don't work under the kitty(other terminal emulator). for example in this situation switch returns the bellow error:
'/home/areza/.tmux/plugins/tmux-fzf/scripts/window.sh' returned 123

the wierd thing actually is that it sometimes works correct under the both of my terminal. i mean it fills the window name automatically and switches to another window without error.

i could not find any question about this on internet and i tried to change the terminal override option to my other terminal(xterm-kitty) and even commenting out this option compeletly but none of them worked and i still get the same behavior.

my os is manjaro and the window manager is dwm. my terminal emulators are st and kitty. also the tmux config file is as bellow:

source /usr/lib/python3.9/site-packages/powerline/bindings/tmux/powerline.conf

set-option -sg escape-time 10
set -g default-terminal "tmux-256color"
set-option -sa terminal-overrides ",st-256color:RGB"

set -g set-clipboard on
set -g mouse off
bind m
set -g mouse on ;
display 'Mouse: ON'
bind M
set -g mouse off ;
display 'Mouse: OFF'

set -g pane-border-style 'fg=cyan bg=default'
set -g pane-active-border-style 'bg=default fg=magenta'

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'

set -g @plugin 'sainnhe/tmux-fzf' # prefix + shift + F

run '~/.tmux/plugins/tpm/tpm'

i hope i could explaine my question clearly.

hi there again.

I actually found the problem. it is because i have used underline in the name of session like "setup_blah". so for eample in the bellow line it can't grep the correct name of session:
cur_win=$(tmux display-message -p | sed -e 's/^.//' -e 's/] /:/' | grep -o '[[:alpha:]|[:digit:]]*:[[:digit:]]*:' | sed 's/.$//g')
actually i am not expert in bash programming i just found this by running the individual parts in my terminal. so it actually does not support naming with underline. is there any way to solve this? as i mentioned i am not expert but if you guide me a little maybe i can find the solution.

thanks !

after a bunch of trials and errors (sed commands are too wierd. i don't understand them well!!!) i found an alternative and that is like bellow command:
tmux display-message -p | sed -e 's/^.//' -e 's/] /:/' -e 's/,.*$//' -e '$s/:\w*$//'
this supports the names with underline. i don't know if this could help to solve this problem globally.

Thank you! This should be fixed via 9f93734.

Thanks you for your fast fix. Now it works well. I manually applied the changes to the scripts and tested it(actually at the momment i don't know how to automatically update the plugin 😅, but i will search it.)

good luck!

actually at the momment i don't know how to automatically update the plugin

If you are using tpm, press prefix + U (shift+u).

Or cd ~/.tmux/plugins/tmux-fzf and then git pull origin master.

Thanks. I did the second way and now it is ok.