clean up .zshrc
This commit is contained in:
parent
0b63d5f47a
commit
f4b2128c28
@ -1,4 +1,6 @@
|
|||||||
# This .bashrc is kept under git version control
|
# .bashrc
|
||||||
|
|
||||||
|
# This file is kept under git version control
|
||||||
|
|
||||||
# To make any local (non-tracked) edits or configurations,
|
# To make any local (non-tracked) edits or configurations,
|
||||||
# please edit `~/.local/.bashrc`, which is sourced from this file.
|
# please edit `~/.local/.bashrc`, which is sourced from this file.
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
# * * * * * * * * *
|
# .zshrc
|
||||||
## Env Variables *
|
|
||||||
# * * * * * * * * *
|
# This file is kept under git version control
|
||||||
|
|
||||||
|
# To make any local (non-tracked) edits or configurations,
|
||||||
|
# please edit `~/.local/.zshrc`, which is sourced from this file.
|
||||||
|
|
||||||
# ls and grep options
|
# ls and grep options
|
||||||
ls --version &>/dev/null
|
ls --version &>/dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
@ -9,38 +13,37 @@ else
|
|||||||
LS_OPTS="-GF"
|
LS_OPTS="-GF"
|
||||||
export CLICOLOR=1
|
export CLICOLOR=1
|
||||||
fi
|
fi
|
||||||
GREP_OPTS="--color=auto"
|
|
||||||
EDITOR=vim
|
export GREP_OPTS="--color=auto"
|
||||||
VISUAL=vim
|
export EDITOR=vim
|
||||||
PAGER=less
|
export VISUAL=vim
|
||||||
# (Default prompt - git prompt set later)
|
export PAGER=less
|
||||||
# PROMPT='%n@%m %~ %# '
|
export BLOCK_SIZE="'1"
|
||||||
|
|
||||||
|
export HISTFILE=~/.zsh_history
|
||||||
|
export HISTSIZE=999999999
|
||||||
|
export SAVEHIST=$HISTSIZE
|
||||||
|
|
||||||
# * * * * * * * * *
|
# * * * * * * * * *
|
||||||
## Shell Options *
|
## Shell Options *
|
||||||
# * * * * * * * * *
|
# * * * * * * * * *
|
||||||
# History
|
|
||||||
|
# Setting options
|
||||||
setopt append_history
|
setopt append_history
|
||||||
setopt extended_history
|
setopt extended_history
|
||||||
setopt inc_append_history
|
setopt inc_append_history
|
||||||
setopt share_history
|
setopt share_history
|
||||||
setopt histsavenodups
|
setopt histsavenodups
|
||||||
setopt hist_ignore_all_dups
|
setopt hist_ignore_all_dups
|
||||||
|
|
||||||
export HISTFILE=~/.zsh_history
|
|
||||||
export HISTSIZE=999999999
|
|
||||||
export SAVEHIST=$HISTSIZE
|
|
||||||
# Less Annoying
|
|
||||||
setopt interactive_comments
|
setopt interactive_comments
|
||||||
|
setopt auto_menu # tab completion
|
||||||
|
setopt prompt_subst # command substitution in prompt
|
||||||
unsetopt correct_all
|
unsetopt correct_all
|
||||||
export BLOCK_SIZE="'1"
|
|
||||||
# Tab Completion
|
|
||||||
setopt auto_menu
|
|
||||||
autoload -Uz compinit && compinit
|
autoload -Uz compinit && compinit
|
||||||
# Prompt
|
|
||||||
setopt prompt_subst
|
|
||||||
# Deduplicate path
|
# Deduplicate path
|
||||||
typeset -U path
|
typeset -U path
|
||||||
|
|
||||||
# Set 'emacs' keybinds
|
# Set 'emacs' keybinds
|
||||||
bindkey -e
|
bindkey -e
|
||||||
bindkey '\e[3~' delete-char
|
bindkey '\e[3~' delete-char
|
||||||
@ -51,6 +54,7 @@ bindkey ' ' magic-space
|
|||||||
# * * * * * *
|
# * * * * * *
|
||||||
## Aliases *
|
## Aliases *
|
||||||
# * * * * * *
|
# * * * * * *
|
||||||
|
|
||||||
# core utils
|
# core utils
|
||||||
alias l="ls ${LS_OPTS}"
|
alias l="ls ${LS_OPTS}"
|
||||||
alias ls="ls ${LS_OPTS}"
|
alias ls="ls ${LS_OPTS}"
|
||||||
@ -81,19 +85,16 @@ alias py="python3"
|
|||||||
alias ipy="ipython3"
|
alias ipy="ipython3"
|
||||||
alias venvac="source venv/bin/activate"
|
alias venvac="source venv/bin/activate"
|
||||||
|
|
||||||
|
|
||||||
# compression/archives
|
# compression/archives
|
||||||
alias untar="tar -xvf"
|
alias untar="tar -xvf"
|
||||||
alias mktar="tar -caf"
|
alias mktar="tar -caf"
|
||||||
alias tarls="tar -tvf"
|
alias tarls="tar -tvf"
|
||||||
alias ungzip="gunzip"
|
alias ungzip="gunzip"
|
||||||
|
|
||||||
# misc
|
|
||||||
alias firefox-temp='firefox --profile $(mktemp -d) &> /dev/null &'
|
|
||||||
|
|
||||||
# * * * * * *
|
# * * * * * *
|
||||||
# Functions *
|
# Functions *
|
||||||
# * * * * * *
|
# * * * * * *
|
||||||
|
|
||||||
# concat common commands
|
# concat common commands
|
||||||
mkcd() { mkdir -p -- "$1" && cd "$1"; }
|
mkcd() { mkdir -p -- "$1" && cd "$1"; }
|
||||||
cdd() { [ -n "$1" ] && for i in $(seq 1 "$1"); do cd ..; done; }
|
cdd() { [ -n "$1" ] && for i in $(seq 1 "$1"); do cd ..; done; }
|
||||||
@ -214,6 +215,10 @@ watip() {
|
|||||||
# * * * * * * * * * * * *
|
# * * * * * * * * * * * *
|
||||||
# PROMPT/PS1 Functions *
|
# PROMPT/PS1 Functions *
|
||||||
# * * * * * * * * * * * *
|
# * * * * * * * * * * * *
|
||||||
|
|
||||||
|
# (Default prompt - git prompt set later)
|
||||||
|
# PROMPT='%n@%m %~ %# '
|
||||||
|
|
||||||
git_prompt() {
|
git_prompt() {
|
||||||
BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\(.*\)/\1/')
|
BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\(.*\)/\1/')
|
||||||
STATUS="$(git status 2> /dev/null)"
|
STATUS="$(git status 2> /dev/null)"
|
||||||
@ -237,11 +242,12 @@ git_prompt() {
|
|||||||
printf "%s" "%F{reset}]"
|
printf "%s" "%F{reset}]"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
PROMPT='%F{blue}%~$(git_prompt) %F{cyan}%# %F{reset}'
|
PROMPT='%F{blue}%~$(git_prompt) %F{yellow}%# %F{reset}'
|
||||||
|
|
||||||
# * * * * * * * * * * * * * * * * * * *
|
# * * * * * * * * * * * * * * * * * * *
|
||||||
# Language Specific Version Managers *
|
# Language Specific Version Managers *
|
||||||
# * * * * * * * * * * * * * * * * * * *
|
# * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
# rbenv (ruby)
|
# rbenv (ruby)
|
||||||
src_rbenv(){
|
src_rbenv(){
|
||||||
if command -v ruby > /dev/null && command -v gem > /dev/null; then
|
if command -v ruby > /dev/null && command -v gem > /dev/null; then
|
||||||
@ -306,6 +312,7 @@ fi
|
|||||||
# * * * * * * * * * * * *
|
# * * * * * * * * * * * *
|
||||||
# MISC $PATH Additions *
|
# MISC $PATH Additions *
|
||||||
# * * * * * * * * * * * *
|
# * * * * * * * * * * * *
|
||||||
|
|
||||||
# homebrew stuff
|
# homebrew stuff
|
||||||
[ -d "/opt/homebrew/bin" ] && path+=("/opt/homebrew/bin" $path)
|
[ -d "/opt/homebrew/bin" ] && path+=("/opt/homebrew/bin" $path)
|
||||||
[ -d "/opt/homebrew/opt/sqlite/bin" ] && path+=("/opt/homebrew/opt/sqlite/bin" $path)
|
[ -d "/opt/homebrew/opt/sqlite/bin" ] && path+=("/opt/homebrew/opt/sqlite/bin" $path)
|
||||||
@ -318,11 +325,6 @@ fi
|
|||||||
[ -d "$HOME/.local/bin" ] && path+=("$HOME/.local/bin")
|
[ -d "$HOME/.local/bin" ] && path+=("$HOME/.local/bin")
|
||||||
[ -d "$HOME/.local/scripts" ] && path+=("$HOME/.local/scripts")
|
[ -d "$HOME/.local/scripts" ] && path+=("$HOME/.local/scripts")
|
||||||
|
|
||||||
# local rc
|
|
||||||
[ -r "$HOME/.config/zshrc" ] && source "$HOME/.config/zshrc"
|
|
||||||
[ -r "$HOME/.local/zshrc" ] && source "$HOME/.local/zshrc"
|
|
||||||
|
|
||||||
|
|
||||||
# ZSH syntax highlighting plugin
|
# ZSH syntax highlighting plugin
|
||||||
ZSH_SYNTAX_HIGHLIGHT_PATH="${HOMEBREW_PREFIX}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
ZSH_SYNTAX_HIGHLIGHT_PATH="${HOMEBREW_PREFIX}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||||
if [ ! -f "$ZSH_SYNTAX_HIGHLIGHT_PATH" ]; then
|
if [ ! -f "$ZSH_SYNTAX_HIGHLIGHT_PATH" ]; then
|
||||||
@ -330,3 +332,5 @@ if [ ! -f "$ZSH_SYNTAX_HIGHLIGHT_PATH" ]; then
|
|||||||
fi
|
fi
|
||||||
[ -f "$ZSH_SYNTAX_HIGHLIGHT_PATH" ] && source $ZSH_SYNTAX_HIGHLIGHT_PATH
|
[ -f "$ZSH_SYNTAX_HIGHLIGHT_PATH" ] && source $ZSH_SYNTAX_HIGHLIGHT_PATH
|
||||||
|
|
||||||
|
# local rc
|
||||||
|
[ -r "$HOME/.local/zshrc" ] && source "$HOME/.local/zshrc"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user