bindkey -e # history HISTFILE="$XDG_CACHE_HOME"/zsh/history HISTCONTROL=ignoreboth HISTSIZE=5000 SAVEHIST=10000 setopt inc_append_history setopt autocd setopt globdots extended_glob setopt interactive_comments unsetopt beep stty stop undef source "$XDG_CONFIG_HOME"/shellshort/shortcutrc source "$XDG_CONFIG_HOME"/shellshort/shortcutenvrc source "$XDG_CONFIG_HOME"/shellshort/zshnameddirs zstyle ':completion:*' menu select=1 zstyle ':completion::complete:*' gain-privileges 1 zstyle ':completion:*' special-dirs \ '[[ $PREFIX = (../)#(|.|..) ]] && reply=(..)' zstyle ':completion:*:default' list-colors '' zstyle ':completion:*:matches' group 'yes' zstyle ':completion:*' group-name '' zstyle ':completion:*' list-dirs-first true zstyle :compinstall filename '$HOME/.zshrc' autoload -Uz colors && colors autoload -Uz compinit zmodload zsh/complist compinit _comp_options+=(globdots) typeset -g -A key key[Home]="${terminfo[khome]}" key[End]="${terminfo[kend]}" key[Insert]="${terminfo[kich1]}" key[Backspace]="${terminfo[kbs]}" key[Delete]="${terminfo[kdch1]}" key[PageUp]="${terminfo[kpp]}" key[PageDown]="${terminfo[knp]}" key[Shift-Tab]="${terminfo[kcbt]}" key[Control-Left]="${terminfo[kLFT5]}" key[Control-Right]="${terminfo[kRIT5]}" # setup key accordingly [[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line [[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line [[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode [[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char [[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char [[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history [[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history [[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete [[ -n "${key[Control-Left]}" ]] && bindkey -- "${key[Control-Left]}" backward-word [[ -n "${key[Control-Right]}" ]] && bindkey -- "${key[Control-Right]}" forward-word # Finally, make sure the terminal is in application mode, when zle is # active. Only then are the values from $terminfo valid. if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then function zle-line-init () { echoti smkx } function zle-line-finish () { echoti rmkx } zle -N zle-line-init zle -N zle-line-finish fi # source /usr/share/gitstatus/gitstatus.prompt.zsh PROMPT='%F{green}%n@%m%f ' # green user@host # PROMPT+='%F{blue}%$((-GITSTATUS_PROMPT_LEN-1))<…<%~%<<%f' # blue current working directory PROMPT+='%F{blue}%~%<<%f' # blue current working directory # PROMPT+='${GITSTATUS_PROMPT:+ $GITSTATUS_PROMPT}' # git status # PROMPT+=$'\n' # new line PROMPT+=' %F{%(?.#888888.red)}%(!.#.$)%f ' # %/# (normal/root); green/red (ok/error) function ls() { command ls --color=auto --indicator-style=classify --human-readable --literal --group-directories-first -v "$@" # -v is for natural sort of numbers within text } # coreutils alias diff='diff --color=auto' alias grep='grep --color=auto' alias cp='cp -riv' alias ll='ls --all -l --human-readable' # -l = long listing format alias l='ls -l' alias mkdir='mkdir -pv' alias mv='mv -iv' alias rm='rm -iv' alias ..='echo "cd .."; cd ..' alias ...='echo "cd ../.."; cd ../..' # program aliases alias m='aerc' alias p='sudo pacman' alias SS='sudo systemctl' alias Su='systemctl --user' alias v='nvim' alias vn='NVIM_APPNAME=nvim-min nvim' alias vv='uv run nvim' alias neofetch='fastfetch -c examples/13' alias cvim='nvim -c "cd ~/.config/nvim" -c "Oil"' alias hm='home-manager --flake ~/nix' # source: https://wiki.archlinux.org/title/GnuPG#Configure_pinentry_to_use_the_correct_TTY GPG_TTY="$(tty)" export GPG_TTY gpg-connect-agent updatestartuptty /bye >/dev/null export FZF_DEFAULT_COMMAND='fd --type f --strip-cwd-prefix --hidden --follow --exclude .git' export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" source <(fzf --zsh) function lfcd() { export LF_CD_FILE=/tmp/.lfcd-$$ command lf "$@" if [ -s "$LF_CD_FILE" ]; then local DIR DIR="$(realpath "$(cat "$LF_CD_FILE")")" if [ "$DIR" != "$PWD" ]; then echo "cd to $DIR" cd "$DIR" || exit fi command rm "$LF_CD_FILE" fi unset LF_CD_FILE } function se() { choice="$(fd . ~/.local/bin -d1 -tx -tl --format '{/}' | fzf)" [ -f "$HOME/.local/bin/$choice" ] && $EDITOR "$HOME/.local/bin/$choice" } function nb() { local curdate="$(date +'%Y-%m-%d %a %H:%M')" local tmpfile=$(mktemp --tmpdir --suffix=.notes note.XXXXXXXXXXX) printf "[%s] " "$curdate" >> "$tmpfile" local mtime_before=$(stat -c %Y "$tmpfile") nvim -c 'norm gg$' -c 'startinsert!' "$tmpfile" local mtime_after=$(stat -c %Y "$tmpfile") if [ "$mtime_after" -ne "$mtime_before" ]; then local note="$(cat "$tmpfile")" echo "$note" >> ~/refile.notes fi } bindkey -s '^o' '^ulfcd\n' bindkey -s '^[n' '^unb\n' autoload edit-command-line zle -N edit-command-line bindkey '^x^e' edit-command-line typeset -A ZSH_HIGHLIGHT_STYLES ZSH_HIGHLIGHT_STYLES[suffix-alias]='fg=green' ZSH_HIGHLIGHT_STYLES[precommand]='fg=green' ZSH_HIGHLIGHT_STYLES[autodirectory]='fg=green' ZSH_HIGHLIGHT_STYLES[path]='none' ZSH_HIGHLIGHT_HIGHLIGHTERS+=(brackets) source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh