From 3c61e489b4aaebc0d7cfae706233d3845dce10e9 Mon Sep 17 00:00:00 2001 From: Andrea Date: Mon, 11 Nov 2024 14:09:06 +0100 Subject: [PATCH] chore: add zsh config and exports --- .zsh_exports | 29 +++++++++++ .zshrc | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+) create mode 100644 .zsh_exports create mode 100644 .zshrc diff --git a/.zsh_exports b/.zsh_exports new file mode 100644 index 0000000..07f8a0f --- /dev/null +++ b/.zsh_exports @@ -0,0 +1,29 @@ +export PATH="$PATH:$HOME/.rbenv/shims" + +export QT_QPA_PLATFORM="wayland" + +export SDL_VIDEODRIVER="wayland" + +export _JAVA_AWT_WM_NONREPARENTING="1" + +export QT_QPA_PLATFORM="wayland" + +export XDG_CURRENT_DESKTOP="sway" +export XDG_SESSION_DESKTOP="sway" + +export GPG_TTY="$(tty)" + +# Bun and bun completitions +export BUN_INSTALL="$HOME/.bun" +export PATH="$BUN_INSTALL/bin:$PATH" +[ -s "$HOME/.bun/_bun" ] && source "$HOME/.bun/_bun" + +# Nvm +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" --no-use + +# Ghcup +[ -f "/home/andrea/.ghcup/env" ] && . "/home/andrea/.ghcup/env" + +# Add RVM to PATH for scripting. Make sure this is the last PATH variable change. +export PATH="$PATH:$HOME/.rvm/bin" diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..f1aae5a --- /dev/null +++ b/.zshrc @@ -0,0 +1,136 @@ +# ~/.zshrc file for zsh interactive shells. + +eval "$(starship init zsh)" + +# set -o vi + +# see /usr/share/doc/zsh/examples/zshrc for examples +setopt autocd # change directory just by typing its name +setopt correct # auto correct mistakes +setopt interactivecomments # allow comments in interactive mode +setopt magicequalsubst # enable filename expansion for arguments of the form ‘anything=expression’ +setopt nonomatch # hide error message if there is no match for the pattern +setopt notify # report the status of background jobs immediately +setopt numericglobsort # sort filenames numerically when it makes sense +setopt promptsubst # enable command substitution in prompt + +WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word + +# hide EOL sign ('%') +PROMPT_EOL_MARK="" + +# configure key keybindings +# bindkey -v # vim key bindings +bindkey ' ' magic-space # do history expansion on space +bindkey '^[[3;5~' kill-word # ctrl + Supr +bindkey '^[[3~' delete-char # delete +bindkey '^[[1;5C' forward-word # ctrl + -> +bindkey '^[[1;5D' backward-word # ctrl + <- +bindkey '^[[5~' beginning-of-buffer-or-history # page up +bindkey '^[[6~' end-of-buffer-or-history # page down +bindkey '^[[H' beginning-of-line # home +bindkey '^[[F' end-of-line # end +bindkey '^[[Z' undo # shift + tab undo last action + +# enable completion features +autoload -Uz compinit +compinit -d ~/.cache/zcompdump +zstyle ':completion:*:*:*:*:*' menu select +zstyle ':completion:*' auto-description 'specify: %d' +zstyle ':completion:*' completer _expand _complete _correct _approximate +zstyle ':completion:*' format 'Completing %d' +zstyle ':completion:*' group-name '' +zstyle ':completion:*' list-colors '' +zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s +zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' +zstyle ':completion:*' rehash true +zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s +zstyle ':completion:*' use-compctl false +zstyle ':completion:*' verbose true +zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' + +# History configurations +HISTFILE=~/.zsh_history +HISTSIZE=1000 +SAVEHIST=1000 +setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE +setopt hist_ignore_dups # ignore duplicated commands history list +setopt hist_ignore_space # ignore commands that start with space +setopt hist_verify # show command with history expansion to user before running it +#setopt share_history # share command history data + +# configure `time` format +TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P' + +# make less more friendly for non-text input files, see lesspipe(1) +#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# enable color support of ls, less and man, and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + 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' + + export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink + export LESS_TERMCAP_md=$'\E[1;36m' # begin bold + export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink + export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video + export LESS_TERMCAP_se=$'\E[0m' # reset reverse video + export LESS_TERMCAP_us=$'\E[1;32m' # begin underline + export LESS_TERMCAP_ue=$'\E[0m' # reset underline + + # Take advantage of $LS_COLORS for completion as well + zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" + zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' +fi + +# enable auto-suggestions based on the history +if [ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then + . /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh + # change suggestion color + ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999' +fi + +# enable command-not-found if installed +if [ -f /etc/zsh_command_not_found ]; then + . /etc/zsh_command_not_found +fi + +# Alias definitions. +if [ -f ~/.zsh_aliases ]; then + . ~/.zsh_aliases +fi + +if [ -f ~/.zsh_exports ]; then + . ~/.zsh_exports +fi + +if [ -f ~/.zsh_include ]; then + . ~/.zsh_include +fi + +if [ -f ~/.zsh_profile ]; then + . ~/.zsh_profile +fi + +# The following lines were added by compinstall +zstyle :compinstall filename '/home/andrea/.zshrc' + +autoload -Uz compinit +compinit +# End of lines added by compinstall + +source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh + +# plugins +plugins=(vi-mode) + +eval "$(rbenv init - zsh)"