From 866479f479fd933a03f5911809378bdea8a40e43 Mon Sep 17 00:00:00 2001 From: fanyx Date: Wed, 25 Sep 2024 10:50:14 +0200 Subject: [PATCH] zsh: switch and update .alias --- .alias | 29 +++++++++++++------- .void.zalias | 6 +++++ .void.zprofile | 48 +++++++++++++++++++++++++++++++++ .void.zshrc | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ .zalias | 1 + .zprofile | 1 + .zshrc | 1 + 7 files changed, 148 insertions(+), 10 deletions(-) create mode 100644 .void.zalias create mode 100644 .void.zprofile create mode 100644 .void.zshrc create mode 120000 .zalias create mode 120000 .zprofile create mode 120000 .zshrc diff --git a/.alias b/.alias index 18fe1b8..6e8f05f 100644 --- a/.alias +++ b/.alias @@ -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}}'\''' + diff --git a/.void.zalias b/.void.zalias new file mode 100644 index 0000000..1a3ddad --- /dev/null +++ b/.void.zalias @@ -0,0 +1,6 @@ +# import generic aliases +[[ -r ~/.alias ]] && source ~/.alias + +alias xup="xi -Su" +alias xqr="xbps-query" + diff --git a/.void.zprofile b/.void.zprofile new file mode 100644 index 0000000..b156a7c --- /dev/null +++ b/.void.zprofile @@ -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 + diff --git a/.void.zshrc b/.void.zshrc new file mode 100644 index 0000000..e40ad7d --- /dev/null +++ b/.void.zshrc @@ -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 + diff --git a/.zalias b/.zalias new file mode 120000 index 0000000..a57292f --- /dev/null +++ b/.zalias @@ -0,0 +1 @@ +/home/hendrik/.void.zalias \ No newline at end of file diff --git a/.zprofile b/.zprofile new file mode 120000 index 0000000..b3bffef --- /dev/null +++ b/.zprofile @@ -0,0 +1 @@ +/home/hendrik/.void.zprofile \ No newline at end of file diff --git a/.zshrc b/.zshrc new file mode 120000 index 0000000..068d505 --- /dev/null +++ b/.zshrc @@ -0,0 +1 @@ +/home/hendrik/.void.zshrc \ No newline at end of file