82 lines
2.1 KiB
Bash
82 lines
2.1 KiB
Bash
# Set the directory we want to store zinit and plugins
|
|
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
|
|
|
|
# Download Zinit, if it's not there yet
|
|
if [ ! -d "$ZINIT_HOME" ]; then
|
|
mkdir -p "$(dirname $ZINIT_HOME)"
|
|
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
|
|
fi
|
|
|
|
# Source/Load zinit
|
|
source "${ZINIT_HOME}/zinit.zsh"
|
|
|
|
# Add in zsh plugins
|
|
zinit light zsh-users/zsh-syntax-highlighting
|
|
zinit light zsh-users/zsh-completions
|
|
zinit light zsh-users/zsh-autosuggestions
|
|
zinit light Aloxaf/fzf-tab
|
|
|
|
# Add in snippets
|
|
zinit snippet OMZL::git.zsh
|
|
zinit snippet OMZP::git
|
|
zinit snippet OMZP::sudo
|
|
zinit snippet OMZP::archlinux
|
|
zinit snippet OMZP::aws
|
|
zinit snippet OMZP::kubectl
|
|
zinit snippet OMZP::kubectx
|
|
zinit snippet OMZP::command-not-found
|
|
|
|
# Load completions
|
|
autoload -Uz compinit && compinit
|
|
|
|
zinit cdreplay -q
|
|
|
|
# Prompt
|
|
eval "$(oh-my-posh init zsh --config $HOME/.config/ohmyposh/zen.toml)"
|
|
|
|
# Keybindings
|
|
bindkey -e
|
|
bindkey '^p' history-search-backward
|
|
bindkey '^n' history-search-forward
|
|
bindkey "^[[1;5C" forward-word
|
|
bindkey "^[[1;5D" backward-word
|
|
# Ohne Tmux
|
|
#bindkey "^[[H" beginning-of-line
|
|
#bindkey "^[[F" end-of-line
|
|
#bindkey "^[[2~" delete-char
|
|
# Mit Tmux
|
|
bindkey "^[[1" beginning-of-line
|
|
bindkey "^[[4~" end-of-line
|
|
bindkey "^[[3~" delete-char
|
|
|
|
# History
|
|
HISTSIZE=10000
|
|
HISTFILE=~/.zsh_history
|
|
SAVEHIST=$HISTSIZE
|
|
setopt appendhistory
|
|
setopt sharehistory
|
|
setopt hist_ignore_space
|
|
setopt hist_ignore_all_dups
|
|
setopt hist_find_no_dups
|
|
|
|
# Completion styling
|
|
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
|
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
|
zstyle ':completion:*' menu no
|
|
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
|
|
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath'
|
|
|
|
# Aliases
|
|
alias ls='ls --color'
|
|
alias v='nvim'
|
|
alias c='clear'
|
|
|
|
# Shell integrations
|
|
eval "$(fzf --zsh)"
|
|
eval "$(zoxide init --cmd cd zsh)"
|
|
|
|
# Automatically start Tmux
|
|
if [ -x "$(command -v tmux)" ] && [ -n "${DISPLAY}" ] && [ -z "${TMUX}" ]; then
|
|
exec tmux new-session -A -s ${USER} >/dev/null 2>&1
|
|
fi
|