Local oh-my-zsh zshrc file cannot be linked
louisch opened this issue · 6 comments
I'm trying to link the default oh-my-zsh zshrc with fresh
, but it's not creating the symbolic link in $HOME
.
I download oh-my-zsh and move the given .zshrc
file to ~/.dotfiles/zshrc
(so it's removed from $HOME
). The file looks like this:
# 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/louis/.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/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
# 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 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)
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"
Then I run fresh zshrc --file
I expect it to create the symlink $HOME/.zshrc
, but no such file appears in my home directory.
Testing that command with an empty zshrc
in dotfiles seems to work as expected, however. (Also, other files like tmux.conf
or gitconfig
work fine too)
Hi there. Hmm. I am not sure what’s going on here and haven’t been able to reproduce the issue. Can you paste your ~/.freshrc
file along with the output of find ~/.fresh/build*
? Are you seeing “Your dot files are now fresh.” each time you run fresh
? I can’t think of how the contents of ~/.dotfiles/zshrc
would affect whether the file links or not.
FYI I ran the following test with Docker and it seems to be working for me:
docker run -it --rm debian:stretch-slim
apt update && apt install -y git curl zsh
bash -c "`curl -sL https://get.freshshell.com`"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
mkdir ~/.dotfiles
mv ~/.zshrc ~/.dotfiles/zshrc
echo y | ~/bin/fresh zshrc --file
head ~/.zshrc
freshrc
# handles updating fresh
fresh freshshell/fresh bin/fresh --bin
DOTFILESDIR="$HOME/.dotfiles"
NEOVIMDIR="$HOME/.config/nvim"
if [[ -f "$HOME/.profile" && ! -L "$HOME/.profile" ]]; then
mv "$HOME/.profile" "$HOME/.dotfiles/.profile"
fi
fresh profile --file
# links your local ~/.dotfiles/gitconfig to ~/.gitconfig (you can change your local directory by setting $FRESH_LOCAL)
if [[ -f "$HOME/.gitconfig" && ! -L "$HOME/.gitconfig" ]]; then
mv "$HOME/.gitconfig" "$HOME/.dotfiles/gitconfig"
fi
fresh gitconfig --file
# TMUX
# Save history to file
fresh foobacca/dotfiles tmux/save-buffer-history --file=~/tmux.conf
fresh foobacca/dotfiles tmux/ctrl-a --file=~/tmux.conf
fresh foobacca/dotfiles tmux/vi --file=~/tmux.conf
fresh foobacca/dotfiles tmux/misc-bindings --file=~/tmux.conf
fresh tmux.conf --file
source "$DOTFILESDIR/zsh"
# source "$DOTFILESDIR/neovim"
$DOTFILESDIR/zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sed 's:env zsh -l::g' | sed 's:chsh -s .*$::g')"
find ~/.fresh/build*
/home/louis/.fresh/build.new
/home/louis/.fresh/build.new/shell.sh
/home/louis/.fresh/build.new/bin
/home/louis/.fresh/build.new/bin/fresh
Then I run
fresh zshrc --file
I just noticed this from your original post. That line belongs in your ~/.freshrc
. Then you can run fresh install
to link that (and anything else in your ~/.freshrc
).
Running fresh zshrc --file
should prompt to append fresh zshrc --file
into your ~/.freshrc
. The freshrc
file you’ve quoted does not have this line which would be a reason why it’s not creating the file.
What’s interesting here is that you have a build.new
directory but no build
directory in ~/.fresh
. This implies that the build is probably not completing. Are you seeing “Your dot files are now fresh.” when you run fresh
?
Looking at your freshrc
file, it seems like you are shelling out to install oh-my-zsh
directly in your freshrc
config file. This is not supported. If you really want to trigger external commands when you run fresh
, I’d suggest doing something like this instead in your freshrc
file (untested):
fresh_after_build() {
if ! [ -d ~/.oh-my-zsh/ ]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
fi
}
I'm running fresh zshrc --file
from the terminal for testing reasons, but if it should be inside the file, I'll give that a try next.
Never gave an update on this, but I'm pretty sure there was just something wrong with my zsh setup. On a fresh install this didn't happen.