vimpostor / vim-tpipeline

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

right-status not showing up with manual embed #24

Closed yamatsum closed 2 years ago

yamatsum commented 2 years ago

https://github.com/neovim/neovim/issues/9342

vimpostor commented 2 years ago

What exactly do you mean with global statusline support?

Neovim's global statusline and this plugin are orthogonal. This plugin already provides a global statusline, it lives in the tmux statusline. What in particular do you envision when you mean supporting global statusline?

yamatsum commented 2 years ago

in plugin.lua

vim.g.tpipeline_autoembed = 0

tmux.conf

set -g status-left '#(cat #{socket_path}-\#{session_id}-vimbridge)'
set -g status-left-length 90
set -g status-right "#(cat #{socket_path}-\#{session_id}-vimbridge-R) #[fg=#6a737d]#{?client_prefix,#[fg=#316DCA],}□"
set -g status-right-length 90

In the case of the above settings, tmux statusline will be as follows.

CleanShot 2022-04-22 at 18 22 54@2x

But to the right of the real vim statuline is showing git branch information

CleanShot 2022-04-22 at 18 21 19@2x

Maybe the global status line doesn't matter. statsline on the nvim side is set using lualine.

require("lualine").setup({
  options = {
    globalstatus = true,
  },
  sections = {
    lualine_a = {
      {
        "mode",
      },
    },
    lualine_b = {
      {
        "filename",
      },
    },
    lualine_c = {},
    lualine_x = {},
    lualine_y = {},
    lualine_z = {
      {
        "branch",
      },
    },
  },
})
vimpostor commented 2 years ago

I tried your config, but I cannot reproduce unfortunately, it works for me:

Screenshot_20220422_133528

What version of neovim are you using? Can you perhaps provide more detailed steps on how to reproduce this? Maybe I need your entire vim config to reproduce this.

vimpostor commented 2 years ago

Oh I forgot to use your manual embed step, I can reproduce now. In your set -g status-right command you are using double quotes ", but you need to use single quotes ' like the documentation says, or alternatively escape problematic characters.

-set -g status-right "#(cat #{socket_path}-\#{session_id}-vimbridge-R) #[fg=#6a737d]#{?client_prefix,#[fg=#316DCA],}□"
+set -g status-right '#(cat #{socket_path}-\#{session_id}-vimbridge-R) #[fg=#6a737d]#{?client_prefix,#[fg=#316DCA],}□'

So the issue has nothing to do with global statusline, you are just missing the entire right part of the statusline due to using a misconfigured status-right.

yamatsum commented 2 years ago

It was my mistake! Thank you!

vimpostor commented 2 years ago

On a related note, I don't understand why all these statuslines like lualine add their own globalstatus option, when they can just use the official laststatus = 3 option. When you go look at the PR that supposedly implements "global statusline" support for lualine and take a look at the code, then you will see that all it does is set laststatus to 3 if globalstatus is true, which is ridiculous, since the user could just directly set laststatus.