From f02b40074fa419915eb1a3ed4cfefd2b0d46ce26 Mon Sep 17 00:00:00 2001 From: George Rawlinson Date: Tue, 12 Nov 2019 17:38:59 +1300 Subject: [PATCH] refactor(zsh): deprecate usage of oh-my-zsh --- zsh/.config/oh-my-zsh/custom/android.zsh | 7 -- zsh/.config/oh-my-zsh/custom/archlinux.zsh | 24 ------- zsh/.config/oh-my-zsh/custom/docker.zsh | 2 - zsh/.config/oh-my-zsh/custom/exa.zsh | 6 -- zsh/.config/oh-my-zsh/custom/go.zsh | 5 -- zsh/.config/oh-my-zsh/custom/gpg.zsh | 13 ---- zsh/.config/oh-my-zsh/custom/man.zsh | 11 --- zsh/.config/oh-my-zsh/custom/npm.zsh | 15 ---- zsh/.config/oh-my-zsh/custom/nvim.zsh | 6 -- zsh/.config/oh-my-zsh/custom/python.zsh | 2 - zsh/.config/oh-my-zsh/custom/ruby.zsh | 3 - zsh/.config/oh-my-zsh/custom/rust.zsh | 2 - zsh/.config/oh-my-zsh/custom/tmux.zsh | 8 --- zsh/.config/oh-my-zsh/custom/weechat.zsh | 2 - zsh/.config/oh-my-zsh/custom/zsh-history.zsh | 5 -- zsh/.config/zsh/.zshrc | 1 + zsh/.config/zsh/zshrc.local | 73 ++++++++++++++++++++ zsh/.zshrc | 56 --------------- 18 files changed, 74 insertions(+), 167 deletions(-) delete mode 100644 zsh/.config/oh-my-zsh/custom/android.zsh delete mode 100644 zsh/.config/oh-my-zsh/custom/archlinux.zsh delete mode 100644 zsh/.config/oh-my-zsh/custom/docker.zsh delete mode 100644 zsh/.config/oh-my-zsh/custom/exa.zsh delete mode 100644 zsh/.config/oh-my-zsh/custom/go.zsh delete mode 100644 zsh/.config/oh-my-zsh/custom/gpg.zsh delete mode 100644 zsh/.config/oh-my-zsh/custom/man.zsh delete mode 100644 zsh/.config/oh-my-zsh/custom/npm.zsh delete mode 100644 zsh/.config/oh-my-zsh/custom/nvim.zsh delete mode 100644 zsh/.config/oh-my-zsh/custom/python.zsh delete mode 100644 zsh/.config/oh-my-zsh/custom/ruby.zsh delete mode 100644 zsh/.config/oh-my-zsh/custom/rust.zsh delete mode 100644 zsh/.config/oh-my-zsh/custom/tmux.zsh delete mode 100644 zsh/.config/oh-my-zsh/custom/weechat.zsh delete mode 100644 zsh/.config/oh-my-zsh/custom/zsh-history.zsh create mode 100644 zsh/.config/zsh/.zshrc create mode 100644 zsh/.config/zsh/zshrc.local delete mode 100644 zsh/.zshrc diff --git a/zsh/.config/oh-my-zsh/custom/android.zsh b/zsh/.config/oh-my-zsh/custom/android.zsh deleted file mode 100644 index abc4ebf..0000000 --- a/zsh/.config/oh-my-zsh/custom/android.zsh +++ /dev/null @@ -1,7 +0,0 @@ -export JAVA_HOME=/usr/lib/jvm/default -export ANDROID_HOME=$XDG_DATA_HOME/android/sdk -export PATH=$PATH:$ANDROID_HOME/tools -export PATH=$PATH:$ANDROID_HOME/tools/bin -export PATH=$PATH:$ANDROID_HOME/platform-tools -export PATH=$PATH:$ANDROID_HOME/emulator -export ANDROID_SDK_HOME=$XDG_CONFIG_HOME/android diff --git a/zsh/.config/oh-my-zsh/custom/archlinux.zsh b/zsh/.config/oh-my-zsh/custom/archlinux.zsh deleted file mode 100644 index 138d7a1..0000000 --- a/zsh/.config/oh-my-zsh/custom/archlinux.zsh +++ /dev/null @@ -1,24 +0,0 @@ -# pacman aliases -# source: https://wiki.archlinux.org/index.php/Pacman_Tips -alias pacupg='sudo pacman -Syu' -alias pacin='sudo pacman -S' -alias pacins='sudo pacman -U' -alias pacre='sudo pacman -R' -alias pacrem='sudo pacman -Rns' -alias pacrep='pacman -Si' -alias pacreps='pacman -Ss' -alias pacloc='pacman -Qi' -alias paclocs='pacman -Qs' -alias pacinsd='sudo pacman -S --asdeps' -alias pacmir='sudo pacman -Syy' -alias paclsorphans='sudo pacman -Qdt' -alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' -alias pacfileupg='sudo pacman -Fy' -alias pacfiles='pacman tFs' - -# list all explicitly installed packages -# source: https://bbs.archlinux.org/viewtopic.php?id=93683 -paclist() { - LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \ - awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}' -} diff --git a/zsh/.config/oh-my-zsh/custom/docker.zsh b/zsh/.config/oh-my-zsh/custom/docker.zsh deleted file mode 100644 index a188f85..0000000 --- a/zsh/.config/oh-my-zsh/custom/docker.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# Prefer this over adding user to docker group -alias docker='sudo docker' diff --git a/zsh/.config/oh-my-zsh/custom/exa.zsh b/zsh/.config/oh-my-zsh/custom/exa.zsh deleted file mode 100644 index ed4c9c8..0000000 --- a/zsh/.config/oh-my-zsh/custom/exa.zsh +++ /dev/null @@ -1,6 +0,0 @@ -# replace ls with exa -if command -v exa &> /dev/null; then - alias ls="exa" - alias l="ls -l" - alias la="ls -la" -fi diff --git a/zsh/.config/oh-my-zsh/custom/go.zsh b/zsh/.config/oh-my-zsh/custom/go.zsh deleted file mode 100644 index b19362f..0000000 --- a/zsh/.config/oh-my-zsh/custom/go.zsh +++ /dev/null @@ -1,5 +0,0 @@ -# Export $GOPATH -export GOPATH=$HOME/go - -# Add Go binary directory to $PATH -export PATH="$PATH:$GOPATH/bin" diff --git a/zsh/.config/oh-my-zsh/custom/gpg.zsh b/zsh/.config/oh-my-zsh/custom/gpg.zsh deleted file mode 100644 index ba7b529..0000000 --- a/zsh/.config/oh-my-zsh/custom/gpg.zsh +++ /dev/null @@ -1,13 +0,0 @@ -# From gpg-agent(1): -# -# You should always add the following lines to your .bashrc or whatever -# initialization file is used for all shell invocations: -# -# GPG_TTY=$(tty) -# export GPG_TTY -# -# It is important that this environment variable always reflects the out‐ -# put of the tty command. - -export GPG_TTY=$(tty) - diff --git a/zsh/.config/oh-my-zsh/custom/man.zsh b/zsh/.config/oh-my-zsh/custom/man.zsh deleted file mode 100644 index bd222e1..0000000 --- a/zsh/.config/oh-my-zsh/custom/man.zsh +++ /dev/null @@ -1,11 +0,0 @@ -# colour output in man -# source: https://wiki.archlinux.org/index.php/Color_output_in_console#man -man() { - LESS_TERMCAP_md=$'\e[01;31m' \ - LESS_TERMCAP_me=$'\e[0m' \ - LESS_TERMCAP_se=$'\e[0m' \ - LESS_TERMCAP_so=$'\e[01;44;33m' \ - LESS_TERMCAP_ue=$'\e[0m' \ - LESS_TERMCAP_us=$'\e[01;32m' \ - command man "$@" -} diff --git a/zsh/.config/oh-my-zsh/custom/npm.zsh b/zsh/.config/oh-my-zsh/custom/npm.zsh deleted file mode 100644 index e7dddb1..0000000 --- a/zsh/.config/oh-my-zsh/custom/npm.zsh +++ /dev/null @@ -1,15 +0,0 @@ -# Install NPM packages globally without requiring sudo. -# Source: https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md - -# Use XDG dirs -export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/config -export NPM_CONFIG_CACHE=$XDG_CACHE_HOME/npm -export NPM_CONFIG_TMP=$XDG_RUNTIME_DIR/npm -export NPM_CONFIG_PREFIX=$XDG_DATA_HOME/npm - -PATH="$NPM_CONFIG_PREFIX/bin:$PATH" - -# Unset manpath so we can inherit from /etc/manpath via the `manpath` command -unset MANPATH # delete if you already modified MANPATH elsewhere in your config -MANPATH="$NPM_CONFIG_PREFIX/share/man:$(manpath)" -export MANPATH diff --git a/zsh/.config/oh-my-zsh/custom/nvim.zsh b/zsh/.config/oh-my-zsh/custom/nvim.zsh deleted file mode 100644 index c89574f..0000000 --- a/zsh/.config/oh-my-zsh/custom/nvim.zsh +++ /dev/null @@ -1,6 +0,0 @@ -# Editor (NVIM) -if command -v nvim &> /dev/null; then - export EDITOR="nvim" - alias vim="nvim" - alias vi="nvim" -fi diff --git a/zsh/.config/oh-my-zsh/custom/python.zsh b/zsh/.config/oh-my-zsh/custom/python.zsh deleted file mode 100644 index ad542e8..0000000 --- a/zsh/.config/oh-my-zsh/custom/python.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# Add pip2/3 binary directory to $PATH -export PATH="$HOME/.local/bin:$PATH" diff --git a/zsh/.config/oh-my-zsh/custom/ruby.zsh b/zsh/.config/oh-my-zsh/custom/ruby.zsh deleted file mode 100644 index 795cf48..0000000 --- a/zsh/.config/oh-my-zsh/custom/ruby.zsh +++ /dev/null @@ -1,3 +0,0 @@ -# Add rubygem binary directory to $PATH -PATH="$PATH:$(ruby -e "puts Gem.user_dir")/bin" -export PATH diff --git a/zsh/.config/oh-my-zsh/custom/rust.zsh b/zsh/.config/oh-my-zsh/custom/rust.zsh deleted file mode 100644 index 0382742..0000000 --- a/zsh/.config/oh-my-zsh/custom/rust.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# Add cargo binary directory to $PATH -export PATH="$PATH:$HOME/.cargo/bin" diff --git a/zsh/.config/oh-my-zsh/custom/tmux.zsh b/zsh/.config/oh-my-zsh/custom/tmux.zsh deleted file mode 100644 index 61b3f01..0000000 --- a/zsh/.config/oh-my-zsh/custom/tmux.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# Conform to XDG Base Directory specification -export TMUX_TMPDIR="$XDG_RUNTIME_DIR" -alias tmux='tmux -f ~/.config/tmux/tmux.conf' - -# Connect to remote tmux session via SSH -ssh-tmux(){ - ssh -t "$@" "tmux attach || tmux new"; -} diff --git a/zsh/.config/oh-my-zsh/custom/weechat.zsh b/zsh/.config/oh-my-zsh/custom/weechat.zsh deleted file mode 100644 index 771cad1..0000000 --- a/zsh/.config/oh-my-zsh/custom/weechat.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# Conform to XDG base directory specifications -export WEECHAT_HOME="$HOME/.config/weechat" diff --git a/zsh/.config/oh-my-zsh/custom/zsh-history.zsh b/zsh/.config/oh-my-zsh/custom/zsh-history.zsh deleted file mode 100644 index 896d2e0..0000000 --- a/zsh/.config/oh-my-zsh/custom/zsh-history.zsh +++ /dev/null @@ -1,5 +0,0 @@ -# increase zsh history -export HISTSIZE=1000000000 -export SAVEHIST=$HISTSIZE -setopt EXTENDED_HISTORY - diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc new file mode 100644 index 0000000..6cf8033 --- /dev/null +++ b/zsh/.config/zsh/.zshrc @@ -0,0 +1 @@ +# this file exists solely to silence zsh-newuser-install diff --git a/zsh/.config/zsh/zshrc.local b/zsh/.config/zsh/zshrc.local new file mode 100644 index 0000000..3c30fd9 --- /dev/null +++ b/zsh/.config/zsh/zshrc.local @@ -0,0 +1,73 @@ +# +# local zsh file +# + +# weechat +if command -v weechat &> /dev/null; then + # Conform to XDG base directory specifications + export WEECHAT_HOME="$HOME/.config/weechat" +fi + +# tmux +if command -v tmux &> /dev/null; then + # Conform to XDG base directory specifications + export TMUX_TMPDIR="$XDG_RUNTIME_DIR" + alias tmux='tmux -f ~/.config/tmux/tmux.conf' + + # Connect to remote tmux session via SSH + ssh-tmux(){ + ssh -t "$@" "tmux attach || tmux new"; + } +fi + +# rust/cargo +if command -v cargo &> /dev/null; then + # Add cargo binary directory to $PATH + path+=("$HOME/.cargo/bin") +fi + +# ruby +if command -v ruby &> /dev/null; then + # Add rubygem binary directory to $PATH + path+=("$(ruby -e "puts Gem.user_dir")/bin") +fi + +# python-pip +if command -v pip &> /dev/null; then + # Add pip2/3 binary directory to $PATH + path+=("$HOME/.local/bin") +fi + +# nodejs/npm +if command -v npm &> /dev/null; then + # Install NPM packages globally without requiring sudo. + # Source: https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md + + # Use XDG dirs + export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/config + export NPM_CONFIG_CACHE=$XDG_CACHE_HOME/npm + export NPM_CONFIG_TMP=$XDG_RUNTIME_DIR/npm + export NPM_CONFIG_PREFIX=$XDG_DATA_HOME/npm + + # add npm binary directory to $PATH + path+=("$NPM_CONFIG_PREFIX/bin") + + # Unset manpath so we can inherit from /etc/manpath via the `manpath` command + unset MANPATH # delete if you already modified MANPATH elsewhere in your config + MANPATH="$NPM_CONFIG_PREFIX/share/man:$(manpath)" + export MANPATH +fi + +# go +if command -v go &> /dev/null; then + # Export $GOPATH + export GOPATH="$HOME/go" + + # Add Go binary directory to $PATH + path+=("$GOPATH/bin") +fi + +# finally, export $PATH +export PATH + +# vim: ft=zsh expandtab tabstop=2 shiftwidth=2 diff --git a/zsh/.zshrc b/zsh/.zshrc deleted file mode 100644 index 40ff8c0..0000000 --- a/zsh/.zshrc +++ /dev/null @@ -1,56 +0,0 @@ -# add ~/bin & /usr/local/bin to $PATH -export PATH=$HOME/bin:/usr/local/bin:$PATH - -# OS detection -if [[ "$OSTYPE" == "darwin"* ]]; then - # macOS - # Path to your oh-my-zsh installation. - export ZSH=$HOME/.oh-my-zsh - - # Support for XDG Base Directories - export XDG_DATA_HOME="${HOME}/.local/share" - export XDG_CONFIG_HOME="${HOME}/.config" - export XDG_CACHE_HOME="${HOME}/.cache" - export XDG_RUNTIME_DIR="/tmp" -elif [[ "$OSTYPE" == "linux-gnu" ]]; then - # Linux/GNU - # Path to your oh-my-zsh installation. - export ZSH=/usr/share/oh-my-zsh - - # reduce linux syscalls - export TZ=:/etc/localtime -else - printf "Unknown OS detected: %s\n" "$OSTYPE" -fi - -# oh-my-zsh related directories -export ZSH_CACHE_DIR=$XDG_CACHE_HOME/oh-my-zsh -export ZSH_CUSTOM=$XDG_CONFIG_HOME/oh-my-zsh/custom - -# create cache & plugin directories if they don't exist -if [[ ! -d $ZSH_CACHE_DIR ]]; then - mkdir -p $ZSH_CACHE_DIR -fi -if [[ ! -d $ZSH_CUSTOM ]]; then - mkdir -p $ZSH_CUSTOM -fi - -# disable automatic updates -DISABLE_AUTO_UPDATE=true - -# theme -ZSH_THEME="ys" - -# plugins -plugins=( - ripgrep - git - sudo -) - -# zsh-completions -autoload -U compinit && compinit - -# source omz -source $ZSH/oh-my-zsh.sh -