【问题标题】:Powerline in tmux not displaying segments on left side of status bartmux中的电力线不在状态栏左侧显示段
【发布时间】:2018-07-21 21:11:38
【问题描述】:

我想在 tmux 和 vim 中使用电力线扩展。在 vim 中它工作得很好,显示所有段以及 powerline-gitstatus(用于显示比 common.vcs.branch 段更多的 git 信息),但在 tmux 状态栏中,无法显示左侧的段在.config/powerline/themes/tmux/default.json 主题中配置的一侧。 我的主题:

{
  "segments": {
    "left": [
      {
        "function":  "powerline.segments.common.env.cwd"
      },
      {
        "function": "powerline_gitstatus.gitstatus",
        "priority": 40
      },
      {
        "function": "powerline.segments.common.vcs.branch"
      }
    ],
    "right": [
      {
        "function": "powerline.segments.common.net.network_load"
      },
      {
        "function": "powerline.segments.common.sys.uptime",
        "priority": 50,
        "before": "UP: "
      },
      {
        "function": "powerlinemem.mem_usage.mem_usage_percent",
        "priority": 50,
        "args": {
          "format": "Mem: %d%%"
        }
      },
      {
        "function": "powerline.segments.common.sys.cpu_load_percent",
        "priority": 50,
        "before": "CPU: "
      },
      {
        "function": "powerline.segments.common.net.external_ip"
      }
    ]
  }
}

以及powerline tmux left的输出(符号显示正确):

#[fg=colour250,bg=colour240,nobold,noitalics,nounderscore] ~ 
#[fg=colour245,bg=colour240,nobold,noitalics,nounderscore] 
#[fg=colour250,bg=colour240,nobold,noitalics,nounderscore]Documents 
#[fg=colour245,bg=colour240,nobold,noitalics,nounderscore] 
#[fg=colour252,bg=colour240,bold,noitalics,nounderscore]gitTest 
#[fg=colour240,bg=colour236,nobold,noitalics,nounderscore] 
#[fg=colour247,bg=colour236,nobold,noitalics,nounderscore] No commits yet on master
#[fg=colour214,bg=colour236,nobold,noitalics,nounderscore] … 2 
#[fg=colour247,bg=colour236,nobold,noitalics,nounderscore] 
#[fg=colour250,bg=colour236,nobold,noitalics,nounderscore] master
#[fg=colour236,bg=default,nobold,noitalics,nounderscore]

以下是电源/状态行中显示的内容:

如您所见,左侧为段配置:当前工作目录、gitstatus 和分支。而问题是虽然powerline tmux left的输出看起来是正确的,但是却没有正确显示。状态栏右侧工作正常。

有没有人已经解决了这个问题?关于如何解决它的任何想法?

感谢您的意见。

【问题讨论】:

    标签: bash shell terminal tmux powerline


    【解决方案1】:

    您必须为status-left-length 设置更高的值。我可以清楚地看到cwd 段已被剪切。据我所知,默认 20 个字符。

    在~/.tmux.conf 中设置set -g status-left-length 20 在您的情况下看起来像

    如果您将其设置为更高的值

    如果你将它设置为一个更合理的值,比如 150,你会得到你需要的:

    但要小心。左侧或右侧的选定值将相互重叠并删除元素。或者不会像您的示例中那样显示。

    我目前对使用感到满意

    set -g status-left-length 150
    set -g status-right-length 180
    

    这取决于您的屏幕或窗口大小。

    此外,恕我直言,您的所有动态段(大小)都应保留在右侧,只有静态段应显示在左侧,以便在打开的选项卡上获得更清晰的视图。但这只是一种意见。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-06-15
      • 1970-01-01
      • 1970-01-01
      • 2016-03-07
      • 2012-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多