ZSH: Beginning of reconfiguring everything
This commit is contained in:
19
.config/zsh/conf.d/10-path.zsh
Executable file
19
.config/zsh/conf.d/10-path.zsh
Executable file
@@ -0,0 +1,19 @@
|
||||
# Set $PATH
|
||||
# Put only directories in $PATH that exist and remove duplicates
|
||||
typeset -U path # No duplicates
|
||||
path=()
|
||||
|
||||
_prepath() {
|
||||
for dir in "$@"; do
|
||||
dir=${dir:A}
|
||||
[[ ! -d "$dir" ]] && return
|
||||
#path=("$dir" $path[@])
|
||||
path=("$dir" $path)
|
||||
done
|
||||
}
|
||||
|
||||
_prepath /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/local/sbin # BSD and macOS
|
||||
_prepath /opt/homebrew/bin /opt/homebrew/sbin /usr/local/bin # Homebrew on macOS
|
||||
_prepath ~/bin ~/.local/bin # $HOME
|
||||
|
||||
unfunction _prepath
|
||||
44
.config/zsh/conf.d/20-aliases.zsh
Executable file
44
.config/zsh/conf.d/20-aliases.zsh
Executable file
@@ -0,0 +1,44 @@
|
||||
_exists() { (( $+commands[$1] )) }
|
||||
|
||||
_exists less && export PAGER=less
|
||||
|
||||
if _exists vim; then
|
||||
export EDITOR=vim
|
||||
alias vim="vim -p"
|
||||
fi
|
||||
|
||||
## ls/eza
|
||||
if _exists eza; then
|
||||
alias eza="eza --color --icons --git"
|
||||
alias ls="eza"
|
||||
fi
|
||||
|
||||
unfunction _exists
|
||||
|
||||
|
||||
alias mkdir="mkdir -p"
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
alias ....="cd ../../.."
|
||||
alias google="ping -c 10240000 google.com"
|
||||
alias history="history -i"
|
||||
alias sulast="sudo $(history -p !-1)"
|
||||
alias ydl="youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best'"
|
||||
alias htop="sudo htop"
|
||||
|
||||
case `uname` in
|
||||
Darwin)
|
||||
# commands for OS X go here
|
||||
alias flushdns="sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder"
|
||||
alias r="open -a"
|
||||
alias fetch="curl -O"
|
||||
;;
|
||||
Linux)
|
||||
# commands for Linux go here
|
||||
;;
|
||||
FreeBSD)
|
||||
# commands for FreeBSD go here
|
||||
alias stl="sockstat -l"
|
||||
alias ziostat="cmdwatch -n 1 zpool iostat -vy 1 1"
|
||||
;;
|
||||
esac
|
||||
11
.config/zsh/conf.d/20-autoload.zsh
Executable file
11
.config/zsh/conf.d/20-autoload.zsh
Executable file
@@ -0,0 +1,11 @@
|
||||
# Autoload additional functions
|
||||
|
||||
if [[ -d "${ZAUTOLOADDIR}" ]]; then
|
||||
|
||||
fpath=($fpath ${ZAUTOLOADDIR})
|
||||
|
||||
# Load functions
|
||||
for func in ${ZAUTOLOADDIR}/*; do
|
||||
autoload -Uz ${func:t}
|
||||
done
|
||||
fi
|
||||
24
.config/zsh/conf.d/20-history.zsh
Executable file
24
.config/zsh/conf.d/20-history.zsh
Executable file
@@ -0,0 +1,24 @@
|
||||
## Command history configuration
|
||||
HISTFILE="${ZCACHE}/history"
|
||||
HISTSIZE=1000000000
|
||||
SAVEHIST=1000000000
|
||||
|
||||
export HISTTIMEFORMAT="[%F %T] "
|
||||
setopt INC_APPEND_HISTORY
|
||||
setopt EXTENDED_HISTORY
|
||||
setopt HIST_FIND_NO_DUPS
|
||||
setopt hist_ignore_dups
|
||||
setopt hist_verify
|
||||
setopt incappendhistory
|
||||
setopt histignorespace
|
||||
setopt histnostore
|
||||
setopt share_history
|
||||
export HISTORY_IGNORE="([bf]g *|disown|cd ..|cd -)"
|
||||
HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1
|
||||
|
||||
# # Make up and down arrow take what’s typed on the commandline in to account.
|
||||
|
||||
# autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
|
||||
|
||||
# zle -N up-line-or-beginning-search
|
||||
# zle -N down-line-or-beginning-search
|
||||
3
.config/zsh/conf.d/20-key_bindings.zsh
Executable file
3
.config/zsh/conf.d/20-key_bindings.zsh
Executable file
@@ -0,0 +1,3 @@
|
||||
# Search
|
||||
bindkey '^[[A' history-substring-search-up # Up arrow
|
||||
bindkey '^[[B' history-substring-search-down # down arrow
|
||||
22
.config/zsh/conf.d/30-misc.zsh
Executable file
22
.config/zsh/conf.d/30-misc.zsh
Executable file
@@ -0,0 +1,22 @@
|
||||
## smart urls
|
||||
autoload -U url-quote-magic
|
||||
zle -N self-insert url-quote-magic
|
||||
|
||||
## file rename magick
|
||||
bindkey "^[m" copy-prev-shell-word
|
||||
|
||||
## jobs
|
||||
setopt long_list_jobs
|
||||
|
||||
## pager
|
||||
export LC_CTYPE=$LANG
|
||||
export LC_ALL=de_DE.UTF-8
|
||||
export IOCAGE_COLOR=TRUE
|
||||
|
||||
## Set some app specific dirs with XDM scheme
|
||||
export VIMDOTDIR="$XDG_CONFIG_HOME/vim"
|
||||
export VIMINIT='let $VIMRC="$VIMDOTDIR/vimrc" | source $VIMRC'
|
||||
export GOPATH="${XDG_DATA_HOME}/go"
|
||||
export PYTHONUSERBASE=${HOME}/.local
|
||||
export INPUTRC="${XDG_CONFIG_HOME}/readline/inputrc"
|
||||
export MANPATH="${MANPATH-$(manpath)}:${HOME}/.local/share/man"
|
||||
3
.config/zsh/conf.d/30-plugin-pure.zsh
Normal file
3
.config/zsh/conf.d/30-plugin-pure.zsh
Normal file
@@ -0,0 +1,3 @@
|
||||
PURE_CMD_MAX_EXEC_TIME=10
|
||||
PURE_PROMPT_SYMBOL="❯"
|
||||
PURE_PROMPT_VICMD_SYMBOL="❮"
|
||||
28
.config/zsh/conf.d/30-zsh_unplugged.zsh
Executable file
28
.config/zsh/conf.d/30-zsh_unplugged.zsh
Executable file
@@ -0,0 +1,28 @@
|
||||
# get zsh_unplugged and store it with your other plugins
|
||||
if [[ ! -d ${ZPLUGINDIR}/zsh_unplugged ]]; then
|
||||
git clone --quiet https://github.com/mattmc3/zsh_unplugged ${ZPLUGINDIR}/zsh_unplugged
|
||||
fi
|
||||
source ${ZPLUGINDIR}/zsh_unplugged/zsh_unplugged.zsh
|
||||
|
||||
function plugin-update {
|
||||
for d in ${ZPLUGINDIR}/*/.git(/); do
|
||||
echo "Updating ${d:h:t}..."
|
||||
command git -C "${d:h}" pull --ff --recurse-submodules --depth 1 --rebase --autostash
|
||||
done
|
||||
}
|
||||
|
||||
# make list of the Zsh plugins you use
|
||||
plugin_repos=(
|
||||
mattmc3/ez-compinit
|
||||
sindresorhus/pure # A pretty, minimal and fast ZSH prompt.
|
||||
zsh-users/zsh-completions # Additional completion definitions for ZSH
|
||||
rupa/z # Tracks your most used directories, based on 'frecency'.
|
||||
Skylor-Tang/auto-venv # Automatically activates the Python virtual environment in the current directory or its parent directories.
|
||||
|
||||
zsh-users/zsh-syntax-highlighting
|
||||
zsh-users/zsh-history-substring-search
|
||||
zsh-users/zsh-autosuggestions
|
||||
)
|
||||
|
||||
# load plugins
|
||||
plugin-load ${plugin_repos}
|
||||
Reference in New Issue
Block a user