now using zsh4humans
This commit is contained in:
parent
2da4001e62
commit
aff8aadee6
3 changed files with 155 additions and 76 deletions
|
@ -1 +1,22 @@
|
|||
alias vim='nvim'
|
||||
alias ls='exa -al --color=always --group-directories-first'
|
||||
alias cat='bat'
|
||||
alias rm='rm -i'
|
||||
alias cp='cp -i'
|
||||
alias mv='mv -i'
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
alias diff='diff --color=auto'
|
||||
alias ip='ip --color=auto'
|
||||
alias tree='tree -a -I .git'
|
||||
|
||||
alias sc-status="sudo systemctl status"
|
||||
alias sc-start="sudo systemctl start"
|
||||
alias sc-stop="sudo systemctl stop"
|
||||
alias sc-reload="sudo systemctl reload"
|
||||
alias sc-restart="sudo systemctl restart"
|
||||
alias sc-enable="sudo systemctl enable"
|
||||
alias sc-disable="sudo systemctl disable"
|
||||
alias sc-daemon-reload="sudo systemctl daemon-reload"
|
||||
|
||||
alias termbin="nc termbin.com 9999"
|
||||
|
|
49
dot_zshenv
49
dot_zshenv
|
@ -1,6 +1,49 @@
|
|||
export WINPATH=$(tr ':' '\n' <<<"$PATH" | grep -E '^(/mnt)/c/' | paste -sd ':')
|
||||
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$WINPATH"
|
||||
|
||||
[[ -n $SSH_CONNECTION ]] && export EDITOR='vim' || export EDITOR='nvim'
|
||||
# Documentation: https://github.com/romkatv/zsh4humans/blob/v5/README.md.
|
||||
#
|
||||
# Do not modify this file unless you know exactly what you are doing.
|
||||
# It is strongly recommended to keep all shell customization and configuration
|
||||
# (including exported environment variables such as PATH) in ~/.zshrc or in
|
||||
# files sourced from ~/.zshrc. If you are certain that you must export some
|
||||
# environment variables in ~/.zshenv, do it where indicated by comments below.
|
||||
|
||||
[[ -f "$HOME/.config/local/env.zsh" ]] && source "$HOME/.config/local/env.zsh"
|
||||
if [ -n "${ZSH_VERSION-}" ]; then
|
||||
: ${ZDOTDIR:=~}
|
||||
setopt no_global_rcs
|
||||
if [[ -o no_interactive && -z "${Z4H_BOOTSTRAPPING-}" ]]; then
|
||||
return
|
||||
fi
|
||||
setopt no_rcs
|
||||
unset Z4H_BOOTSTRAPPING
|
||||
|
||||
# If you are certain that you must export some environment variables
|
||||
# in ~/.zshenv (see comments at the top!), do it here:
|
||||
#
|
||||
# export GOPATH=$HOME/go
|
||||
#
|
||||
# Do not change anything else in this file.
|
||||
fi
|
||||
|
||||
Z4H_URL="https://raw.githubusercontent.com/romkatv/zsh4humans/v5"
|
||||
: "${Z4H:=${XDG_CACHE_HOME:-$HOME/.cache}/zsh4humans/v5}"
|
||||
|
||||
umask o-w
|
||||
|
||||
if [ ! -e "$Z4H"/z4h.zsh ]; then
|
||||
mkdir -p -- "$Z4H" || return
|
||||
>&2 printf '\033[33mz4h\033[0m: fetching \033[4mz4h.zsh\033[0m\n'
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL -- "$Z4H_URL"/z4h.zsh >"$Z4H"/z4h.zsh.$$ || return
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
wget -O- -- "$Z4H_URL"/z4h.zsh >"$Z4H"/z4h.zsh.$$ || return
|
||||
else
|
||||
>&2 printf '\033[33mz4h\033[0m: please install \033[32mcurl\033[0m or \033[32mwget\033[0m\n'
|
||||
return 1
|
||||
fi
|
||||
mv -- "$Z4H"/z4h.zsh.$$ "$Z4H"/z4h.zsh || return
|
||||
fi
|
||||
|
||||
. "$Z4H"/z4h.zsh || return
|
||||
|
||||
setopt rcs
|
||||
|
|
159
dot_zshrc
159
dot_zshrc
|
@ -1,71 +1,82 @@
|
|||
# Enable Powerlevel10k instant prompt
|
||||
[[ -r "$HOME/.cache/p10k-instant-prompt-${(%):-%n}.zsh" ]] && source "$HOME/.cache/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||
# Personal Zsh configuration file. It is strongly recommended to keep all
|
||||
# shell customization and configuration (including exported environment
|
||||
# variables such as PATH) in this file or in files source by it.
|
||||
#
|
||||
# Documentation: https://github.com/romkatv/zsh4humans/blob/v5/README.md
|
||||
|
||||
export SPACEVIMDIR="$HOME/.config/spacevim/"
|
||||
export FZF_MARKS_FILE=$HOME/.config/fzfmarks
|
||||
export STARSHIP_CONFIG=$HOME/.config/zsh/starship.toml
|
||||
export ZSH_EVALCACHE_DIR="$HOME/.cache/evalcache"
|
||||
|
||||
# Setopt Stuff
|
||||
setopt multios prompt_subst auto_pushd pushd_ignore_dups pushdminus inc_append_history
|
||||
|
||||
# Zinit Clone if not exist
|
||||
[[ ! -f $HOME/.config/zinit/bin/zinit.zsh ]] && command git clone https://github.com/zdharma/zinit $HOME/.config/zinit/bin
|
||||
zstyle ':z4h:' auto-update 'no'
|
||||
zstyle ':z4h:' auto-update-days '28'
|
||||
|
||||
# Zinit
|
||||
declare -A ZINIT
|
||||
ZINIT[BIN_DIR]="$HOME/.config/zinit/bin"
|
||||
ZINIT[HOME_DIR]="$HOME/.config/zinit"
|
||||
ZINIT[ZCOMPDUMP_PATH]="$HOME/.cache/zsh/compdump"
|
||||
source $HOME/.config/zinit/bin/zinit.zsh
|
||||
# tmux: integrated, system, no
|
||||
zstyle ':z4h:' start-tmux 'no'
|
||||
zstyle ':z4h:' prompt-at-bottom 'yes'
|
||||
|
||||
# Completions and Autosuggestions
|
||||
zinit ice lucid blockf atpull'zinit creinstall -q .'; zinit light "zsh-users/zsh-completions"
|
||||
zinit ice lucid atload"_zsh_autosuggest_start"; zinit light "zsh-users/zsh-autosuggestions"
|
||||
# keyboard setting
|
||||
zstyle ':z4h:bindkey' keyboard 'pc'
|
||||
|
||||
# History
|
||||
export SAVEHIST=200000
|
||||
export HISTFILE=$HOME/.cache/zsh/history
|
||||
zstyle ':z4h:autosuggestions' forward-char 'accept'
|
||||
zstyle ':z4h:fzf-complete' recurse-dirs 'yes'
|
||||
|
||||
# Aliases
|
||||
alias ls='exa -al --color=always --group-directories-first'
|
||||
alias cat='bat'
|
||||
alias rm='rm -i'
|
||||
alias cp='cp -i'
|
||||
alias mv='mv -i'
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
alias diff='diff --color=auto'
|
||||
alias ip='ip --color=auto'
|
||||
alias vim='nvim'
|
||||
# Enable ('yes') or disable ('no') automatic teleportation of z4h over
|
||||
# ssh when connecting to these hosts.
|
||||
#zstyle ':z4h:ssh:example-hostname1' enable 'yes'
|
||||
zstyle ':z4h:ssh:*' enable 'no'
|
||||
zstyle ':z4h:ssh:*' send-extra-files '~/.nanorc' '~/.env.zsh'
|
||||
zstyle ':z4h:ssh-agent:' start no
|
||||
|
||||
alias sc-status="sudo systemctl status"
|
||||
alias sc-start="sudo systemctl start"
|
||||
alias sc-stop="sudo systemctl stop"
|
||||
alias sc-reload="sudo systemctl reload"
|
||||
alias sc-restart="sudo systemctl restart"
|
||||
alias sc-enable="sudo systemctl enable"
|
||||
alias sc-disable="sudo systemctl disable"
|
||||
alias sc-daemon-reload="sudo systemctl daemon-reload"
|
||||
z4h install ohmyzsh/ohmyzsh || return
|
||||
z4h install urbainvaes/fzf-marks || return
|
||||
|
||||
alias termbin="nc termbin.com 9999"
|
||||
|
||||
# Library Files
|
||||
source $HOME/.config/zsh/sshagent.zsh
|
||||
zinit pack for ls_colors
|
||||
zinit snippet OMZL::history.zsh
|
||||
zinit snippet OMZL::functions.zsh
|
||||
zinit snippet OMZL::completion.zsh
|
||||
zinit snippet OMZL::directories.zsh
|
||||
zinit snippet OMZL::key-bindings.zsh
|
||||
zinit snippet OMZL::termsupport.zsh
|
||||
zinit snippet OMZL::clipboard.zsh
|
||||
zinit snippet OMZL::grep.zsh
|
||||
# Install or update core components (fzf, zsh-autosuggestions, etc.) and
|
||||
# initialize Zsh. After this point console I/O is unavailable until Zsh
|
||||
# is fully initialized. Everything that requires user interaction or can
|
||||
# perform network I/O must be done above. Everything else is best done below.
|
||||
z4h init || return
|
||||
|
||||
# Completion Stuff
|
||||
# Export environment variables.
|
||||
export GPG_TTY=$TTY
|
||||
|
||||
# Source additional local files if they exist.
|
||||
z4h source $HOME/.config/local/env.zsh
|
||||
|
||||
# Libraries
|
||||
z4h source $HOME/.config/zsh/sshagent.zsh
|
||||
z4h source $Z4H/ohmyzsh/ohmyzsh/lib/history.zsh
|
||||
z4h source $Z4H/ohmyzsh/ohmyzsh/lib/functions.zsh
|
||||
z4h source $Z4H/ohmyzsh/ohmyzsh/lib/completion.zsh
|
||||
z4h source $Z4H/ohmyzsh/ohmyzsh/lib/directories.zsh
|
||||
z4h source $Z4H/ohmyzsh/ohmyzsh/lib/key-bindings.zsh
|
||||
z4h source $Z4H/ohmyzsh/ohmyzsh/lib/termsupport.zsh
|
||||
z4h source $Z4H/ohmyzsh/ohmyzsh/lib/clipboard.zsh
|
||||
z4h source $Z4H/ohmyzsh/ohmyzsh/lib/grep.zsh
|
||||
z4h source $Z4H/ohmyzsh/ohmyzsh/plugins/command-not-found/command-not-found.plugin.zsh
|
||||
#zinit pack for ls_colors
|
||||
|
||||
# Define key bindings.
|
||||
z4h bindkey z4h-backward-kill-word Ctrl+Backspace Ctrl+H
|
||||
z4h bindkey z4h-backward-kill-zword Ctrl+Alt+Backspace
|
||||
|
||||
z4h bindkey undo Ctrl+/ # undo the last command line change
|
||||
z4h bindkey redo Alt+/ # redo the last undone command line change
|
||||
|
||||
z4h bindkey z4h-cd-back Alt+Left # cd into the previous directory
|
||||
z4h bindkey z4h-cd-forward Alt+Right # cd into the next directory
|
||||
z4h bindkey z4h-cd-up Alt+Up # cd into the parent directory
|
||||
z4h bindkey z4h-cd-down Alt+Down # cd into a child directory
|
||||
|
||||
# Autoload functions.
|
||||
autoload -Uz zmv
|
||||
|
||||
# Define functions and completions.
|
||||
function md() { [[ $# == 1 ]] && mkdir -p -- "$1" && cd -- "$1" }
|
||||
compdef _directories md
|
||||
|
||||
# Fix SSH Completions
|
||||
zstyle ':completion:*:*:*:users' ignored-patterns '*'
|
||||
zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
|
||||
#zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
|
||||
zstyle ':completion:*:(scp|rsync):*' tag-order 'hosts:-host:host hosts:-domain:domain hosts:-ipaddr:ip\ address *'
|
||||
zstyle ':completion:*:(scp|rsync):*' group-order users files all-files hosts-domain hosts-host hosts-ipaddr
|
||||
zstyle ':completion:*:ssh:*' tag-order users 'hosts:-host:host hosts:-domain:domain hosts:-ipaddr:ip\ address *'
|
||||
|
@ -74,22 +85,26 @@ zstyle ':completion:*:*:*:hosts-host' ignored-patterns '*(.|:)*' loopback ip6-lo
|
|||
zstyle ':completion:*:*:*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^[-[:alnum:]]##(.[-[:alnum:]]##)##' '*@*' '*localdomain*' '*.eeleater.org' '*.local'
|
||||
zstyle ':completion:*:*:*:hosts-ipaddr' ignored-patterns '^(<->.<->.<->.<->|(|::)([[:xdigit:].]##:(#c,2))##(|%*))' '127.0.0.<->' '255.255.255.255' '::1' 'fe80::*'
|
||||
|
||||
# Plugins
|
||||
zinit ice lucid; zinit light "mroth/evalcache"
|
||||
zinit ice lucid; zinit snippet OMZP::command-not-found
|
||||
zinit ice lucid; zinit snippet OMZP::fzf
|
||||
zinit ice lucid; zinit light "b4b4r07/enhancd"
|
||||
zinit ice lucid; zinit light "jreese/zsh-titles"
|
||||
zinit ice lucid; zinit light "urbainvaes/fzf-marks"
|
||||
zinit ice lucid; zinit light "Aloxaf/fzf-tab"
|
||||
[[ -f /home/linuxbrew/.linuxbrew/bin/brew ]] && _evalcache /home/linuxbrew/.linuxbrew/bin/brew shellenv
|
||||
# Define named directories: ~w <=> Windows home directory on WSL.
|
||||
[[ -z $z4h_win_home ]] || hash -d w=$z4h_win_home
|
||||
|
||||
# syntax highlighting
|
||||
zinit ice lucid atinit"ZINIT[COMPINIT_OPTS]=-C; zpcompinit; zpcdreplay"; zinit light "zdharma/fast-syntax-highlighting"
|
||||
# History
|
||||
export SAVEHIST=200000
|
||||
export HISTFILE=$HOME/.cache/zsh/history
|
||||
export SPACEVIMDIR="$HOME/.config/spacevim/"
|
||||
export FZF_MARKS_FILE=$HOME/.config/fzfmarks
|
||||
|
||||
# Theme
|
||||
zinit ice lucid depth=1; zinit light "romkatv/powerlevel10k"
|
||||
[[ ! -f "$HOME/.p10k.zsh" ]] || source "$HOME/.p10k.zsh" # p10k configure || nano ~/.p10k.zsh
|
||||
z4h source $Z4H/urbainvaes/fzf-marks/fzf-marks.plugin.zsh
|
||||
|
||||
# Local RC
|
||||
[[ -f "$HOME/.config/local/rc.zsh" ]] && source "$HOME/.config/local/rc.zsh"
|
||||
# Aliases
|
||||
z4h source $HOME/.config/zsh/aliases.zsh
|
||||
z4h source $HOME/.config/local/aliases.zsh
|
||||
|
||||
# Add flags to existing aliases.
|
||||
alias ls="${aliases[ls]:-ls} -A"
|
||||
|
||||
# Set shell options: http://zsh.sourceforge.net/Doc/Release/Options.html.
|
||||
setopt glob_dots # no special treatment for file names with a leading dot
|
||||
setopt no_auto_menu # require an extra TAB press to open the completion menu
|
||||
|
||||
z4h source $HOME/.config/local/rc.zsh
|
Loading…
Add table
Reference in a new issue