Newer
Older
dotfiles / zsh / zshrc.symlink
@Marcus Bengtsson Marcus Bengtsson on 9 Jan 2023 2 KB starship
# .zshrc
# If not running interactively, don't do anything
[[ $- != *i* ]] && return

export DOTFILES=$HOME/.dotfiles
export ZSH=$DOTFILES/zsh

# Source config-files
for config ($ZSH/**/*.zsh) source $config

# Source git-completion and git-prompt
# source $DOTFILES/git/git-prompt.sh
source $DOTFILES/git/git-completion.zsh &>/dev/null

# History
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000

setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt APPEND_HISTORY
setopt INC_APPEND_HISTORY
setopt HIST_REDUCE_BLANKS
setopt HIST_IGNORE_SPACE
setopt HIST_NO_STORE
setopt HIST_VERIFY
setopt EXTENDED_HISTORY
setopt INTERACTIVECOMMENTS

# Globbing
setopt GLOBDOTS
setopt EXTENDEDGLOB
setopt NUMERICGLOBSORT

# CD
setopt AUTO_CD
setopt AUTO_PUSHD
setopt CDABLE_VARS

# IO
setopt CORRECT

# Prompting
setopt PROMPT_SUBST

# Scripts and Functions
setopt MULTIOS

# zmv
autoload -U zmv
alias mmv="noglob zmv"

# Vi mode
#bindkey -v
#zle -N zle-line-init
#zle -N zle-keymap-select

# Ensure that arrow keys work as they should
bindkey '\e[A' up-line-or-history
bindkey '\e[B' down-line-or-history

bindkey '\eOA' up-line-or-history
bindkey '\eOB' down-line-or-history

bindkey '\e[C' forward-char
bindkey '\e[D' backward-char

bindkey '\eOC' forward-char
bindkey '\eOD' backward-char

# Rebind the insert key.
bindkey '\e[2~' overwrite-mode

# Rebind the delete key.
bindkey '\e[3~' delete-char

# Enable reverse search
bindkey '^R' history-incremental-pattern-search-backward

# History expansion on space
bindkey ' ' magic-space

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999'

# Disable "Software Flow Control (XON/XOFF)" so that terminal will not hang on C-s
stty -ixon

eval "$(starship init zsh)"
neofetch --disable theme icons packages term