42 lines
1.2 KiB
Bash
42 lines
1.2 KiB
Bash
#!/bin/zsh
|
|
# Set up zsh for interactive use (options, prompt, aliases, etc.)
|
|
|
|
# Source additional configurations if available.
|
|
while read -r f; do [ -f "$f" ] && source "$f"; done <<EOL
|
|
${XDG_CONFIG_HOME}/shell/aliases
|
|
${XDG_CONFIG_HOME}/shell/solarized
|
|
EOL
|
|
unset f
|
|
|
|
# Prevent ctrl-s from freezing the terminal.
|
|
stty stop undef
|
|
|
|
# Save a lot of history in the cache directory.
|
|
HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history"
|
|
HISTSIZE=1000000
|
|
SAVEHIST=1000000
|
|
|
|
# Use vi mode for line editing.
|
|
bindkey -v
|
|
|
|
# Use beam cursor on each new prompt
|
|
precmd() { echo -ne '\e[5 q'; }
|
|
|
|
# Switch cursor shape depending on editing mode.
|
|
zle-keymap-select() {
|
|
case $KEYMAP in
|
|
vicmd) echo -ne '\e[1 q';; # block cursor for command mode
|
|
viins|main) echo -ne '\e[5 q';; # beam cursor for insert mode
|
|
esac
|
|
}
|
|
zle -N zle-keymap-select
|
|
|
|
# Search through history in insert mode.
|
|
bindkey -M viins '^j' history-beginning-search-forward
|
|
bindkey -M viins '^k' history-beginning-search-backward
|
|
|
|
# Restore some common and useful emacs mode shortcut.
|
|
bindkey -M viins '^a' vi-beginning-of-line
|
|
bindkey -M viins '^e' vi-end-of-line
|
|
bindkey -M viins '^l' vi-end-of-line
|
|
|