dotfiles/zsh/zshrc

155 lines
6.5 KiB
Bash
Raw Normal View History

2024-07-13 03:30:15 +03:00
# Use powerline
USE_POWERLINE="true"
# Has weird character width
# Example:
#  is not a diamond
HAS_WIDECHARS="false"
# Source manjaro-zsh-configuration
if [[ -e /usr/share/zsh/manjaro-zsh-config ]]; then
source /usr/share/zsh/manjaro-zsh-config
2022-01-10 22:54:06 +03:00
fi
2024-07-13 03:30:15 +03:00
# Use manjaro zsh prompt
if [[ -e /usr/share/zsh/manjaro-zsh-prompt ]]; then
source /usr/share/zsh/manjaro-zsh-prompt
fi
2024-02-06 14:52:32 +03:00
source ~/.config/zsh/antigen.zsh
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 apply
2024-07-02 20:06:50 +03:00
# Exports
export PATH=$HOME/.local/bin:/usr/local/bin:$HOME/go/bin:$PATH
2024-07-17 02:21:13 +03:00
# export GOROOT=$HOME/work/go
export GOPATH=$HOME/go
export GOPROXY=https://proxy.neonxp.ru
2024-07-02 20:06:50 +03:00
export EDITOR="micro"
2024-07-11 11:01:33 +03:00
#export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
2024-07-02 20:06:50 +03:00
2022-07-13 17:01:06 +03:00
# Aliases
2024-02-06 18:47:48 +03:00
alias ls="ls -F"
alias l="ls"
alias ll="ls -AFhl"
2022-07-13 17:01:06 +03:00
alias cp="cp -i" # Confirm before overwriting something
2024-07-02 19:27:40 +03:00
alias gitpush='git add . && git commit --amend --no-edit && git push -f'
2024-02-06 18:47:48 +03:00
alias k='kubectl'
2024-07-02 19:27:40 +03:00
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 m='micro'
2024-07-17 02:21:13 +03:00
alias cp="cp -i" # confirm before overwriting something
alias df='df -h' # human-readable sizes
alias free='free -m' # show sizes in MB
alias np='nano -w PKGBUILD'
alias more=less
2024-02-06 18:47:48 +03:00
[[ ! -f `which exa` ]] || alias ls="exa" && alias ll="exa -l"
# Functions
function tk() { mkdir -p $1; cd $1; }
2022-07-13 17:01:06 +03:00
2024-07-04 15:22:19 +03:00
function alert() {
notify-send --expire-time=30000 $1 $2 && nohup play ~/.local/share/alarm.wav &
}
2022-07-13 17:01:06 +03:00
## 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:{a-zA-Z}={A-Za-z}' # Case insensitive tab completion
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc)
2024-07-02 20:06:50 +03:00
zstyle ':completion:*' rehash true # automatically find new executables in path
2022-07-13 17:01:06 +03:00
# Speed up completions
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
2024-07-02 20:06:50 +03:00
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
2022-07-13 17:01:06 +03:00
HISTFILE=~/.zsh_history
2024-02-06 14:52:32 +03:00
HISTSIZE=100000
SAVEHIST=100000
2022-07-13 17:01:06 +03:00
#export EDITOR=/usr/bin/nano
#export VISUAL=/usr/bin/nano
WORDCHARS=${WORDCHARS//\/[&.;]} # Don't consider certain characters part of the word
autoload -U compinit colors zcalc
compinit -d
2024-07-02 20:06:50 +03:00
source ~/.config/zsh/conf.d/*.zsh
2022-07-13 17:01:06 +03:00
colors
# Color man pages
export LESS_TERMCAP_mb=$'\E[01;32m'
export LESS_TERMCAP_md=$'\E[01;32m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;47;34m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;36m'
export LESS=-R
## Plugins section: Enable fish style features
# Use syntax highlighting
#source ${HOME}/.zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Use history substring search
#source ${HOME}/.zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
# bind UP and DOWN arrow keys to history substring search
zmodload zsh/terminfo
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 of line
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
2024-02-06 14:52:32 +03:00
# ctrl + space accept suggestion
bindkey '^ ' autosuggest-accept