vimpostor / vim-tpipeline

Embed your vim statusline in tmux
GNU General Public License v3.0
362 stars 10 forks source link

Not working on wsl with default statusline and tmux #27

Closed DeadlySquad13 closed 2 years ago

DeadlySquad13 commented 2 years ago

Hello! Thanks for you work, this plugin looks cool! Unfortunately, I can't get it working can you please help me solve this issue? After installing it I had this problem: image Neovim statusline is shrinked on left, tmux - just after it without left and right parts.

Without plugin I have everything setup like this: image Expected this plugin to overwrite my tmux statusline leaving only tabs visible or ideally to combine with it so that it looks like:

tmux left info -> vim left info -> tmux tabs <- vim right info <- tmux right info

Check if the requirements are met

Features: +acl +iconv +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: " /home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info

- True color support (set termguicolors in vim) - OK:
(output of `:set termguicolors?`)
![image](https://user-images.githubusercontent.com/46250621/174459436-7986e863-2f01-4eb2-b3fd-430cc6e52b36.png)

- For best experience use a terminal that supports [focus events](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-FocusIn_FocusOut) (Known good terminals are Konsole, Gnome Terminal and iTerm2) - Did not understand how to check. Maybe problem is in that? It is written `for best experience` though so I moved forward without caring about it that much.

## Minimal config to reproduce
On my wsl instance running inside ConEmu inside [wsltty](https://github.com/mintty/wsltty) this is enough:
neovim packer related config:
```sh
use({
  'vimpostor/vim-tpipeline',
});

tmux config:

# tmux-256color supports italics. 
set -g default-terminal "tmux-256color"
## Tell tmux that outside terminal supports true color.
set -ga terminal-overrides ",xterm-256color*:Tc"

set -g focus-events on
set -g status-style bg=default
set -g status-left-length 90
set -g status-right-length 90
set -g status-justify absolute-centre

My small investigation

Initially I had lualine and tmux custom theme / statusline. As I have almost out of the box config for lualine I decided that problem is in tmux so I`ve done following:

By the way, is it intended? image In manual I didn't find this option, only left, center and right: image Do I have a wrong version? Mine is (output of tmux -V):

tmux 3.0a

My configuration

My full tmux config (without keybinds):

######################
### DESIGN CHANGES ###
######################
# Preliminary Note: use 'colour' instead of 'color' even though the support for
# \ the second is being added, it's still not complete.
# Settings.
# tmux-256color supports italics. 
set -g default-terminal "tmux-256color"
## Tell tmux that outside terminal supports true color.
set -ga terminal-overrides ",xterm-256color*:Tc"

# ----- Configuring Powerline theme. ------
# (overriding default look)
# https://github.com/jimeh/tmux-themepack/blob/master/powerline/default/gray.tmuxtheme
# Tmux echos and Right-Left (Session).
set -goq @powerline-color-main-1 colour2
# # Statusbar.
set -g @themepack-status-left-area-left-format "[ #S ]"
# ?
set -goq @powerline-color-main-3 colour0

# - Right 
set -goq @powerline-color-grey-1 colour253
# - Middle (dubuntus).
set -goq @powerline-color-grey-2 colour250

# Active tab bg.
set -goq @powerline-color-black-1 colour0
# Active tab fg.
set -goq @powerline-color-main-2 colour2

# - Middle (background and background of inactive tabs).
set -goq @powerline-color-grey-3 colour245

# Statusbar fg also Left-Right (tab:pane) and Right-Left (Time).
# 243
set -goq @powerline-color-grey-4 colour243
# Left-Middle (dubuntus) and Right-Middle (Date)
# 240
set -goq @powerline-color-grey-5 colour4
# Right-Right (DS13).
# 238
set -goq @powerline-color-grey-6 colour6

#set -goqF @powerline-status-right-area-left-fg "#{@powerline-color-main-3}"
# Powerline options
#set -goqF @powerline-color-activity-1 "#{@powerline-color-grey-6}"
#set -goqF @powerline-status-bg "#{@powerline-color-grey-1}"
set -goqF @powerline-status-fg "#{@powerline-color-grey-5}"
set -goqF @powerline-status-left-area-left-bg colour166
#set -goqF @powerline-status-left-area-left-fg "#{@powerline-status-bg}"
#set -goqF @powerline-status-left-area-middle-bg "#{@powerline-status-fg}"
#set -goqF @powerline-status-left-area-middle-fg "#{@powerline-status-bg}"
#set -goqF @powerline-status-left-area-right-bg "#{@powerline-color-grey-2}"
#set -goqF @powerline-status-left-area-right-fg "#{@powerline-status-fg}"
#set -goqF @powerline-status-left-bg "#{@powerline-color-grey-1}"
#set -goqF @powerline-status-left-fg "#{@powerline-color-grey-5}"
#set -goqF @powerline-status-right-area-left-bg "#{@powerline-color-grey-2}"
#set -goqF @powerline-status-right-area-left-fg "#{@powerline-status-fg}"
#set -goqF @powerline-status-right-area-middle-bg "#{@powerline-status-fg}"
#set -goqF @powerline-status-right-area-middle-fg "#{@powerline-status-bg}"
#set -goqF @powerline-status-right-area-right-bg "#{@powerline-color-grey-6}"
#set -goqF @powerline-status-right-area-right-fg "#{@powerline-status-bg}"
#set -goqF @powerline-status-right-bg "#{@powerline-color-grey-1}"
#set -goqF @powerline-status-right-fg "#{@powerline-color-grey-5}"

# # Panes
# * Active.
set -goq  @theme-pane-active-border-bg "#{@powerline-color-main-1}"
set -goqF @theme-pane-active-border-fg "#{@powerline-color-main-1}"
# * Inactive.
set -goq  @theme-pane-border-bg "#{@powerline-color-grey-4}"
set -goqF @theme-pane-border-fg "#{@powerline-color-grey-4}"

# Powerline theme.
set -g @plugin 'jimeh/tmux-themepack'
set -g @themepack 'powerline/default/gray'

## Highlight window when it has new activity.
##setw -g monitor-activity on
##set -g visual-activity on
## Colors.
## ----- Default look. ------
## # Statusbar.
## * General
#set-option -g status-bg colour2
#set-option -g status-fg colour254
## * Left side.
## - Session.
#set-window-option -g status-left "#[fg=colour58,bg=colour185][ #S ]#[bg=colour2] "

## - Current window.
#set-window-option -g window-status-current-style 'fg=colour0 bg=colour2 bold'

## * Right side.
## - Host, date, time.
#set-option -g status-right '\
  ##[fg=colour8,bg=colour2] #h \
  ##[fg=colour0,bg=colour2] %H:%M\
  ##[fg=colour8,bg=colour2] %Y/%m/%d '

# # Panes.
# * Inactive.
# - Border.
set-option -g pane-border-style 'fg=colour254 bg=colour254'

# - Inner part.
set-window-option -g window-style 'fg=colour239,bg=colour255'

# * Active.
# - Border.
set-option -g pane-active-border-style 'fg=colour136 bg=colour136'

# - Inner part.
set-window-option -g window-active-style 'fg=colour239,bg=colour0'
#set-window-option -g window-status-current-fg magenta
#set-window-option -g window-status-current-bg black
# - Active pane.
#set -g pane-border-fg color1
#set -g pane-border-bg color81
#set -g pane-active-border-fg color163
#set -g pane-active-border-bg color230

## loud or quiet?
#set -g visual-activity off
#set -g visual-bell off
#set -g visual-silence off
#setw -g monitor-activity off
#set -g bell-action none

##  modes
#setw -g clock-mode-colour colour5
#setw -g mode-style 'fg=colour1 bg=colour18 bold'

## panes
#set -g pane-border-style 'fg=colour19 bg=colour0'
#set -g pane-active-border-style 'bg=colour0 fg=colour9'

## statusbar
#set -g status-position bottom
#set -g status-justify left
#set -g status-style 'bg=colour18 fg=colour137 dim'
#set -g status-left ''
#set -g status-right '#[fg=colour233,bg=colour19] %d/%m #[fg=colour233,bg=colour8] %H:%M:%S '
#set -g status-right-length 50
#set -g status-left-length 20

#setw -g window-status-current-style 'fg=colour1 bg=colour19 bold'
#setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '

#setw -g window-status-style 'fg=colour9 bg=colour18'
#setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '

#setw -g window-status-bell-style 'fg=colour255 bg=colour1 bold'

## messages
#set -g message-style 'fg=colour232 bg=colour16 bold'

# Tpipeline
set -g focus-events on
set -g status-style bg=default
set -g status-left-length 180
set -g status-right-length 180
set -g status-justify absolute-centre

# List of plugins.
# * Installing.
#   - Add new plugin to ~/.tmux.conf with set -g @plugin '...'.
#   - Press *prefix* + I (capital i, as in Install) to fetch the plugin.
#   - You're good to go! The plugin was cloned to ~/.tmux/plugins/ dir and sourced.

# * Uninstalling.
#   - Remove (or comment out) plugin from the list.
#   - Press *prefix* + alt + u (lowercase u as in uninstall) to remove the plugin.
#   - All the plugins are installed to ~/.tmux/plugins/ so alternatively you can find plugin directory there and remove it.

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

# Saving sessions across reboots.
set -g @plugin 'tmux-plugins/tmux-resurrect'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf).
run '~/.tmux/plugins/tpm/tpm'
vimpostor commented 2 years ago

I added the absolute-centre option only in tmux 3.2, for tmux 3.0 it is okay to use normal centre instead. Maybe some tmux options after this were ignored due to the error, so try again with set -g status-justify centre. Maybe that will fix the weird cut statusline.

If it still doesn't work after that, send the output of :echo tpipeline#debug#info()

DeadlySquad13 commented 2 years ago

I added the absolute-centre option only in tmux 3.2, for tmux 3.0 it is okay to use normal centre instead. Maybe some tmux options after this were ignored due to the error, so try again with set -g status-justify centre. Maybe that will fix the weird cut statusline.

If it still doesn't work after that, send the output of :echo tpipeline#debug#info()

Hi! Thanks for the attention to my issue! I changed to centre and tried to place tpipeline sets at the end of the config file just before the plugin list but after the theme plugin configurations. Unfortunately, it didn't help. Output of :echo tpipeline#debug#info(): image In text format:

{'right': [''], 'native_str': ' NORMAL  /home/dubuntus                                                                                                                                                                                   utf-
8     tmux   92%  284:1  ', 'left': ['#[fg=,bg=#EFE0B9]#[fg=#f9f5d7,bg=#7c6f64,bold] COMMAND #[fg=#7c6f64,bg=#ebdbb2,nobold]#[fg=#7c6f64,bg=#ebdbb2] /home/dubuntus #[fg=#7c6f64,bg=#ebdbb2]#[fg=#7c6f64,bg=#ebdbb2] utf-8 #[fg=#7c6f6
4,bg=#ebdbb2]  #[fg=#6d8086,bg=#ebdbb2] #[fg=#7c6f64,bg=#ebdbb2] tmux #[fg=#d5c4a1,bg=#ebdbb2]#[fg=#7c6f64,bg=#d5c4a1]  92% #[fg=#7c6f64,bg=#d5c4a1]#[fg=#f9f5d7,bg=#7c6f64,bold] 284:1  '], 'native_highlights': [{'group': 'lualine_a_n
ormal', 'start': 0}, {'group': 'lualine_transitional_lualine_a_normal_to_lualine_c_normal', 'start': 8}, {'group': 'lualine_c_normal', 'start': 11}, {'group': 'lualine_c_normal', 'start': 27}, {'group': 'lualine_c_normal', 'start': 204},
{'group': 'lualine_c_normal', 'start': 214}, {'group': 'lualine_x_filetype_DevIconConf_normal', 'start': 222}, {'group': 'lualine_c_normal', 'start': 226}, {'group': 'lualine_transitional_lualine_b_normal_to_lualine_c_normal', 'start': 23
2}, {'group': 'lualine_b_normal', 'start': 235}, {'group': 'lualine_transitional_lualine_a_normal_to_lualine_b_normal', 'start': 241}, {'group': 'lualine_a_normal', 'start': 244}]}
vimpostor commented 2 years ago

Very interesting, I can't reproduce this unfortunately.

Can you post the output of:

I think that should be enough for me to debug it.

DeadlySquad13 commented 2 years ago

Everything done with lualine+tpipeline. tpipeline sets were not changed after previous comment. Output of :echo luaeval("require'tpipeline.main'.update()"): image

#[fg=#f9f5d7,bg=#7c6f64,bold] NORMAL #[fg=#7c6f64,bg=#d5c4a1,nobold]юВ░#[fg=#7c6f64,bg=#d5c4a1] юВа nvim-theme юВ▒#[fg=#ffa500,bg=#d5c4a1] яФй 12 #[fg=#d5c4a1,bg=#ebdbb2]юВ░#[fg=#7c6f64,bg=#ebdbb2] /var/local/Backup/_dotfiles/stow_home/nvim/.config
/nvim/lua #[fg=#7c6f64,bg=#ebdbb2]#[fg=#7c6f64,bg=#ebdbb2] utf-8 юВ│#[fg=#7c6f64,bg=#ebdbb2] юЬТ юВ│#[fg=#51a0cf,bg=#ebdbb2] юШа#[fg=#7c6f64,bg=#ebdbb2] lua #[fg=#d5c4a1,bg=#ebdbb2]юВ▓#[fg=#7c6f64,bg=#d5c4a1]  55% #[fg=#7c6f64,bg=#d5c4a1]юВ▓#[fg=#f9f
5d7,bg=#7c6f64,bold] 350:5

Output of :echo nvim_eval_statusline(g:tpipeline_statusline, #{fillchar: g:tpipeline_fillchar, highlights: 1, maxwidth: g:tpipeline_size}): image

{'str': ' NORMAL юВ░ юВа nvim-theme юВ▒ яФй 12 юВ░ /var/local/Backup/_dotfiles/stow_home/nvim/.config/nvim/lua  utf-8 юВ│ юЬТ юВ│ юШа lua юВ▓  55% юВ▓ 350:5  ', 'highlights': [{'group': 'lualine_a_normal', 'start': 0}, {'group': 'lualine_transitional_lualine_a
_normal_to_lualine_b_normal', 'start': 8}, {'group': 'lualine_b_normal', 'start': 11}, {'group': 'lualine_b_diagnostics_warn_normal', 'start': 30}, {'group': 'lualine_transitional_lualine_b_diagnostics_warn_normal_to_lualine_c_normal', 's
tart': 38}, {'group': 'lualine_c_normal', 'start': 41}, {'group': 'lualine_c_normal', 'start': 102}, {'group': 'lualine_c_normal', 'start': 102}, {'group': 'lualine_c_normal', 'start': 112}, {'group': 'lualine_x_filetype_DevIconLua_normal
', 'start': 120}, {'group': 'lualine_c_normal', 'start': 124}, {'group': 'lualine_transitional_lualine_b_normal_to_lualine_c_normal', 'start': 129}, {'group': 'lualine_b_normal', 'start': 132}, {'group': 'lualine_transitional_lualine_a_no
rmal_to_lualine_b_normal', 'start': 138}, {'group': 'lualine_a_normal', 'start': 141}], 'width': 127}

Output of :echo g:tpipeline_size: image

0
vimpostor commented 2 years ago

Output of :echo g:tpipeline_size:

0

OK, this is weird, apparently tmux display-message -p '#{window_width}' returns 0 for you (can you check this?). Is tmux not in your normal PATH or something?

DeadlySquad13 commented 2 years ago

Output of :echo g:tpipeline_size:

0

OK, this is weird, apparently tmux display-message -p '#{window_width}' returns 0 for you (can you check this?). Is tmux not > in your normal PATH or something?

It returns nonzero value: image

Regarding PATH, I don't remember how I installed tmux but everything seems fine: image

> which tmux
/usr/bin/tmux
> echo $PATH
/home/dubuntus/.local/bin:/home/dubuntus/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/dubuntus/.npm-global/bin:/home/dubuntus/.local/bin:/home/dubuntus/go/bin:/usr/local/go/bin:/mnt/c/ProgramData/Microsoft/Windows/Start Menu/Programs:/mnt/c/Program Files (x86)/XYplorer:/mnt/c/ProgramData/WslProgramData
vimpostor commented 2 years ago

Very weird, try to see what is returned by :echo(str2nr(system("tmux display-message -p '#{window_width}'"))). Maybe also try au VimResized * echom(str2nr(system("tmux display-message -p '#{window_width}'"))), then resize tmux or vim a few times, and check if you ever see the number 0 in :messages

DeadlySquad13 commented 2 years ago

echo(str2nr(system("tmux display-message -p '#{window_width}'")))

yes, it returns 0. image

Though if I run the same command from tmux when vim is on screen I get the same number as in console: image image

vimpostor commented 2 years ago

What if you open a shell in neovim with :terminal and run tmux display-message -p '#{window_width}' there? Does :!tmux display-message -p '\#{window_width}' show any error?

DeadlySquad13 commented 2 years ago

What if you open a shell in neovim with :terminal and run tmux display-message -p '#{window_width}' there? Does :!tmux display-message -p '\#{window_width}' show any error?

From builtin shell I get normal result: image

:!tmux display-message -p '\#{window_width}' shows normal value: image

vimpostor commented 2 years ago

image

That's probably the problem. Do you know where the Agent pid 17835 output comes from?

It should work now though, I added a workaround.

DeadlySquad13 commented 2 years ago

image

That's probably the problem. Do you know where the Agent pid 17835 output comes from?

It should work now though, I added a workaround.

Thank you very much, it now works! This ouput comes from my bashrc:

# Enable ssh authentication agent (for ssh-add).
eval `ssh-agent -s`

Sorry this little tweak caused a lot of problems, I could have never guessed it's a culprit.