Created
August 1, 2020 22:58
-
-
Save yochananmarqos/699d49ca3a293b514d1ef08b3e9071de to your computer and use it in GitHub Desktop.
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
# New user configuration: | |
# autoload -Uz zsh-newuser-install && zsh-newuser-install -f | |
# force rebuild zcompdump: | |
# rm -f ~/.zcompdump; compinit | |
# Use completions | |
autoload -Uz compinit && compinit | |
# Powerlevel10k | |
source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme | |
# 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 | |
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. | |
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh | |
## Plugins section | |
# Load completion definitions | |
if [[ -r /usr/share/zsh/site-functions ]]; then | |
source /usr/share/zsh/site-functions | |
fi | |
if [[ -r $HOME/.local/share/zsh/site-functions ]]; then | |
source $HOME/.local/share/zsh/site-functions | |
fi | |
# Use autosuggestion | |
if [[ -r /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh ]]; then | |
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh | |
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20 | |
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=7' | |
fi | |
# Use syntax highlighting | |
if [[ -r /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]]; then | |
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
fi | |
# Use history substring search | |
if [[ -r /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh ]]; then | |
source /usr/share/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 | |
fi | |
## Options section | |
setopt appendhistory # Immediately append history instead of overwriting | |
setopt histignorealldups # If a new command is a duplicate, remove the older one | |
setopt auto_cd | |
cdpath=($HOME/Documents) | |
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 | |
# Speed up completions | |
zstyle ':completion:*' accept-exact '*(N)' | |
zstyle ':completion:*' use-cache on | |
zstyle ':completion:*' cache-path ~/.zsh/cache | |
HISTFILE=~/.zhistory | |
HISTSIZE=1000 | |
SAVEHIST=500 | |
WORDCHARS=${WORDCHARS//\/[&.;]} # Don't consider certain characters part of the word | |
## Keybindings section | |
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 | |
## Alias section | |
alias ls='LC_COLLATE=C ls -h --group-directories-first --color=auto' | |
alias grep='grep --color=auto' | |
alias egrep='egrep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias cp='cp -i' # confirm before overwriting something | |
alias df='df -h' # human-readable sizes | |
alias free='free -m' # show sizes in MB | |
alias more=less | |
#alias diff='diff --color=auto' | |
alias -g ...='../..' | |
alias -g ....='../../..' | |
alias -g .....='../../../..' | |
# bat | |
#alias cat=bat | |
# bat-extras | |
alias cat=prettybat | |
alias rg='batgrep --color=auto' | |
alias man=batman | |
alias watch='batwatch --color=auto' | |
alias diff='batdiff --color=auto' | |
# glances | |
alias glances='glances --fahrenheit' | |
# cdir | |
alias cdir='source cdir.sh' | |
## Source custom things | |
# tilix | |
if [ $TILIX_ID ] || [ $VTE_VERSION ]; then | |
source /etc/profile.d/vte.sh | |
fi | |
# thefuck | |
eval $(thefuck --alias) | |
# mcfly | |
if [[ -r /usr/share/doc/mcfly/mcfly.zsh ]]; then | |
source /usr/share/doc/mcfly/mcfly.zsh | |
fi | |
# cod | |
source <(cod init $$ zsh) | |
# pkgfile | |
if [[ -r /usr/share/doc/pkgfile/command-not-found.zsh ]]; then | |
source /usr/share/doc/pkgfile/command-not-found.zsh | |
export PKGFILE_PROMPT_INSTALL_MISSING=1 | |
fi | |
## Other things | |
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment