Improved startup performance and switched pkg managers
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
plugins=(
|
||||
git
|
||||
docker
|
||||
zsh-completions
|
||||
asdf
|
||||
aws
|
||||
zsh-syntax-highlighting
|
||||
zsh-autosuggestions
|
||||
)
|
||||
autoload -U compinit && compinit
|
||||
fpath=($fpath ~/.zsh/completion)
|
||||
|
||||
DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# History
|
||||
@@ -37,19 +38,17 @@ title() { export TITLE_OVERRIDDEN=1; echo -en "\e]0;$*\a"}
|
||||
autotitle() { export TITLE_OVERRIDDEN=0 }; autotitle
|
||||
# Condition checking if title is overridden
|
||||
overridden() { [[ $TITLE_OVERRIDDEN == 1 ]]; }
|
||||
# Echo asterisk if git state is dirty
|
||||
gitDirty() { [[ $(git status 2> /dev/null | grep -o '\w\+' | tail -n1) != ("clean"|"") ]] && echo "*" }
|
||||
|
||||
# Show cwd when shell prompts for input.
|
||||
precmd() {
|
||||
if overridden; then return; fi
|
||||
pwd=$(pwd) # Store full path as variable
|
||||
cwd=${pwd##*/} # Extract current working dir only
|
||||
print -Pn "\e]0;$cwd$(gitDirty)\a" # Replace with $pwd to show full path
|
||||
print -Pn "\e]0;$cwd\a" # Replace with $pwd to show full path
|
||||
}
|
||||
|
||||
# Prepend command (w/o arguments) to cwd while waiting for command to complete.
|
||||
preexec() {
|
||||
if overridden; then return; fi
|
||||
printf "\033]0;%s\a" "${1%% *} | $cwd$(gitDirty)" # Omit construct from $1 to show args
|
||||
printf "\033]0;%s\a" "${1%% *} | $cwd" # Omit construct from $1 to show args
|
||||
}
|
||||
|
@@ -1,23 +0,0 @@
|
||||
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
load-nvmrc() {
|
||||
local node_version="$(nvm version)"
|
||||
local nvmrc_path="$(nvm_find_nvmrc)"
|
||||
|
||||
if [ -n "$nvmrc_path" ]; then
|
||||
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
|
||||
|
||||
if [ "$nvmrc_node_version" = "N/A" ]; then
|
||||
nvm install
|
||||
elif [ "$nvmrc_node_version" != "$node_version" ]; then
|
||||
nvm use
|
||||
fi
|
||||
elif [ "$node_version" != "$(nvm version default)" ]; then
|
||||
echo "Reverting to nvm default version"
|
||||
nvm use 4 #default
|
||||
fi
|
||||
}
|
||||
add-zsh-hook chpwd load-nvmrc
|
||||
load-nvmrc
|
Reference in New Issue
Block a user