Prezto theme not loading - zsh

I have the following line in my .zpreztorc file:
zstyle ':prezto:module:prompt' theme 'paradox'
And when I type prompt -c in my terminal it returns:
Current prompt theme is:
paradox
But the theme itself is not loaded. Only after I type run prompt paradox does the theme actually display. Is there anything else I need to add to any configuration file to make sure the theme actually loads when I start my terminal. I'm using iTerm2 and I already have powerline installed properly.

There have been issues in the past with presto's prompt setting; IMO it is best to add to the theme to your .zshrc:
promptinit
prompt paradox

if you are using prezto add
$ echo "prompt paradox" >> ~/.zshrc
$ source ~/.zshrc
if you are using yadr
$ echo "prompt paradox" >> ~/.zsh.after/prompt.zsh
$ source ~/.zshrc

Related

fzf keybindings doesn't work with zsh vi mode

fzf ctrl+r doesn't work anymore after I started to use zsh vi-mode. My zshrc file is here:
function zvm_config() {
ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT
ZVM_VI_INSERT_ESCAPE_BINDKEY=jk
}
source /opt/homebrew/opt/zplug/init.zsh
zplug "jeffreytse/zsh-vi-mode"
# Install plugins if there are plugins that have not been installed
if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
# Then, source plugins and add commands to $PATH
zplug load --verbose
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
If I separately run source ~/.fzf.zsh then it will work.
fzf keybindings seem to conflict with vi-mode. As mentioned here, Loading the fzf key bindings after loading the vi-mode plugin is one way to work around this issue. In my case, I was using oh-my-zsh and adding the fzf plugin after vi-mode in the plugins list fixed the issue.

zsh profile not working on Iterm2

I have installed oh-my-zsh and Iterm2 but when I change my theme to Agnoster nothing changes. Here's my .zshrc file:
export ZSH=/Users/{username}/.oh-my-zsh
ZSH_THEME="agnoster"
plugins=(
git
)
source $ZSH/oh-my-zsh.sh
But my Iterm2 terminal still looks the same
Edit: echo $SHELL outputs /bin/zsh

How to specify a custom path for my .zshrc file?

I'm trying to move .zshrc to a folder where I keep this kind of files synced with Github.
But now whenever I start a zsh session it doesn't use that config file.
Assuming I changed the file to ~/.dotfiles how can I add ~/.dotfiles/.zshrc to the PATH(?!) to make zsh start with that config?
Doing source ~./dotfiles/.zshrc only works for that session. Doesn't work anymore if I close the terminal.
You can symlink:
ln -s /path/to/original /path/to/symlink
For the zshrc you can do something like:
ln -s ~/.dotiles/.zshrc ~/.zshrc
One alternative to a symlink is to put this in ~/.zshenv:
ZDOTDIR=~/.dotfiles
If you want .zshenv in ~/.dotfiles as well, you can look into setting ZDOTDIR in one of the global configuration files (/etc/zshenv is a good choice).
Alternatively, you can do what I do and use GNU Stow. I've got my dotfiles in a repository, one subdirectory per category, like so:
dotfilerepo/zsh/.zshrc
dotfilerepo/zsh/.zlogin
dotfilerepo/git/.gitconfig
dotfilerepo/vim/.vimrc
then I can cd into repo and do stow zsh and it'll create a symlink from ~/.zshrc to repo/zsh/.zshrc, another from zsh/.zlogin to ~/.zlogin. stow vim to create symlinks from the vim subdirectory to ~, etc.
I've got a script, install-linkfarm, that does all the stow commands so when I move onto a new machine, I clone my repo, cd to it and run install-linkfarm and am good to go.
You can put this in ~/.zshrc, even as its entire contents:
if [ -r ~/.dotfiles/.zshrc ]; then
source ~/.dotfiles/.zshrc
fi
Please use the export command mentioned below to solve your problem.
export ZDOTDIR=$HOME/.dotfiles
In Linux, you can check if your zsh is loading /etc/zsh/zshrc, and edit it.
If that's the case, redirect this to your custom script by adding:
sh $HOME/.dotfiles/zshrc
Here is an interesting hack that doesn't require you to use sym-links.
In your .xsession, (or .*wmrc) have the following:
xterm -e 'zsh -c ". ~/.dotfiles/.zshrc; zsh"'.
instead of just:
xterm
Make sure to put the -e at the end after all of your other xterm options.

How can I fix not working oh-my-zsh plugins

I've just discovered oh-my-zsh, but I can't get it to work. While themes work just perfectly, plugins do not. I have some plugins selected, eg. macports, but neither I get port command completion nor do appropriate aliases work. Here's my ~/.zshrc:
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
export ZSH_THEME="steeef"
# Set to this to use case-sensitive completion
# export CASE_SENSITIVE="true"
# Comment this out to disable weekly auto-update checks
# export DISABLE_AUTO_UPDATE="true"
# Uncomment following line if you want to disable colors in ls
# export DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# export DISABLE_AUTO_TITLE="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git osx github macports textmate svn)
source $ZSH/oh-my-zsh.sh
# Customize to your needs...
export
PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin/:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/opt/local/bin:/opt/local/sbin
textmate and osx plugins also do not seem to work. zsh complains about unknown command and stops. git and svn have some basic completion but I'm not sure whether it's done by plugin or just a normal zsh completion. Do I have to export something to use those plugins? Or if not, what to do to have that fixed?
Make sure that you define your plugins variable before you initialize zsh:
plugins=(git wd)
export ZSH=/home/<user>/.oh-my-zsh
source $ZSH/oh-my-zsh.sh
I got bitten by this.
What happened is you did a manual install and the instructions for the manual install don't mention that you need to set the PATH yourself.
So you end up with the default PATH. The source for the automatic setup code copies your current path and appends it to the .zshrc, which isn't enough if you depend on non-standard PATH entries (e.g. you run Homebrew on a Mac).
So the fix is simple:
Fire up your old shell and its configuration file and then copy and paste the value of $PATH into the top of your ~/.zshrc file.
Ciao!
I had the same problem just now! There was a package called grml-zsh-config installed in my Archlinux. I removed this package and oh-my-zsh themes started to work.
In my case, in ~/.zshrc I had repeated plugins variable
plugins=(git)
.
.
.
plugins=(git autojump zsh-syntax-highlighting zsh-autosuggestions)
Check to see if this is the case with you because with this only your git plugin will be used.
Remove the first plugins variable and it should work.
I was running into this with the kubectl plugin.
Looking at the contents of ~/.oh-my-zsh/plugins/kubectl/kubectl.plugin.zsh I realized I didn't have the same content as what was on the github repo. Manually updating the file with the contents from the oh-my-zsh repo helped and the plugin started to work. Guess I had to update my oh-my-zsh installation to get the latest plugin content but this worked for me.
In my case,I forgot to add custom plugin name to .zshrc file:
plugins=(customPluginName)
And reload .zshrc:
source ~/.zshrc
make sure the folders of the plugins are located in the ~/.oh-my-zsh/custom/plugins folder. I will advise you are on this directory when you git clone the plugins.
Secondly ensure that you seperate the list of plugins in the ~/.zshrc file with a single space NOT comma.
.
.
.
plugin = (git zsh-syntax-highlighting)
.
.
.
So in the above example, two plugins are added there: git and zsh-syntax-highlighting.
If your .zshrc has this at the top
export ZSH="~/.oh-my-zsh"
try to changing it to:
export ZSH="$HOME/.oh-my-zsh"
Try manually source your plugins like this:
source ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
Full .zshrc example:
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(zsh-autosuggestions)
source ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh

Unix: Getting Export PATH to "Stick"

When setting the export path in Unix, example:
export PATH=$PATH: $EC2_HOME/bin
If I quit terminal and open it back up to continue working, I have to go through all the steps again, setting up the paths each time.
I'm wondering how I can set the path and have it "stick" so my system knows where to find everything the next time I open terminal without having to do it all over again.
Thanks!
Open ~/.bashrc. This file is loaded every time you start up a new shell (if you're using Bash, which most people are). If you're using a different shell, the file may have a different name, like ~/.shrc.
Add the line you need to the bottom of the file:
export PATH=$PATH:$EC2_HOME/bi
Other info rolled up from elsewhere in the thread:
There are multiple places to put this, depending on your shell and your needs. All of these files are in your home directory:
For Bash:
.bashrc (executed when you shart a shell)
OR
.bash_profile (executed when you log in)
For csh and tcsh:
.cshrc
For sh and ksh:
.profile
Add it to your .cshrc file (for csh and tcsh), .profile file (for sh and ksh), or .bash_profile file (for bash)
You need to find your profile file and put that line in there. Suppose you use bash, the profile files are .bashrc and .bash_profile, found in ~. These files will vary depending on which shell you use.
You have to put those commands into one of the "autostart" files of your shell.
For bash this would be .bashrc in your homedirectory (create it if necessary)
add it to your .bashrc or another .bash startup file.
... and for ksh edit .profile.

Resources