# last change: Wed 2025-02-04 # # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. # Initialization code that may require console input (password prompts, [y/n] # confirmations, etc.) must go above this block, everything else may go below. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then # Log WLR errors and logs to the hyprland log. Recommended export HYPRLAND_LOG_WLR=1 exec start-hyprland &> /dev/null # exec Hyprland &> /dev/null fi # Catppuccin Mocha Theme (for zsh-syntax-highlighting) # Paste this files contents inside your ~/.zshrc before you activate zsh-syntax-highlighting ZSH_HIGHLIGHT_HIGHLIGHTERS=(main cursor) typeset -gA ZSH_HIGHLIGHT_STYLES source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh source ~/.config/zsh/catppuccin_mocha-zsh-syntax-highlighting.zsh source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 1>/dev/null # Enable colors and change prompt: autoload -U colors && colors # Load colors setopt autocd # Automatically cd into typed directory. setopt interactive_comments # History in cache directory: HISTSIZE=10000000 SAVEHIST=10000000 HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/history" # HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history" # setopt appendhistory # Load aliases and shortcuts if existent. [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" #[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" # Basic auto/tab complete: autoload -U compinit zstyle ':completion:*' menu select zmodload zsh/complist compinit _comp_options+=(globdots) # Include hidden files. # Use emacs key bindings bindkey -e # [PageUp] - Up a line of history if [[ -n "${terminfo[kpp]}" ]]; then bindkey -M emacs "${terminfo[kpp]}" up-line-or-history bindkey -M viins "${terminfo[kpp]}" up-line-or-history bindkey -M vicmd "${terminfo[kpp]}" up-line-or-history fi # [PageDown] - Down a line of history if [[ -n "${terminfo[knp]}" ]]; then bindkey -M emacs "${terminfo[knp]}" down-line-or-history bindkey -M viins "${terminfo[knp]}" down-line-or-history bindkey -M vicmd "${terminfo[knp]}" down-line-or-history fi # Start typing + [Up-Arrow] - fuzzy find history forward if [[ -n "${terminfo[kcuu1]}" ]]; then autoload -U up-line-or-beginning-search zle -N up-line-or-beginning-search bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search fi # Start typing + [Down-Arrow] - fuzzy find history backward if [[ -n "${terminfo[kcud1]}" ]]; then autoload -U down-line-or-beginning-search zle -N down-line-or-beginning-search bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search fi # [Home] - Go to beginning of line #if [[ -n "${terminfo[khome]}" ]]; then # bindkey -M emacs "${terminfo[khome]}" beginning-of-line # bindkey -M viins "${terminfo[khome]}" beginning-of-line # bindkey -M vicmd "${terminfo[khome]}" beginning-of-line #fi # [End] - Go to end of line if [[ -n "${terminfo[kend]}" ]]; then bindkey -M emacs "${terminfo[kend]}" end-of-line bindkey -M viins "${terminfo[kend]}" end-of-line bindkey -M vicmd "${terminfo[kend]}" end-of-line fi # [Shift-Tab] - move through the completion menu backwards if [[ -n "${terminfo[kcbt]}" ]]; then bindkey -M emacs "${terminfo[kcbt]}" reverse-menu-complete bindkey -M viins "${terminfo[kcbt]}" reverse-menu-complete bindkey -M vicmd "${terminfo[kcbt]}" reverse-menu-complete fi # [Backspace] - delete backward bindkey -M emacs '^?' backward-delete-char bindkey -M viins '^?' backward-delete-char bindkey -M vicmd '^?' backward-delete-char # [Delete] - delete forward if [[ -n "${terminfo[kdch1]}" ]]; then bindkey -M emacs "${terminfo[kdch1]}" delete-char bindkey -M viins "${terminfo[kdch1]}" delete-char bindkey -M vicmd "${terminfo[kdch1]}" delete-char else bindkey -M emacs "^[[3~" delete-char bindkey -M viins "^[[3~" delete-char bindkey -M vicmd "^[[3~" delete-char bindkey -M emacs "^[3;5~" delete-char bindkey -M viins "^[3;5~" delete-char bindkey -M vicmd "^[3;5~" delete-char fi # [Ctrl-Delete] - delete whole forward-word bindkey -M emacs '^[[3;5~' kill-word bindkey -M viins '^[[3;5~' kill-word bindkey -M vicmd '^[[3;5~' kill-word # [Ctrl-RightArrow] - move forward one word bindkey -M emacs '^[[1;5C' forward-word bindkey -M viins '^[[1;5C' forward-word bindkey -M vicmd '^[[1;5C' forward-word # [Ctrl-LeftArrow] - move backward one word bindkey -M emacs '^[[1;5D' backward-word bindkey -M viins '^[[1;5D' backward-word bindkey -M vicmd '^[[1;5D' backward-word bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line. bindkey ' ' magic-space # [Space] - don't do history expansion if [[ "$TERM" != emacs ]]; then [[ -z "$terminfo[kdch1]" ]] || bindkey -M emacs "$terminfo[kdch1]" delete-char [[ -z "$terminfo[khome]" ]] || bindkey -M emacs "$terminfo[khome]" beginning-of-line [[ -z "$terminfo[kend]" ]] || bindkey -M emacs "$terminfo[kend]" end-of-line [[ -z "$terminfo[kich1]" ]] || bindkey -M emacs "$terminfo[kich1]" overwrite-mode [[ -z "$terminfo[kdch1]" ]] || bindkey -M vicmd "$terminfo[kdch1]" vi-delete-char [[ -z "$terminfo[khome]" ]] || bindkey -M vicmd "$terminfo[khome]" vi-beginning-of-line [[ -z "$terminfo[kend]" ]] || bindkey -M vicmd "$terminfo[kend]" vi-end-of-line [[ -z "$terminfo[kich1]" ]] || bindkey -M vicmd "$terminfo[kich1]" overwrite-mode [[ -z "$terminfo[cuu1]" ]] || bindkey -M viins "$terminfo[cuu1]" vi-up-line-or-history [[ -z "$terminfo[cuf1]" ]] || bindkey -M viins "$terminfo[cuf1]" vi-forward-char [[ -z "$terminfo[kcuu1]" ]] || bindkey -M viins "$terminfo[kcuu1]" vi-up-line-or-history [[ -z "$terminfo[kcud1]" ]] || bindkey -M viins "$terminfo[kcud1]" vi-down-line-or-history [[ -z "$terminfo[kcuf1]" ]] || bindkey -M viins "$terminfo[kcuf1]" vi-forward-char [[ -z "$terminfo[kcub1]" ]] || bindkey -M viins "$terminfo[kcub1]" vi-backward-char # ncurses fogyatekos [[ "$terminfo[kcuu1]" == "^[O"* ]] && bindkey -M viins "${terminfo[kcuu1]/O/[}" vi-up-line-or-history [[ "$terminfo[kcud1]" == "^[O"* ]] && bindkey -M viins "${terminfo[kcud1]/O/[}" vi-down-line-or-history [[ "$terminfo[kcuf1]" == "^[O"* ]] && bindkey -M viins "${terminfo[kcuf1]/O/[}" vi-forward-char [[ "$terminfo[kcub1]" == "^[O"* ]] && bindkey -M viins "${terminfo[kcub1]/O/[}" vi-backward-char [[ "$terminfo[khome]" == "^[O"* ]] && bindkey -M viins "${terminfo[khome]/O/[}" beginning-of-line [[ "$terminfo[kend]" == "^[O"* ]] && bindkey -M viins "${terminfo[kend]/O/[}" end-of-line [[ "$terminfo[khome]" == "^[O"* ]] && bindkey -M emacs "${terminfo[khome]/O/[}" beginning-of-line [[ "$terminfo[kend]" == "^[O"* ]] && bindkey -M emacs "${terminfo[kend]/O/[}" end-of-line fi # del, home and end !! THIS WORKS!! bindkey "\e[3~" delete-char bindkey "\e[H" beginning-of-line bindkey "\e[F" end-of-line # Edit the current command line in $EDITOR autoload -U edit-command-line zle -N edit-command-line bindkey '\C-x\C-e' edit-command-line # file rename magick bindkey "^[m" copy-prev-shell-word # alt-bs bindkey "\e\d" undo # consider emacs keybindings: #bindkey -e ## emacs key bindings # #bindkey '^[[A' up-line-or-search #bindkey '^[[B' down-line-or-search #bindkey '^[^[[C' emacs-forward-word #bindkey '^[^[[D' emacs-backward-word # #bindkey -s '^X^Z' '%-^M' #bindkey '^[e' expand-cmd-path #bindkey '^[^I' reverse-menu-complete #bindkey '^X^N' accept-and-infer-next-history #bindkey '^W' kill-region #bindkey '^I' complete-word ## Fix weird sequence that rxvt produces #bindkey -s '^[[Z' '\t' # ############ POWERLEVEL THEME SETTINGS ############## POWERLEVEL9K_MODE="nerdfont-complete" POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_arch_icon dir vcs) # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(disk_usage time) # POWERLEVEL9K_CUSTOM_ARCH_ICON='echo  nf' POWERLEVEL9K_CUSTOM_ARCH_ICON_BACKGROUND=031 POWERLEVEL9K_CUSTOM_ARCH_ICON_FOREGROUND=252 # POWERLEVEL9K_PROMPT_ADD_NEWLINE=true # POWERLEVEL9K_PROMPT_ON_NEWLINE=true # POWERLEVEL9K_SHOW_RULER=true # POWERLEVEL9K_RULER_CHAR='─' # POWERLEVEL9K_RULER_BACKGROUND=none # POWERLEVEL9K_RULER_FOREGROUND=252 # POWERLEVEL9K_LEFT_SEGMENT_END_SEPARATOR= # POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR= # POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR=' ' # POWERLEVEL9K_RIGHT_SEGMENT_END_SEPARATOR= # POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR= # POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR= # POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS= # POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 # POWERLEVEL9K_SHORTEN_STRATEGY="truncate_middle" # POWERLEVEL9K_DIR_SHOW_WRITABLE=true # POWERLEVEL9K_DISK_USAGE_NORMAL_BACKGROUND=none # POWERLEVEL9K_DISK_USAGE_WARNING_BACKGROUND=magenta # POWERLEVEL9K_DISK_USAGE_CRITICAL_BACKGROUND=red # POWERLEVEL9K_TIME_BACKGROUND=none # POWERLEVEL9K_TIME_FOREGROUND=white POWERLEVEL9K_DIR_HOME_BACKGROUND=239 # POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND=none # POWERLEVEL9K_DIR_ETC_BACKGROUND=none # POWERLEVEL9K_DIR_DEFAULT_BACKGROUND=none # POWERLEVEL9K_DIR_NOT_WRITABLE_BACKGROUND=none POWERLEVEL9K_DIR_HOME_FOREGROUND=252 POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND=252 POWERLEVEL9K_DIR_ETC_FOREGROUND=252 POWERLEVEL9K_DIR_DEFAULT_FOREGROUND=252 POWERLEVEL9K_DIR_NOT_WRITABLE_FOREGROUND=100 # POWERLEVEL9K_OS_ICON_BACKGROUND="white" # POWERLEVEL9K_OS_ICON_FOREGROUND="white" # POWERLEVEL9K_VCS_GIT_ICON='%fon %F{040}\uf1d3 ' # POWERLEVEL9K_VCS_GIT_GITHUB_ICON='%fon %F{040}\uf09b ' # POWERLEVEL9K_VCS_GIT_BITBUCKET_ICON='%fon %F{040}\uf171 ' # POWERLEVEL9K_VCS_GIT_GIT_GITLAB_ICON='%fon %F{040}\uf296 ' # POWERLEVEL9K_VCS_CLEAN_BACKGROUND=none # POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND=none # POWERLEVEL9K_VCS_MODIFIED_BACKGROUND=none # POWERLEVEL9K_VCS_LOADING_BACKGROUND=none # POWERLEVEL9K_VCS_CLEAN_FOREGROUND="040" # POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND="red" # POWERLEVEL9K_VCS_MODIFIED_FOREGROUND="yellow" # POWERLEVEL9K_VCS_LOADING_FOREGROUND="grey" # POWERLEVEL9K_VCS_UNTRACKED_ICON=$'%{\b?%}' # POWERLEVEL9K_VCS_UNSTAGED_ICON=$'%{\b!%}' # POWERLEVEL9K_VCS_STAGED_ICON=$'%{\b+%}' # POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_COLOR=red # POWERLEVEL9K_LOCK_ICON=$'\uf023' # POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX='' # local p='%F{%(?.green.red)}${${${KEYMAP:-0}:#vicmd}:+❯}${${$((!${#${KEYMAP:-0}:#vicmd})):#0}:+❮}%f ' # POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="$p" # POWERLEVEL9K_NVM_BACKGROUND=none # POWERLEVEL9K_NVM_FOREGROUND=green # POWERLEVEL9K_NODE_ICON='%fvia %F{green}⬢' ############ END- POWERLEVEL THEME SETTINGS ############## # Preferred editor for local and remote sessions # if [[ -n $SSH_CONNECTION ]]; then # export EDITOR='vim' # else # export EDITOR='mvim' # fi # Compilation flags # export ARCHFLAGS="-arch x86_64" ### ARCHIVE EXTRACTION # usage: ex # ex () # { # if [ -f $1 ] ; then # case $1 in # *.tar.bz2) tar xjf $1 ;; # *.tar.gz) tar xzf $1 ;; # *.bz2) bunzip2 $1 ;; # *.rar) unrar x $1 ;; # *.gz) gunzip $1 ;; # *.tar) tar xf $1 ;; # *.tbz2) tar xjf $1 ;; # *.tgz) tar xzf $1 ;; # *.zip) unzip $1 ;; # *.Z) uncompress $1;; # *.7z) 7z x $1 ;; # *.deb) ar x $1 ;; # *.tar.xz) tar xf $1 ;; # *.tar.zst) unzstd $1 ;; # *) echo "'$1' cannot be extracted via ex()" ;; # esac # else # echo "'$1' is not a valid file" # fi # } ### ALIASES ### # !!! DEPRECATED !!! # --> now in ~/.config/shell/aliasrc and ~/.config/shell/shortcutsrc ## get top process eating memory #alias psmem='ps auxf | sort -nr -k 4' #alias psmem10='ps auxf | sort -nr -k 4 | head -10' ## get top process eating cpu ## #alias pscpu='ps auxf | sort -nr -k 3' #alias pscpu10='ps auxf | sort -nr -k 3 | head -10' unsetopt nomatch # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. #[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh # paths - #TODO: maybe put them into separate file: export PATH=~/.local/bin:$PATH export PATH=/home/tobias/.local/share/soar/bin:$PATH export PATH=/home/tobias/.config/gem/ruby/2.7.0/bin:$PATH export PATH=/home/tobias/.local/share/cargo/bin:$PATH export PATH=/home/tobias/.local/share/npm/bin/:$PATH export PATH=/usr/bin/perl:$PATH # export LS_COLORS="$(vivid generate catppuccin-mocha)" # color-ls: # Enable tab completion for flags by entering following line to your shell configuration file (~/.bashrc or ~/.zshrc) : #source $(dirname $(gem which colorls))/tab_complete.sh #for tilix # if [ $TILIX_ID ] || [ $VTE_VERSION ]; then # source /etc/profile.d/vte.sh # fi # [[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh # autostart Hyprland # if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then # exec sh "~/.config/hypr/initrc" # fi # # if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then # # pidof mylock > /dev/null || exec startw # # exec hl # sh "~/.config/hypr/initrc" # fi # # if [ "$(tty)" = "/dev/tty1" ] ; then #if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then # cd ~ # # Log WLR errors and logs to the hyprland log. Recommended # export HYPRLAND_LOG_WLR=1 # #NOW IN HYPRLAND ENV -- todo: delete me # # Tell XWayland to use a cursor theme # # export XCURSOR_THEME=Bibata-Modern-Ice # # export XCURSOR_THEME=Breeze_Snow # # NOW IN HYPRLAND ENV # # Set a cursor size # # export XCURSOR_SIZE=24 # # # nvidia stuff: # # export LIBVA_DRIVER_NAME=nvidia # # export XDG_SESSION_TYPE=wayland # # export GBM_BACKEND=nvidia-drm # # export __GLX_VENDOR_LIBRARY_NAME=nvidia # # export WLR_NO_HARDWARE_CURSORS=1 # exec Hyprland &> /dev/null #fi # exec sh "~/.config/hypr/initrc"fifi # if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then # # pidof mylock > /dev/null || exec startw # # exec hl # exec "~/.config/hypr/initrc" # fi autoload bashcompinit bashcompinit source "/home/tobias/.local/share/bash-completion/completions/appman" autoload bashcompinit bashcompinit source "/home/tobias/.local/share/bash-completion/completions/archimage-cli"