Files
dotfiles/.config/zsh/.zshrc
druckdev bf46c5f687 zsh: Divide zshrc into zshrc.d
Move every file from plugins into zshrc.d as well as all bigger blobs in
the zshrc into their own files there.
Some stuff is still in there that I am not all too sure where it
belongs. TODO: Move.

Because all external plugins are now sourced over a symlink I had to
create a fork of fzf-tab for now that supports that.
See: https://github.com/Aloxaf/fzf-tab/pull/153
2020-11-10 02:58:22 +01:00

61 lines
1.7 KiB
Bash

## Author: druckdev
## Created: 2018-11-23
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.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
ZSH_CONF="$ZDOTDIR/plugins"
# https://github.com/romkatv/dotfiles-public/blob/7e49fc4fb71d/.zshrc#L35
comp-conf() {
emulate -L zsh
[[ ! "$1.zwc" -nt "$1" && -w "${1:h}" ]] || return 0
zmodload -F zsh/files b:zf_mv b:zf_rm
local tmp="$1.tmp.$$.zwc"
{
zcompile -R -- "$tmp" "$1" && zf_mv -f -- "$tmp" "$1.zwc" || return 1
} always {
(( ! $? )) || zf_rm -f -- "$tmp"
}
}
# https://github.com/romkatv/dotfiles-public/blob/7e49fc4fb71d/.zshrc#L47
comp-source() {
[[ -e "$1" ]] && comp-conf "$1" && source -- "$1"
}
folder-source() {
[[ -d "$1" ]] || return 1
for f in "$1"/[^._]*(N); do
if [[ -d "$f" ]]; then
folder-source "$f"
elif [[ -n "${f##*.zwc}" ]]; then
comp-source "$f"
fi
done
}
folder-source "$ZDOTDIR"/zshrc.d
autoload -U select-word-style && select-word-style bash
## Load external config files and modules
autoload edit-command-line; zle -N edit-command-line
(( ! $+aliases[run-help] )) || unalias run-help
autoload -Uz run-help run-help-git zmv
if [[ -d "$ZDOTDIR/autoload" ]]; then
fpath=("$ZDOTDIR/autoload" $fpath)
autoload -Uz -- "" "${fpath[1]}"/[^_.]*(.xN:t)
fi
! command -v direnv &>/dev/null || eval "$(direnv hook zsh)"
# Reenable fzf-tab since `bindkey -v` seems to deactivate it
enable-fzf-tab
## Setup zle
zle_highlight=('paste:none')