## 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 autoload -U colors && colors # To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh. [[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh ## autoload -Uz compinit zstyle ':completion:*' menu select zmodload zsh/complist compinit -Cu _comp_options+=(globdots) # Include hidden files unsetopt extendedglob 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 setopt appendhistory setopt hist_ignore_all_dups 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' [[ -x "$(command -v micromamba)" ]] && eval "$(micromamba shell hook --shell zsh)" bindkey '^[[A' history-substring-search-up # or '\eOA' bindkey '^[[B' history-substring-search-down # or '\eOB' HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1 alias lf='lfrun' 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'