You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

240 lines
6.6 KiB

# 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 you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Theme
#ZSH_THEME="agnoster"
ZSH_THEME="powerlevel10k/powerlevel10k"
# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled # disable automatic updates
# zstyle ':omz:update' mode auto # update automatically without asking
zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to change how often to auto-update (in days).
zstyle ':omz:update' frequency 7
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
zsh-completions
zsh-history-substring-search
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# 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"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# === My configs ===
# Executables
export PATH="$HOME/apps/bin:$PATH"
# Go executables
export PATH="$HOME/go/bin:$PATH"
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# SDKman
if [[ -d "$HOME/.sdkman" ]]; then
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh"
fi
# jenv
if [[ -d "$HOME/.jenv/bin" ]]; then
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
fi
# deno
if [[ -d "$HOME/.deno/bin" ]]; then
export PATH="$HOME/.deno/bin:$PATH"
fi
# local bin
export PATH="$HOME/.local/bin:$PATH"
# == Aliases ===
alias g='./gradlew '
alias gw='./gradlew build test'
alias gwr='./gradlew clean build test --refresh-dependencies'
alias gpub='./gradlew publishToMavenLocal'
alias sc="source $HOME/.zshrc"
alias kafkacat="kcat"
# === Managing dotfiles with bare git repository ===
# https://www.atlassian.com/git/tutorials/dotfiles
alias dot='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
compdef _git dot=git
# hacks, because zsh don't autocomplete files with `git --git-dit`
alias dotadd='dot add'
alias dotrm='dot rm'
# heh
dotclone() {
/usr/bin/git clone --bare $1 $HOME/.dotfiles
alias dot='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
dot config --local status.showUntrackedFiles no
dot checkout
}
# timew
alias daily='timew start work Встреча Дейли'
alias interview='timew start work Встреча Собеседование'
alias meeting='timew start work Встреча'
# ssh
alias ssh='TERM=linux ssh'
# git
alias gcl='git clone --recurse-submodules'
# utils
if [ -x "$(command -v bat)" ]; then
alias cat='bat'
fi
if [ -x "$(command -v exa)" ]; then
alias ls='exa'
fi
# Cleanup orphaned packages
alias cleanup='sudo pacman -Rns $(pacman -Qdtq)'
# Get the error messages from journalctl
alias jctl="journalctl -p 3 -xb"
# NVim aliases
if [ -x "$(command -v nvim)" ]; then
alias vi='nvim'
alias vim='nvim'
fi
# Layout switching with Alt+Space
# alias initlayout='setxkbmap -option grp:alt_space_toggle us,ru'
# Expand alias on Ctrl+Space Space
expand-alias() {
if [[ $LBUFFER =~ '[a-zA-Z0-9]+$' ]]; then
zle _expand_alias
zle expand-word
fi
zle magic-space
}
zle -N expand-alias
bindkey "^@ " expand-alias
#-
# Starts multiple args as programs in background
background() {
for ((i=2;i<=$#;i++)); do
${@[1]} ${@[$i]} &> /dev/null &
done
}
#-
#-----------------
# zsh-completions enabling
autoload -U compinit && compinit
# edit command like textdit?????
autoload -U edit-command-line
zle -N edit-command-line
bindkey '^xe' edit-command-line
bindkey '^x^e' edit-command-line
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# To unlock gnome keyring on login
# if [ -n "$DESKTOP_SESSION" ];then
# eval $(gnome-keyring-daemon --start)
# export SSH_AUTH_SOCK
# fi
# Layouts
setxkbmap -option grp:alt_space_toggle us,ru