From 3335b8fd826f5bc309f6e26371a5878fa80373f6 Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Mon, 26 Jul 2021 04:40:27 +0100 Subject: [PATCH] Improved startup performance and switched pkg managers --- .dotfiles/1-zsh | 13 ++++++------- .dotfiles/node | 23 ----------------------- .tool-versions | 3 +++ Makefile | 14 ++++++++++++-- 4 files changed, 21 insertions(+), 32 deletions(-) delete mode 100644 .dotfiles/node create mode 100644 .tool-versions diff --git a/.dotfiles/1-zsh b/.dotfiles/1-zsh index 3b5ef29..aea9261 100644 --- a/.dotfiles/1-zsh +++ b/.dotfiles/1-zsh @@ -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 } diff --git a/.dotfiles/node b/.dotfiles/node deleted file mode 100644 index 7892cf9..0000000 --- a/.dotfiles/node +++ /dev/null @@ -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 diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..7458ec9 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,3 @@ +nodejs 16.5.0 +golang 1.16.2 +kubectl 1.21.2 diff --git a/Makefile b/Makefile index 557cc9e..2daf47f 100644 --- a/Makefile +++ b/Makefile @@ -36,8 +36,16 @@ pre-reqs: ## Install all required binaries. which btm > /dev/null || cargo install bottom; \ which procs > /dev/null || brew install procs; \ which dog > /dev/null || brew install dog; \ + which asdf > /dev/null || brew install asdf; \ + brew install gpg gawk coreutils; \ git clone https://github.com/zsh-users/zsh-autosuggestions $${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions; \ - git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting; + git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting; \ + asdf plugin add nodejs; \ + asdf plugin add ruby; \ + asdf plugin-add kubectl https://github.com/asdf-community/asdf-kubectl.git; \ + RUST_WITHOUT=rust-docs asdf plugin-add rust https://github.com/asdf-community/asdf-rust.git; \ + asdf plugin-add golang https://github.com/kennyp/asdf-golang.git; \ + asdf install 1> /dev/null; .PHONY: upgrade upgrade: ## Upgrade all required binaries. @@ -70,8 +78,10 @@ upgrade: ## Upgrade all required binaries. which btm > /dev/null && cargo install bottom; \ which procs > /dev/null && brew upgrade procs; \ which dog > /dev/null && brew upgrade dog; \ + which asdf > /dev/null && brew upgrade asdf; \ cd $${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && git pull && cd -; \ - cd $${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting && git pull && cd -; + cd $${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting && git pull && cd -; \ + asdf plugin update --all; .PHONY: dotfiles dotfiles: ## Installs the dotfiles.