powerline-shell icon indicating copy to clipboard operation
powerline-shell copied to clipboard

Configuration not working on linux

Open Olshansk opened this issue 4 years ago • 16 comments

I managed to set everything up find with zsh on my macbook, but am having problems doing the same thing on my linux box. In the following image, I'm sshed into my linux box at the top and am locally on my macbook in the bottom. However, it doesn't seem like the directory structure is being rendered correctly.

Screen Shot 2020-02-03 at 6 28 27 PM

Olshansk avatar Feb 04 '20 02:02 Olshansk

@b-ryan Any suggestions on what I should investigate or look into?

Olshansk avatar Feb 04 '20 17:02 Olshansk

Hm - what versions are you running on each machine? You can find this out with pip show powerline-shell (or potentially with pip2 or pip3).

b-ryan avatar Feb 04 '20 17:02 b-ryan

Version 0.7.0 with python 3.8 on both machines.

Olshansk avatar Feb 04 '20 17:02 Olshansk

I don't suppose you have a configuration file in another location on either machine do you? The code looks for a config in this order:

  • powerline-shell.json within the current directory
  • ~/.powerline-shell.json
  • Then the one you have in each screenshot

b-ryan avatar Feb 04 '20 17:02 b-ryan

No, that's the only find.

I ran a find on my root directory to look for similar things but it found nothing.

The weird thing is that the directories don't seem to be getting parsed on my linux box either.

Olshansk avatar Feb 04 '20 17:02 Olshansk

I saw that the directory is the same in both screenshots. Are you saying that's a mistake too?

b-ryan avatar Feb 04 '20 17:02 b-ryan

On the bottom (mac), I see two "strings": workspace -> temp.

On the top (linux), I see one "string": ~/workspace/temp.

Could this be a sign of a different issue?

Olshansk avatar Feb 04 '20 17:02 Olshansk

That's why I had asked about configurations. You should only see ~/workspace/temp as one string rather than broken out when you have the plain option set for the cwd segment. In the configuration that looks like:

  "cwd": {
    "mode": "plain",
  }

So I am a little stumped as to why it would be doing that without having found configuration somewhere else.

Can you post the contents of the bashrc or zshrc for the linux machine which show the configuration?

b-ryan avatar Feb 04 '20 18:02 b-ryan

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

UNAME=$(uname | tr "[:upper:]" "[:lower:]")

# Path to your oh-my-zsh installation.
if [ "$UNAME" != "linux" ]; then
    export ZSH="/Users/olshansky/.oh-my-zsh"
else
    export ZSH="/usr/local/home/olshansky/.oh-my-zsh"
fi

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="agnoster" # Was robbyrussell before

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS=true

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
  git
  bundler
  dotenv
  osx
  rake
  rbenv
  ruby
  zsh-syntax-highlighting
  zsh-autosuggestions
)

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Enable bash completions in zsh
autoload -U bashcompinit
bashcompinit

# Follower instructions here (https://github.com/b-ryan/powerline-shell#zsh) to setup powerline-shell
function powerline_precmd() {
   PS1="$(powerline-shell --shell zsh $?)"
}
function install_powerline_precmd() {
  for s in "${precmd_functions[@]}"; do
    if [ "$s" = "powerline_precmd" ]; then
      return
    fi
  done
  precmd_functions+=(powerline_precmd)
}

if [ "$UNAME" = "linux" ]; then
    # Make pyenv work on linux
    export PYENV_ROOT="$HOME/.pyenv"
    export PATH="$PYENV_ROOT/bin:$PATH"
    if command -v pyenv 1>/dev/null 2>&1; then
	     eval "$(pyenv init -)"
    fi

    # Created by `userpath` on 2020-02-03 23:18:49
    export PATH="$PATH:/usr/local/home/olshansky/.local/bin"

    # If available, use LSB to identify distribution
    if [ -f /etc/lsb-release -o -d /etc/lsb-release.d ]; then
        export DISTRO=$(lsb_release -i | cut -d: -f2 | sed s/'^\t'//)
    # Otherwise, use release info file
    else
        export DISTRO=$(ls -d /etc/[A-Za-z]*[_-][rv]e[lr]* | grep -v "lsb" | cut -d'/' -f3 | cut -d'-' -f1 | cut -d'_' -f1)
    fi
fi

if [ "$UNAME" = "darwin" ]; then
    # For pkg-config to find readline you may need to set:
    export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"

    # For compilers to find readline you may need to set:
    export LDFLAGS="-L/usr/local/opt/readline/lib"
    export CPPFLAGS="-I/usr/local/opt/readline/include"

    # Created by `userpath` on 2020-01-30 21:49:44
    export PATH="$PATH:/Users/olshansky/.local/bin"

    # Powerline
    install_powerline_precmd
fi

# Enable pipx completions
eval "$(register-python-argcomplete pipx)"

# Needed to use pyenv for python management
eval "$(pyenv init -)"

# General aliases
alias reload="source ~/.zshrc"

# General functions
function hgrep() {
    history | grep $1
}

Olshansk avatar Feb 04 '20 18:02 Olshansk

I also ran sudo find / -name "*.json" | grep "powerline" to find anything that might resemble a powerline configs file, but the only one that comes up is ~/.config/powerline-shell/config.json.

Olshansk avatar Feb 04 '20 18:02 Olshansk

You have these lines:

    # Powerline
    install_powerline_precmd

Only running on Mac. I wonder if it would work if you took that out of the if or copied them into the linux section.

b-ryan avatar Feb 04 '20 18:02 b-ryan

That worked! Should've tried it myself...

Olshansk avatar Feb 04 '20 19:02 Olshansk

Does this mean we should potentially remove the following section from https://github.com/b-ryan/powerline-shell#zsh?

if [ "$TERM" != "linux" ]; then
    install_powerline_precmd
fi

Olshansk avatar Feb 04 '20 19:02 Olshansk

This issue specifically is resolved, but it seems like linux users need to run install_powerline_precmd given my experience. I can update the docs, but don't have another linux machine to verify first.

Olshansk avatar Feb 05 '20 17:02 Olshansk

Yeah that does look like a mistake. I don't think the install_powerline_precmd is mac-specific, it's zsh-specific.

b-ryan avatar Feb 05 '20 17:02 b-ryan

https://github.com/b-ryan/powerline-shell/pull/488

Olshansk avatar Feb 05 '20 21:02 Olshansk