Created
July 2, 2024 21:59
-
-
Save bodziek666/dabd86c8007d7ff895c6ebb736526274 to your computer and use it in GitHub Desktop.
.zshrc Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set history file | |
HISTFILE="${HOME}/.zsh_history" | |
# Set maximum history size | |
HISTSIZE=100000 | |
# Set maximum history size stored in history file | |
SAVEHIST=100000 | |
# Append to history instead of replacing when using multiple ssh sessions | |
setopt appendhistory | |
# Append command to history without waiting for shell to exit | |
setopt INC_APPEND_HISTORY | |
# Share history between sessions/terminals | |
setopt SHARE_HISTORY | |
# Ignore lines prefixed with '#' | |
setopt interactivecomments | |
# Ignore duplicate in history | |
setopt hist_ignore_dups | |
# Prevent record in history entry if preceding them with at least one space | |
setopt hist_ignore_space | |
# completion | |
autoload -Uz compinit | |
compinit | |
zstyle ':completion:*' menu select | |
zstyle ':completion:*' rehash true | |
# fzf | |
[ -d /usr/share/zsh/site-functions/fzf ] && source /usr/share/zsh/site-functions/fzf | |
[ -d /usr/share/fzf/shell ] && source /usr/share/fzf/shell/key-bindings.zsh | |
# vcs integration | |
autoload -Uz vcs_info | |
# git integration | |
zstyle ':vcs_info:*' enable git | |
zstyle ':vcs_info:git:*' check-for-changes true | |
zstyle ':vcs_info:git:*' stagedstr ' %F{green}●%f' | |
zstyle ':vcs_info:git:*' unstagedstr ' %F{red}✘%f' | |
zstyle ':vcs_info:git:*' formats '::%s(%F{yellow}%b%f%c%u) ' | |
zstyle ':vcs_info:git:*' actionformats '::%s(%F{yellow}%b%f|%a%u%c) ' | |
precmd() { vcs_info } | |
# prompt | |
setopt PROMPT_SUBST | |
PROMPT='%B%F{green}%n@%m %B%F{cyan}%~%b%f %B${vcs_info_msg_0_}%b%B%F{blue}%#%b%f ' | |
# aliases | |
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 zgrep='zgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
alias pgrep='pgrep --color=auto' | |
alias ll='ls -alF' | |
alias la='ls -A' | |
alias l='ls -CF' | |
alias diff="colordiff" | |
# keybindings | |
bindkey -e | |
case "${TERM}" in | |
xterm*) | |
if [[ -v KONSOLE_VERSION ]]; then | |
# Konsole - Default (XFree 4) | |
bindkey "^[[H" beginning-of-line # Home key | |
bindkey "^[[F" end-of-line # End key | |
bindkey "^[[3~" delete-char # Del key | |
bindkey "^[[1;5C" forward-word # control + right arrow | |
bindkey "^[[1;5D" backward-word # control + left arrow | |
bindkey "^H" backward-kill-word # control + backspace | |
bindkey "5~" kill-word # control + delete | |
else | |
bindkey "^[[7~" beginning-of-line #Home key | |
bindkey "^[[8~" end-of-line #End key | |
bindkey "^[[3~" delete-char #Del key | |
bindkey "^[Oc" forward-word # control + right arrow | |
bindkey "^[Od" backward-word # control + left arrow | |
bindkey "^H" backward-kill-word # control + backspace | |
bindkey "^[[3^" kill-word # control + delete | |
fi | |
;; | |
screen|screen-*) | |
if [[ -v KONSOLE_VERSION ]]; then | |
# Konsole - Default (XFree 4) | |
bindkey "^[[1~" beginning-of-line #Home key | |
bindkey "^[[4~" end-of-line #End key | |
bindkey "^[[3~" delete-char #Del key | |
bindkey "5C" forward-word # control + right arrow | |
bindkey "5D" backward-word # control + left arrow | |
bindkey "^H" backward-kill-word # control + backspace | |
bindkey "5~" kill-word # control + delete | |
else | |
bindkey "^[[1~" beginning-of-line #Home key | |
bindkey "^[[4~" end-of-line #End key | |
bindkey "^[[3~" delete-char #Del key | |
bindkey "^[Oc" forward-word # control + right arrow | |
bindkey "^[OC" forward-word # control + right arrow | |
bindkey "^[Od" backward-word # control + left arrow | |
bindkey "^[OD" backward-word # control + left arrow | |
bindkey "^H" backward-kill-word # control + backspace | |
bindkey "^[[3^" kill-word # control + delete | |
fi | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment