1
0
Fork 0
ryzowanie/config/zsh/.zshrc

96 lines
2.2 KiB
Bash
Raw Permalink Normal View History

2024-06-10 23:06:02 +02:00
## Plugin manager
[ ! -d ${ZDOTDIR:-$HOME}/.antidote ] && git clone --depth=1 https://github.com/mattmc3/antidote.git ${ZDOTDIR:-$HOME}/.antidote
source ${ZDOTDIR:-$HOME}/.antidote/antidote.zsh
antidote load ${ZDOTDIR:-$HOME}/zsh_plugins.txt
2024-06-21 10:31:57 +02:00
autoload -U colors && colors
2024-06-10 23:06:02 +02:00
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
[[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh
##
2024-06-30 23:53:06 +02:00
autoload -Uz compinit
2024-06-10 23:06:02 +02:00
zstyle ':completion:*' menu select
2024-06-21 10:31:57 +02:00
zmodload zsh/complist
2024-06-30 23:53:06 +02:00
compinit -Cu
2024-06-21 10:31:57 +02:00
_comp_options+=(globdots) # Include hidden files
2024-08-05 18:22:47 +02:00
unsetopt extendedglob
2024-06-21 10:31:57 +02:00
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
2024-06-10 23:06:02 +02:00
setopt appendhistory
setopt hist_ignore_all_dups
2024-06-21 10:31:57 +02:00
bindkey -v
export KEYTIMEOUT=1
# Edit line in $EDITOR with c-e
autoload edit-command-line
zle -N edit-command-line
bindkey '^e' edit-command-line
# Change cursor shape for different vi modes.
function zle-keymap-select {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne '\e[1 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
}
zle -N zle-keymap-select
zle-line-init() {
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
echo -ne "\e[5 q"
}
zle -N zle-line-init
echo -ne '\e[5 q' # Use beam shape cursor on startup.
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
# Use lf to switch directories and bind it to ctrl-o
lfcd () {
tmp="$(mktemp)"
lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"
rm -f "$tmp"
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
fi
}
bindkey -s '^o' 'lfcd\n'
2024-07-12 19:49:22 +02:00
[[ -x "$(command -v micromamba)" ]] && eval "$(micromamba shell hook --shell zsh)"
2024-06-21 10:31:57 +02:00
2024-06-10 23:06:02 +02:00
bindkey '^[[A' history-substring-search-up # or '\eOA'
bindkey '^[[B' history-substring-search-down # or '\eOB'
HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1
2024-06-11 21:55:28 +02:00
alias lf='lfrun'
2024-06-11 00:22:45 +02:00
alias l='ls -lah'
alias la='ls -lAh'
alias ll='ls -lh'
alias ls='ls --color=tty'
alias lsa='ls -lah'
alias gst='git status'