typewritten: Color Mapping error

After installation through npm, I’m getting this error

/usr/lib/node_modules/typewritten/lib/colors.zsh:1: no matches found: [foreground]=default
prompt_typewritten_setup:37: division by zero

And the default prompt for zsh is used instead.

I’ve encountered this problem on two of my machines, both running Ubuntu 18.04.

$ zsh --version
zsh 5.4.2 (x86_64-ubuntu-linux-gnu)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

I don’t know Zsh syntax but changing the associative array declaration to this worked for me.

declare -A color_mappings=( 
"foreground" "default"
"primary" "magenta"
"secondary" "blue"

"accent" "default"

"info_positive" "green"
"info_negative" "red"

"info_neutral_1" "yellow"
"info_neutral_2" "blue"

"info_special" "cyan"
)

Hi @ninja18 !

Were you having the same errors? What does your setup looks like? Ubuntu as well?

Thank you for trying other options btw! Your snippet is also right zsh syntax, and could be more compatible than what I have there, right now.

Could you make a PR with these changes? Syntax can be discussed there

I’ll keep digging and I’ll lyk if I find anything!

@huy-ha I tried using your .zshrc and got it running no problem. I’m not on Linux, though.

I’ll try the manual install on a docker ubuntu image to see if anything pops up.

So I actually got it working on 2 of my machines, but not the other 3 (I just tried on another one) with the same zshrc. They are all running Ubuntu 18.04.

# From .bashrc

PATH=/usr/local/cuda/bin:$PATH
LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

PATH=$HOME/go/bin:$PATH
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_COMMAND='ag -g ""'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
alias vim='nvim'

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

# Path to your oh-my-zsh installation.
export ZSH="/home/huy/.oh-my-zsh"

# 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=""


# 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 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"


# Set fzf installation directory path
export FZF_BASE=/home/huy/.fzf/

# Uncomment the following line to disable fuzzy completion
# export DISABLE_FZF_AUTO_COMPLETION="true"

# Uncomment the following line to disable key bindings (CTRL-T, CTRL-R, ALT-C)
# export DISABLE_FZF_KEY_BINDINGS="true"


# Which plugins would you like to load?
# Add wisely, as too many plugins slow down shell startup.
plugins=(
    git 
    nvm
    zsh-syntax-highlighting
    zsh-autosuggestions
    fzf
)

__git_files () { 
    _wanted files expl 'local files' _files     
}

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='nvim'
else
  export EDITOR='nvim'
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"

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/huy/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/huy/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/home/huy/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/huy/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

fpath+=$HOME/.zsh/typewritten
autoload -U promptinit; promptinit
prompt typewritten
TYPEWRITTEN_CURSOR="beam"

On the machine I created this issue on, there were permission errors when I first tried doing npm install (installed with zsh’s nvm), so I used sudo [path to npm] install -g typewritten. I’ve also tried the manual installation and oh-my-zsh installation then changing the theme in zshrc to typewritten, but they give the same error.

/home/huy/.oh-my-zsh/custom/themes/typewritten/lib/colors.zsh:1: no matches found: [foreground]=default
/home/huy/.oh-my-zsh/custom/themes/typewritten.zsh-theme:37: bad math expression: operand expected at `%m%# '