zshrc update
This commit is contained in:
parent
38497bc704
commit
f68f3119c1
1 changed files with 27 additions and 18 deletions
|
@ -1,19 +1,30 @@
|
|||
# Luke's config for the Zoomer Shell
|
||||
|
||||
autoload -U colors && colors
|
||||
# Enable colors and change prompt:
|
||||
autoload -U colors && colors # Load colors
|
||||
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
|
||||
setopt autocd # Automatically cd into typed directory.
|
||||
stty stop undef # Disable ctrl-s to freeze terminal.
|
||||
|
||||
# History in cache directory:
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
HISTFILE=~/.cache/zsh/history
|
||||
|
||||
# Load aliases and shortcuts if existent.
|
||||
[ -f "$HOME/.config/shortcutrc" ] && source "$HOME/.config/shortcutrc"
|
||||
[ -f "$HOME/.config/aliasrc" ] && source "$HOME/.config/aliasrc"
|
||||
|
||||
# Basic auto/tab complete:
|
||||
autoload -U compinit
|
||||
zstyle ':completion:*' menu select
|
||||
zmodload zsh/complist
|
||||
compinit
|
||||
_comp_options+=(globdots) # Include hidden files.
|
||||
|
||||
# Include hidden files in autocomplete:
|
||||
_comp_options+=(globdots)
|
||||
# vi mode
|
||||
bindkey -v
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
# Use vim keys in tab complete menu:
|
||||
bindkey -M menuselect 'h' vi-backward-char
|
||||
|
@ -22,14 +33,11 @@ bindkey -M menuselect 'l' vi-forward-char
|
|||
bindkey -M menuselect 'j' vi-down-line-or-history
|
||||
bindkey -v '^?' backward-delete-char
|
||||
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
# 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} = '' ]] ||
|
||||
|
@ -38,17 +46,13 @@ function zle-keymap-select {
|
|||
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
|
||||
|
||||
# Use beam shape cursor on startup.
|
||||
echo -ne '\e[5 q'
|
||||
# Use beam shape cursor for each new prompt.
|
||||
preexec() { echo -ne '\e[5 q' ;}
|
||||
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 () {
|
||||
|
@ -57,15 +61,20 @@ lfcd () {
|
|||
if [ -f "$tmp" ]; then
|
||||
dir="$(cat "$tmp")"
|
||||
rm -f "$tmp"
|
||||
if [ -d "$dir" ]; then
|
||||
if [ "$dir" != "$(pwd)" ]; then
|
||||
cd "$dir"
|
||||
fi
|
||||
fi
|
||||
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
|
||||
fi
|
||||
}
|
||||
bindkey -s '^o' 'lfcd\n'
|
||||
|
||||
bindkey -s '^o' 'lfcd\n' # zsh
|
||||
bindkey -s '^a' 'bc -l\n'
|
||||
|
||||
bindkey -s '^f' 'cd "$(dirname "$(fzf)")"\n'
|
||||
|
||||
bindkey '^[[P' delete-char
|
||||
|
||||
# Edit line in vim with ctrl-e:
|
||||
autoload edit-command-line; zle -N edit-command-line
|
||||
bindkey '^e' edit-command-line
|
||||
|
||||
# Load zsh-syntax-highlighting; should be last.
|
||||
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null
|
||||
|
|
Loading…
Reference in a new issue