romkatv/powerlevel10k

No such file or directory: powerlevel10k.zsh-theme

Closed this issue · 7 comments

I'm getting the following error when logging into a terminal session: /home/someone/.config/zsh//.zshrc:source:38: no such file or directory: plugins/powerlevel10k/powerlevel10k.zsh-theme.

Here's my ~/.config/zsh/.zshrc file:

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh//.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi


# ======= SUGGESTIONS & COMPLETION =======

source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh # enable autosuggestions pluggin installed via `sudo apt-get install zsh-autosuggestions`

ZSH_AUTOSUGGEST_STRATEGY=(history completion) # enable auto-suggestiosn automatically, and prioritise looking up in hist…
bindkey '^ ' autosuggest-accept # use ctrl+space to accept suggestion…

zstyle :compinstall filename '~/.zshrc'
autoload -Uz compinit # necessary for autocompletion preview to work…
compinit

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#e18e7c" # change the suggestion font color…
# ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="bg=#eeeeee" # change the suggestion bg color

# ======= HISTORY =======

HISTFILE=~/.zsh_history # location of history file…
HISTSIZE=1000 # num commands stored in memory during active shell session…
SAVEHIST=10000 # num commands stored in history file…
setopt INC_APPEND_HISTORY # append commands to history incrementally…


# ======= SOUND =======

unsetopt BEEP # turn off all beep sounds…


# ======= THEME =======

source plugins/powerlevel10k/powerlevel10k.zsh-theme # simply git pull for update

# To customize prompt, run `p10k configure` or edit ~/.config/zsh//.p10k.zsh.
# [[ ! -f ~/.config/zsh//.p10k.zsh ]] || source ~/.config/zsh//.p10k.zsh

# To customize prompt, run `p10k configure` or edit ~/.config/zsh//.p10k.zsh.
[[ ! -f ~/.config/zsh//.p10k.zsh ]] || source ~/.config/zsh//.p10k.zsh

I will not show my ~/.config/zsh/.p10k.zsh file, because it is everlasting and I don't think it is relevant, but it does exist.

Interestingly, if I restart the configuration process by deleting that file, I will be asked the initialisation questions for the theme. Once I finish everything, the .p10k.zsh file is there once again, and the theme is applied.

Upon closing and reopening my terminal window, the theme disappears, and I get the error /home/someone/.config/zsh//.zshrc:source:38: no such file or directory: plugins/powerlevel10k/powerlevel10k.zsh-theme, as mentioned above.

How to make the application of my chosen theme permanent, and avoid the error I'm getting upon login?

Thank you.

Can you confirm the existence of /home/someone/.config/zsh/plugins/powerevel10k/powerlevel10k.zsh-theme?

If it's not there, do you know what is supposed to be supplying /home/someone/.config/zsh/plugins/powerevel10k?
I suspect that something went wrong in your application of https://github.com/romkatv/powerlevel10k?tab=readme-ov-file#installation. Could you tell us which installation procedure you followed?

Thank you for looking into this!

Can you confirm the existence of /home/someone/.config/zsh/plugins/powerevel10k/powerlevel10k.zsh-theme?

Yes, the file exists. I can cat it successfully and see its contents.

Could you tell us which installation procedure you followed?

I installed p10k manually by cloning the Git repo into my plugins directory and then appending a line in .zshrc to source powerlevel10k.zsh-theme upon login. (p10k happens to be the only Zsh plugin I have, right now.)

Also, I don't use any plugin managers, and have never installed one before. (I'm mentioning this because it eliminates the issue of the manual installation conflicting with a plugin manager.)

Could you try using the absolute path of the powerlevel10k.zsh-theme file instead of simply plugins/powerlevel10k/powerlevel10k.zsh-theme in your .zshrc?

I'm never quite confident when the system tells me that a file's not found and the path it's referring to is "incomplete" :)

Could you try using the absolute path of the powerlevel10k.zsh-theme file instead of simply plugins/powerlevel10k/powerlevel10k.zsh-theme in your .zshrc?

I changed both paths at the end of my .zshrc file for the absolute paths, replacing the tilde with the full /home/someone/...... I still get the same error upon login, unfortunately.

Actually, I find a bit curious the two back-to-back forward slashes (//), but I think your .zshrc fails before the last 2 paths that you just changed; I think this is the path that the shell is complaining about:

# ======= THEME =======

source plugins/powerlevel10k/powerlevel10k.zsh-theme # simply git pull for update

That one source command, line 38 (going by the content you've shared), might also benefit from using an absolute path to the powerlevel10k.zsh-theme.

It's time for me to get some rest, though, I'll check in again tomorrow ;)

I changed both paths at the end of my .zshrc file for the absolute paths, replacing the tilde [...]

Ah, I'm sorry, I'm not too sure whether you mean these (of which I reckon one to be superfluous):

# To customize prompt, run `p10k configure` or edit ~/.config/zsh//.p10k.zsh.
# [[ ! -f ~/.config/zsh//.p10k.zsh ]] || source ~/.config/zsh//.p10k.zsh

# To customize prompt, run `p10k configure` or edit ~/.config/zsh//.p10k.zsh.
[[ ! -f ~/.config/zsh//.p10k.zsh ]] || source ~/.config/zsh//.p10k.zsh

Or... one of these two above, as well as the one I was talking about:

source plugins/powerlevel10k/powerlevel10k.zsh-theme # simply git pull for update

I changed both paths at the end of my .zshrc file for the absolute paths, replacing the tilde [...]

Ah, I'm sorry, I'm not too sure whether you mean these (of which I reckon one to be superfluous):

# To customize prompt, run `p10k configure` or edit ~/.config/zsh//.p10k.zsh.
# [[ ! -f ~/.config/zsh//.p10k.zsh ]] || source ~/.config/zsh//.p10k.zsh

# To customize prompt, run `p10k configure` or edit ~/.config/zsh//.p10k.zsh.
[[ ! -f ~/.config/zsh//.p10k.zsh ]] || source ~/.config/zsh//.p10k.zsh

Or... one of these two above, as well as the one I was talking about:

source plugins/powerlevel10k/powerlevel10k.zsh-theme # simply git pull for update

No apologies, it's my bad. Yeah, that worked! Thanks so much for your help, I appreciate it.

Makes me wonder why the relative paths weren't working, but at least I know what to do if ever I end up with the same problem using other plugins.

Have a great rest of your week.