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

'size missing' when trying to preview-tui in tmux #1812

Closed
sakarimov opened this issue Feb 7, 2024 · 7 comments
Closed

'size missing' when trying to preview-tui in tmux #1812

sakarimov opened this issue Feb 7, 2024 · 7 comments

Comments

@sakarimov
Copy link

sakarimov commented Feb 7, 2024

Environment details (Put x in the checkbox along with the information)

  • [ x ] Operating System:
    Archlinux x86_64

  • [ x ] Desktop Environment:
    i'm using qtile (window manager)

  • [ x ] Terminal Emulator:
    konsole 23.08.4

  • [ x ] Software Versions:
    bash with tmux next-3.4 (tmux-sixel-git on aur)
    nnn 4.9 (nnn-nerd on aur)

  • [ x ] Program options used:

n() {                                                                                                                                                        
        # if [ -n "$TMUX" ]; then                                                                                                                            
        #       nnn -a $@                                                                                                                                   
        # else                                                                                                                                              
        #       tmux new-session nnn -a $@                                                                                         
        # fi                                                                                                                                                 
        # Block nesting of nnn in subshells                                                                                                                  
        [ "${NNNLVL:-0}" -eq 0 ] || {                                                                                                                        
                echo "nnn is already running"                                                                                                                
                return                                                                                                                                       
        }                                                                                                                                                    
                                                                                                                                                             
        # The behaviour is set to cd on quit (nnn checks if NNN_TMPFILE is set)                                                                              
        # If NNN_TMPFILE is set to a custom path, it must be exported for nnn to                                                                             
        # see. To cd on quit only on ^G, remove the "export" and make sure not to                                                                            
        # use a custom path, i.e. set NNN_TMPFILE *exactly* as follows:                                                                                      
        #      NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"                                                                                    
        export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"                                                                                    
                                                                                                                                                             
        # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn                                                                                     
        # stty start undef                                                                                                                                   
        # stty stop undef                                                                                                                                    
        # stty lwrap undef                                                                                                                                   
        # stty lnext undef                                                                                                                                   
                                                                                                                                                             
        # The command builtin allows one to alias nnn to n, if desired, without                                                                              
        # making an infinitely recursive alias                                                                                                               
        command nnn "$@"                                                                                                                                     
                                                                                                                                                             
        [ ! -f "$NNN_TMPFILE" ] || {                                                                                                                         
                . "$NNN_TMPFILE"                                                                                                                             
                rm -f "$NNN_TMPFILE" >/dev/null                                                                                                              
        }                                                                                                                                                    
}                                                                                                                                                            
                                                                                                                                                             
[[ -r "/usr/share/z/z.sh" ]] && source /usr/share/z/z.sh                                                                                                     
  • [ x ] Configuration options set:
export NNN_FIFO=/tmp/nnn.fifo                                                                                                                                
export NNN_PLUG='c:fzcd;s:rsynccp;r:renamer;m:nmount;p:preview-tui'                                                                                          
export NNN_TERMINAL='konsole'
  • [ x ] tmux config:
# change command binding
unbind C-b
set -g prefix C-Space
bind C-Space send-prefix

# change windows base index to start from 1 not 0
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on

# set vi-mode
set-window-option -g mode-keys vi
# keybindings
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel

set -g @plugin 'olimorris/tmux-pomodoro-plus'
set -g @plugin 'catppuccin/tmux'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-logging'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-sessionist'

set -g mouse on

# pomodoro setup
set -g status-right "#{pomodoro_status}"
set -g @pomodoro_sound 'on'

# catppuccin setup
set -g @catppuccin_flavour "frappe"

# nnn config
set -g allow-passthrough on
set -g escape-time 0

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

Exact steps to reproduce the issue

i just finished installing nnn, and set minimal config, when i try to use preview-tui inside tmux i got this size missing error
image

but, when i try to use preview-tui without tmux, everything run as expected, is there something i missed, since i read in the documentation that for dual-panel nnn will work firstly on tmux

@sakarimov sakarimov added the bug label Feb 7, 2024
@sakarimov
Copy link
Author

after a bunch of trial and error, i found that the problem is with newest tmux with sixel, and still cannot find any solution for this issue. but i also found that nnn works very well when i want to preview files preview-tabbed, thank's to all devs on it, i'll close this issue

image
this is preview-tui inside tmux, nnn-nerd

image
this is live preview-tabbed inside tmux, nnn-nerd

@N-R-K N-R-K added environment and removed bug labels Feb 11, 2024
@XhstormR
Copy link

I have the same issue after upgrade tmux version to 3.4.

@rennsax
Copy link

rennsax commented Feb 17, 2024

+1 for this problem, using Tmux 3.4.

@aketawi
Copy link

aketawi commented Feb 17, 2024

Seems that the -p option for splitting panes in tmux is now gone, which is what the plugin uses. The simple fix I found is to use -l instead as suggested here: tmux/tmux#3836 (comment)

On line 165 of preview-tui in your plugins directory change ... -p "$NNN_SPLITSIZE ..." to ... -l "$NNN_SPLITSIZE" ... so that the full line looks like

            tmux split-window "${ENVVARS[@]}" -d"$split" -l"$NNN_SPLITSIZE" "$0" "$1" ;;

although reading further, seems that this is just a temporary bug in 3.4: tmux/tmux#3836 (comment)

@rennsax
Copy link

rennsax commented Feb 17, 2024

@aketawi Thank you very much! It works for me. But I find the size of the new pane is a little weird. Maybe your advise can serve as a temporary workaround :)
image

@XhstormR
Copy link

XhstormR commented Feb 17, 2024

tmux/tmux#3840


Update:
After I re-downloaded the preview-tui plugin script, the error disappeared. I don't know why, but it worked.

curl 'https://raw.githubusercontent.com/jarun/nnn/master/plugins/preview-tui' -o '/Users/user/.config/nnn/plugins/preview-tui'

@rennsax
Copy link

rennsax commented Feb 18, 2024

Oh yes, in the newer version, the plugin has fixed this problem. Anyone who has the same problem can try to upgrade the version of plugins.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants