Powerline: Bash Powerline没有显示git分支信息,但是vi正常工作。

创建于 2013-02-07  ·  20评论  ·  资料来源: powerline/powerline

Screen Shot 2013-02-06 at 5 35 17 PM
但是如果我执行vi set.py,我会看到git branch信息
Screen Shot 2013-02-06 at 5 36 12 PM

在我的vimrc中,我有以下内容
。 /用户/ felix /个性化/电源线/电源线/绑定/bash/powerline.sh

在OSX 10.8.2上每晚运行iterm2 1.0.0.20130204-

如果有人可以告诉我如何将服务器信息添加到提示中,那也很好。

cshell sconfiguration error bug

最有用的评论

对于谷歌的人:

mkdir -p ~/.config/powerline
cat <<-'EOF' > ~/.config/powerline/config.json
{
    "ext": {
        "shell": {
            "theme": "default_leftonly"
        }
    }
}
EOF
powerline-daemon --replace 

这有效,因为配置已合并

所有20条评论

您必须在用户配置中启用default_leftonly主题。

我试图这样做,但我不知道如何“更改我的用户配置” :(
我正在使用来自源的电力线(执行“ pip install --user -e / home / daniel / workspace / powerline”并添加“。/home/daniel/workspace/powerline/powerline/bindings/bash/powerline.sh”) 。

我应该怎么做才能在提示符下获得git branch?

哇,我刚刚阅读了文档(https://powerline.readthedocs.org/en/latest/configuration.html)并理解了! (对上述评论:S感到抱歉)

@danieltdt说明文件令人困惑。 我不知道要更改哪个文件(以及要更改的文件)

@DanielGGordon修改主config.json或进行本地复制(放入〜/ .config / powerline),然后将shell-> theme从“ _default_”更改为“ _default_leftonly_”

谢谢!

我已经执行了所有步骤,但是在Fedora 23上仍然存在此问题:
随pip2(python 2.7.10)一起安装的powerline-status(2.3)
同时拥有python2和python3的pygit2(0.22.1)
在〜/ .config / powerline / config.json中创建的用户配置有效,因为我可以看到它应用了colorscheme。 但是git仍然不起作用

{
  "common": {
    "term_truecolor": false
  },
  "ext": {
    "ipython": {
      "colorscheme": "default",
      "theme": "in",
      "local_themes": {
        "rewrite": "rewrite",
        "out": "out",
        "in2": "in2"
      }
    },
    "shell": {
      "colorscheme": "solarized",
      "theme": "default_leftonly",
      "local_themes": {
        "continuation": "continuation",
        "select": "select"
      }
    },
    "tmux": {
      "colorscheme": "default",
      "theme": "default"
    }
  }
}

在电力线中编辑主配置.json安装root / config_files-仍然没有。

对于谷歌的人:

mkdir -p ~/.config/powerline
cat <<-'EOF' > ~/.config/powerline/config.json
{
    "ext": {
        "shell": {
            "theme": "default_leftonly"
        }
    }
}
EOF
powerline-daemon --replace 

这有效,因为配置已合并

我同意定制文档既冗长又令人困惑。 我仍然不知道powerline_root在哪里。

@xenithorb为我工作顺便说一句^^

您是说那里有一个主config.json吗? 而~/.config/powerline/config.json会覆盖匹配的键?

我正在阅读的文档似乎并没有有效地教育json模式

谷歌搜索更多信息后,我在网站上发现了某种语言。 我认为这是应该使用户开始使用基本/默认值的方式。 然后可以根据需要进行编辑

我碰巧用pip --user安装,所以我的位在〜/ .local /中,

注意:〜/ .local / lib /python3.5/ site-packages / ...路径中的变量取决于系统配置

mkdir -p ~/.config/powerline && cp -R ~/.local/lib/python3.5/site-packages/powerline/config_files/* ~/.config/powerline/ && cd ~/.config/powerline && ls -alF --color=auto
然后如@xenithorb所述,将`〜/ .config / powerline / config.json``ext` =>`shell` =>`theme`的值从default修改为default_leftonly,例如:
 {
 “普通”:{
 “ term_truecolor”:否
 },
 “ ext”:{
 “ ipython”:{
 “ colorscheme”:“默认”,
 “ theme”:“ in”,
 “ local_themes”:{
 “ rewrite”:“重写”,
 “ out”:“ out”,
 “ in2”:“ in2”
 }
 },
 “ pdb”:{
 “ colorscheme”:“默认”,
 “ theme”:“默认”
 },
 “贝壳”: {
 “ colorscheme”:“默认”,
 “ theme”:“ default_leftonly ”,
 “ local_themes”:{
 “ continuation”:“ continuation”,
 “选择”:“选择”
 }
 },
 “ tmux”:{
 “ colorscheme”:“默认”,
 “ theme”:“默认”
 },
 “ vim”:{
 “ colorscheme”:“默认”,
 “ theme”:“默认”,
 “ local_themes”:{
 “ __tabline__”:“表格”,

 “ cmdwin”:“ cmdwin”,
 “ help”:“帮助”,
 “ quickfix”:“快速修正”,

 “ powerline.matchers.vim.plugin.nerdtree.nerdtree”:“ plugin_nerdtree”,
 “ powerline.matchers.vim.plugin.commandt.commandt”:“ plugin_commandt”,
 “ powerline.matchers.vim.plugin.gundo.gundo”:“ plugin_gundo”,
 “ powerline.matchers.vim.plugin.gundo.gundo_preview”:“ plugin_gundo-preview”
 }
 },
 “ wm”:{
 “ colorscheme”:“默认”,
 “ theme”:“默认”
 }
 }
 }

同样Note:如果守护程序正在运行,则在停止或重新启动守护程序之前,将不会对~/.config/powerline/*文件所做的更改生效。 检查守护程序是否正在使用ps aux | grep powerline ,无论哪种方式,都可以使用powerline-daemon --replace启动/重新启动守护程序。

这是我需要的命令。

powerline-daemon --replace

谢谢@xenithorb

你好

有没有办法获得有关git的更多信息。 我想知道是否:

  • 我的仓库需要一些承诺。
  • 我的git需要推到原点。

我已经看到了这个https://github.com/jaspernbrouwer/powerline-gitstatus#installation ,我想知道在电力线中是否已经存在这样的东西?

不,您需要使用提到的第三方模块。

Archlinux Bash电力线

一切都在官方文档中详细

安装命令

$ pacman -S powerline powerline-fonts

创建每个用户的配置文件夹

$ mkdir -p ~/.config/powerline/

复制配置文件

$ cp /usr/lib/python3.6/site-packages/powerline/config_files/config.json ~/.config/powerline

python版本可能会更改。 检查您的本地路径,看看它是否与我的匹配。
注意:对于我们来说,Arch用户,电力线文档中powerline_root段与该路径相对应。 值得一提。

改变主题

您必须将ext.shell.theme属性从default更改default_left_only

{
  ...
    "ext": {
    ...
        "shell": {
            "colorscheme": "default",
            "theme": "default_leftonly",
            "local_themes": {
                "continuation": "continuation",
                "select": "select"
            }
        },
    ...
    }
}

应用变更

powerline-daemon --replace

或者只是关闭并打开一个新的外壳。

具有Git状态的Bash Powerline-深度Linux 15

(Debian和Ubuntu应该以相同的方式工作)

image - Deepin Linux Bash Powerline Git Status

TL; DR

pip install powerline-status

wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf

# NOTE: adjust fonts paths properly!
mv PowerlineSymbols.otf /usr/share/fonts/

fc-cache -vf /usr/share/fonts/

mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/

# add this to your .bashrc
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. {powerline-installation-dir}/bindings/bash/powerline.sh

mkdir -p ~/.config/powerline
# NOTE: adjust your {powerline-installation-dir} properly!
cp /{powerline-installation-dir}/config_files/config.json ~/.config/powerline

# edit ~/.config/powerline/config.json to see git status and branch name in prompt
    { ...
         "theme": "default_leftonly",
      ... 
    }

# edit "def __call_()" function in vcs.py (may require sudo)
# vcs.py location --> /{powerline-installation-dir}/segments/common/vcs.py
# change "status_colors=False" --> status_colors=True
# change "ignore_statuses=()" --> ignore_statuses=(["U"]) to ignore untracked files
def __call__(self, pl, segment_info, create_watcher, status_colors=True, ignore_statuses=()):

# FINISH! APPLY CHANGES!
powerline-daemon --replace

需要更多细节吗? ->要点-针对Deepin Linux(Debian / Ubuntu)打击Powerline的10个步骤

需要更多细节吗? ->官方文件

除了powerline之外,如果您想在终端中显示git提示符,还应该添加pip install powerline-gitstatus 。 我还针对您的问题在Medium上找到了有用的帖子。 尽管本教程基于macOS,但我已经在Ubuntu18.04上测试了他的方法,并且有效! 希望这会帮助你。

我在Ubuntu 18.04中用apt install安装powerline-gitstatus时遇到问题,也许该存储库不再维护。 我没有尝试用pip安装它。

另一件事...在我的.bashrc文件中,我仅添加了:

if [ -f /usr/share/powerline/bindings/bash/powerline.sh ]; then
source /usr/share/powerline/bindings/bash/powerline.sh
fi

与守护程序和以下内容无关:

powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1

我的问题是:
-是否也必须将这些行添加到我的.bashrc文件中?
-我应该apt remove powerline并与pip吗?

另一件事...在我的.bashrc文件中,我仅添加了:

if [ -f /usr/share/powerline/bindings/bash/powerline.sh ]; then
source /usr/share/powerline/bindings/bash/powerline.sh
fi

与守护程序和以下内容无关:

powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1

我的问题是:
-是否也必须将这些行添加到我的.bashrc文件中?
-我应该apt remove powerline并与pip吗?

我使用pip3安装了Powerline-status:

pip3 install powerline-status
pip3 install powerline-gitstatus

创建了以下目录:

~/.config/powerline
~/.config/powerline/themes/shell
~/.config/powerline/colorschemes

并根据以上各种注释创建了这些文件:

~/.config/powerline/colorschemes/default.json
~/.config/powerline/themes/shell/default.json
~/.config/powerline/config.json

如上查询,将这些行添加到〜/ .bashrc中:

# Powerline startup
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
source {{ powerline_location.stdout }}/powerline/bindings/bash/powerline.sh

请注意,最后一行包含一个变量,因为我是通过Ansible完成所有这些操作的。

现在我的Konsole看起来像这样:

powerline

我也使用Ansible安装Powerline修补字体,但这不在此问题的范围内。

此页面是否有帮助?
0 / 5 - 0 等级