From 97af93b2a8ebc89364852e3f63e9fd8cfedaeedf Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Mon, 9 Jun 2025 13:43:45 +0300 Subject: =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B2=D1=91=D0=BB=20dotfiles?= =?UTF-8?q?=20=D0=BD=D0=B0=20stow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zsh/.zshrc | 169 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 zsh/.zshrc (limited to 'zsh/.zshrc') diff --git a/zsh/.zshrc b/zsh/.zshrc new file mode 100644 index 0000000..7f666ad --- /dev/null +++ b/zsh/.zshrc @@ -0,0 +1,169 @@ +source ~/.config/zsh/antigen.zsh + +# if command -v git >/dev/null && [ ! -d ~/.config/zsh/powerlevel10k ]; then +# echo "info: installing p10k" +# git clone --depth 1 --single-branch https://github.com/romkatv/powerlevel10k.git ~/.config/zsh/powerlevel10k +# fi +# +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 + +source ~/.config/zsh/theme/powerlevel10k.zsh-theme +source ~/.config/zsh/conf.d/*.zsh +source ~/.config/zsh/termsupport.zsh +source ~/.config/zsh/title.zsh +foreground () { fg } +zle -N foreground +clearscr () { clear } +zle -N clearscr + +antigen bundle zsh-users/zsh-syntax-highlighting +antigen bundle zsh-users/zsh-history-substring-search +antigen bundle zsh-users/zsh-autosuggestions +antigen bundle zsh-users/zsh-completions +antigen bundle ael-code/zsh-colored-man-pages +antigen apply + +# {{{ Exports +#export GOPROXY=https://proxy.neonxp.ru +export GOPRIVATE=devopar.hippoparking.ru,gitlab.sovcombank.group +export EDITOR="nvim" +#export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock +export ANDROID_HOME=$HOME/projects/android/ +export PATH=$PATH:$ANDROID_HOME/emulator +export PATH=$PATH:$ANDROID_HOME/platform-tools +export PATH=$PATH:~/.local/bin:~/go/bin:~/.cargo/bin +export GOBIN=~/go/bin +export GPG_TTY=$(tty) +export LS_OPTIONS='--color=auto' +eval "$(dircolors -b)" + +fpath+="~/.config/zsh/comp" +# }}} + +# {{{ Aliases +alias ls='ls $LS_OPTIONS -F' +alias l='ls $LS_OPTIONS -F' +alias j="sudo journalctl" +alias s='sudo' +alias sctl="sudo systemctl" +alias ll="ls -AFhl" +alias cp="cp -i" +alias gitpush="git add . && git commit --amend --no-edit && git push -f" +alias yu="ssh-add -e /usr/lib/x86_64-linux-gnu/libykcs11.so; ssh-add -s /usr/lib/x86_64-linux-gnu/libykcs11.so" +alias n="nvim" +alias nv="nvim ." +alias cp="cp -i" +alias df="df -h" +alias free="free -m" +alias gitu='git add . && git commit && git push' +alias g=git +alias share='wl-paste | curl -si -d @- https://nixshare.ru/paste/clipboard.txt | grep "location:" | sed -s "s/location: //" | wl-copy' +alias p=python3 +alias t=todo.sh +[[ ! -f `which exa` ]] || alias ls="exa" && alias ll="exa -l" +compdef _todo t +# }}} + +# {{{ Functions +function tk() { mkdir -p $1; cd $1; } +# }}} + +# {{{ Options section +setopt correct # Auto correct mistakes +setopt extendedglob # Extended globbing. Allows using regular expressions with * +setopt nocaseglob # Case insensitive globbing +setopt rcexpandparam # Array expension with parameters +setopt nocheckjobs # Don"t warn about running processes when exiting +setopt numericglobsort # Sort filenames numerically when it makes sense +setopt nobeep # No beep +setopt appendhistory # Immediately append history instead of overwriting +setopt histignorealldups # If a new command is a duplicate, remove the older one +setopt autocd # if only directory path is entered, cd there. +setopt inc_append_history # save commands are added to the history immediately, otherwise only when shell exits. +setopt histignorespace # Don"t save commands that start with space + +zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' # Case insensitive tab completion +zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc) +zstyle ':completion:*' rehash true # automatically find new executables in path +zstyle ':completion:*' menu select # Highlight menu selection +# Speed up completions +zstyle ':completion:*' accept-exact '*(N)' +zstyle ':completion:*' use-cache on +zstyle ':completion:*' cache-path ~/.zsh/cache + +zstyle ":completion:*:processes" command "ps -ax" +zstyle ":completion:*:*:kill:*:processes" list-colors "=(#b) #([0-9]#)*=0=01;32" +zstyle ":completion:*:*:kill:*" menu yes select +zstyle ":completion:*:kill:*" force-list always + +zstyle ":completion:*:processes-names" command "ps -e -o comm=" +zstyle ":completion:*:*:killall:*" menu yes select +zstyle ":completion:*:killall:*" force-list always + +HISTFILE=~/.zsh_history +HISTSIZE=100000 +SAVEHIST=100000 +WORDCHARS=${WORDCHARS//\/[&.;]} + +autoload -U compinit colors zcalc +compinit -d + +autoload -U add-zsh-hook +add-zsh-hook precmd mzc_termsupport_precmd +add-zsh-hook preexec mzc_termsupport_preexec +add-zsh-hook precmd mzc_termsupport_cwd + +colors + +zmodload zsh/terminfo +# }}} + +# {{{ Binds +bindkey "$terminfo[kcuu1]" history-substring-search-up +bindkey "$terminfo[kcud1]" history-substring-search-down +bindkey "^[[A" history-substring-search-up +bindkey "^[[B" history-substring-search-down + +bindkey -e +bindkey "^[[7~" beginning-of-line # Home key +bindkey "^[[H" beginning-of-line # Home key +if [[ "${terminfo[khome]}" != "" ]]; then + bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning +fi +bindkey "^[[8~" end-of-line # End key +bindkey "^[[F" end-of-line # End key +if [[ "${terminfo[kend]}" != "" ]]; then + bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line +fi +bindkey "^[[2~" overwrite-mode # Insert key +bindkey "^[[3~" delete-char # Delete key +bindkey "^[[C" forward-char # Right key +bindkey "^[[D" backward-char # Left key +bindkey "^[[5~" history-beginning-search-backward # Page up key +bindkey "^[[6~" history-beginning-search-forward # Page down key + +# Navigate words with ctrl+arrow keys +bindkey "^[Oc" forward-word +bindkey "^[Od" backward-word +bindkey "^[[1;5D" backward-word +bindkey "^[[1;5C" forward-word +bindkey "^H" backward-kill-word # delete previous word with ctrl+backspace +bindkey "^[[Z" undo # Shift+tab undo last action +bindkey "^z" foreground +# ctrl + space accept suggestion +bindkey "^ " autosuggest-accept + + +bindkey "^k" clearscr +# }}} + +ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD +ZSH_THEME_TERM_TITLE_IDLE="%n@%m:%~" +# {{{ Overwriting +source ~/.config/zsh/theme.zsh +[[ ! -f env.sh ]] || source ./env.sh +[[ ! -f ~/.zshrc.local.zsh ]] || source ~/.zshrc.local.zsh +[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh +# }}} -- cgit v1.2.3