agnoster / agnoster-zsh-theme

A ZSH theme designed to disclose information contextually, with a powerline aesthetic
3.95k stars 583 forks source link

Use Agnoster Without Oh-My-ZSH #144

Closed blueray453 closed 4 years ago

blueray453 commented 4 years ago

I am using Linux Mint 19.3

Here is my .zshrc file:

# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/ismail/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall

# not just at the end
# py3[TAB] result in Python3
# cat /var/l[TAB]/syslog result in `/var/l[TSB]/syslog` 
setopt completeinword

# Auto Correction
setopt correct # If you type `shs scott@localhost`[Enter] it will give you [nyae]. y will result in `ssh scott@localhost`

# Do Not Write (>) To Existing File. Give Warning. You can append (>>) though.
# setopt noclobber

setopt autocd # You don't have to put `cd` to change directory. Just put `/etc`, `Documents` etc.

########## History Start ##########

setopt EXTENDED_HISTORY
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt INC_APPEND_HISTORY # following should be turned off, if sharing history via setopt SHARE_HISTORY

setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_VERIFY # Don't execute immediately upon history expansion.

########## History End ##########

########## Customize Prompt Start ##########

source ~/agnoster.zsh-theme

echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699" also works.

My prompt shows $(prompt_agnoster_main), no color.

What can I do?

vpcano commented 4 years ago

Same issue

vpcano commented 4 years ago

It seems like zsh doesn't like single quotes. Just solved it by replacing them with double quotes in the line 156 of agnoster.zsh-theme:

PROMPT="%{%f%b%k}$(prompt_agnoster_main) "
apjanke commented 4 years ago

zsh likes single quotes just fine, but they have a different meaning from double quotes: $ variable references inside single quotes are not expanded. Which means if you use single quotes here, it prevents the evaluation of $(prompt_agnoster_main), which isn't the intent here.

vpcano commented 4 years ago

Nice! Thx for the explanation. What I don't understand is why it works with single quotes when sourcing through omz but not when sourcing directly in .zshrc

apjanke commented 4 years ago

I'm going to guess that it's something to do with the prompt_subst shell option and how it's being set.