zsh: switch and update .alias

This commit is contained in:
fanyx 2024-09-25 10:50:14 +02:00
parent d95d444ded
commit 866479f479
7 changed files with 148 additions and 10 deletions

29
.alias
View File

@ -1,14 +1,21 @@
# utils
alias ls="eza --group-directories-first -gm"
alias ll="ls -lhF"
alias lt="ll -TL $1"
alias ld="ll -d"
alias la="ll -a"
eza_params=(
'--git' '--icons' '--group' '--group-directories-first'
'--time-style=long-iso' '--color-scale=all' '--modified'
'--classify=auto'
)
eza_params_long=(
'--long' '--header'
)
[[ ! -z $_EZA_PARAMS ]] && eza_params=($_EZA_PARAMS)
alias cat="bat -pp"
alias ls="eza $eza_params"
alias l="eza --git-ignore $eza_params"
alias ll="eza $eza_params_long $eza_params"
alias la="eza --all $eza_params_long $eza_params"
alias lt="eza $eza_params_long $eza_params --level"
# applications
alias code="code-oss"
alias cat="bat -p"
# dotfiles
alias dot="git --git-dir=$HOME/git/dotfiles/ --work-tree=$HOME"
@ -20,10 +27,12 @@ alias kgp="k get pod"
alias kgsc="k get secrets"
alias kgsv="k get services"
alias dps='docker ps --format '\''table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Networks}}'\'''
# kx, kn
command -v kubectx kubens &>/dev/null && \
alias kx="kubectx" && \
alias kn="kubens"
# docker
alias dc="docker-compose"
alias dps='docker ps --format '\''table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Networks}}'\'''

6
.void.zalias Normal file
View File

@ -0,0 +1,6 @@
# import generic aliases
[[ -r ~/.alias ]] && source ~/.alias
alias xup="xi -Su"
alias xqr="xbps-query"

48
.void.zprofile Normal file
View File

@ -0,0 +1,48 @@
for x in \
"$HOME/.local/share" \
"/usr/share" \
"/usr/local/share" \
; do
[ -d "$x" ] || continue
case ":${XDG_DATA_DIRS}:" in
*":${x}:"*) ;;
*) XDG_DATA_DIRS="${XDG_DATA_DIRS:+$XDG_DATA_DIRS:}${x}" ;;
esac
done
export XDG_DATA_DIRS
for x in \
"$HOME/bin" \
"$HOME/.local/bin" \
"/usr/local/bin" \
"/usr/local/sbin" \
"/usr/bin" \
"/usr/sbin" \
"/bin" \
"/sbin" \
; do
[ -d "$x" ] || continue
case ":${PATH}:" in
*:"${x}:"*) ;;
*) PATH="${x:+$x:}${PATH}" ;;
esac
done
export PATH
export XDG_CACHE_HOME=$HOME/.cache
export XDG_CONFIG_HOME=$HOME/.config
export XDG_DATA_HOME=$HOME/.data
export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent
export BROWSER=firefox
export EDITOR=vim
export VISUAL=vim
export PAGER=less
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
export MOZ_ENABLE_WAYLAND=1
fi

72
.void.zshrc Normal file
View File

@ -0,0 +1,72 @@
#!/bin/zsh
#
# .void.zshrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# Initialize zinit
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
[ ! -d "$ZINIT_HOME" ] && {
mkdir -p "$(dirname $ZINIT_HOME)"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
}
source "${ZINIT_HOME}/zinit.zsh"
# Load plugins
autoload -U compinit && compinit
zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-autosuggestions
zinit light Aloxaf/fzf-tab
# Keybindings
bindkey -e
bindkey '^p' history-search-backward
bindkey '^n' history-search-forward
bindkey '^[[1;3D' backward-word # ALT LeftArrowKey
bindkey '^[[1;3C' forward-word # ALT RightArrowKey
bindkey '^[[1;5D' backward-word # CTRL LeftArrowKey
bindkey '^[[1;5C' forward-word # CTRL RightArrowKey
bindkey '^[[3~' delete-char # DEL
# Command history
HISTSIZE=10000
SAVEHIST=$HISTSIZE
HISTFILE=~/.zsh_history
HISTDUP=erase
setopt appendhistory
setopt sharehistory
setopt hist_ignore_space
setopt hist_ignore_all_dups
setopt hist_save_no_dups
setopt hist_ignore_dups
setopt hist_find_no_dups
# FZF
export FZF_DEFAULT_OPTS='--height 40%'
# Completions
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza --tree --level=2 --color=always $realpath'
# Aliases
# Shell integrations
eval "$(fzf --zsh)"
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
command -v direnv &>/dev/null && eval "$(direnv hook zsh)"
command -v direnv &>/dev/null && eval "$(zoxide init --cmd cd zsh)"
# Prompt
command -v direnv &>/dev/null && eval "$(starship init zsh)"
# Alias
[[ -r ~/.zalias ]] && source ~/.zalias

1
.zalias Symbolic link
View File

@ -0,0 +1 @@
/home/hendrik/.void.zalias

1
.zprofile Symbolic link
View File

@ -0,0 +1 @@
/home/hendrik/.void.zprofile

1
.zshrc Symbolic link
View File

@ -0,0 +1 @@
/home/hendrik/.void.zshrc