2020-07-04 14:23:27 +02:00
# Luke's config for the Zoomer Shell
2021-02-26 09:06:18 +01:00
#tmux set-option status off
2020-07-04 14:23:27 +02:00
# Enable colors and change prompt:
autoload -U colors && colors # Load colors
export LC_ALL = "en_US.UTF-8"
2020-10-28 13:48:43 +01:00
PROMPT = " %{%B%}%(?.%{ $fg [grey]%}◆.%{ $fg [red]%}✖ %?)%{ $fg [blue]%} %1~ %(?.%B%{ $fg [grey]%}❯ %{ $fg [blue]%}❯ %{ $fg [white]%}❯ .%{ $fg [red]%}❯ ❯ ❯ ) %{%f%b%} "
2020-07-04 14:23:27 +02:00
#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.
2023-10-12 15:12:12 +02:00
[ -f " ${ XDG_CONFIG_HOME :- $HOME /.config } /shell/shortcutrc " ] && source " ${ XDG_CONFIG_HOME :- $HOME /.config } /shell/shortcutrc "
[ -f " ${ XDG_CONFIG_HOME :- $HOME /.config } /shell/aliasrc " ] && source " ${ XDG_CONFIG_HOME :- $HOME /.config } /shell/aliasrc "
[ -f " ${ XDG_CONFIG_HOME :- $HOME /.config } /shell/zshnameddirrc " ] && source " ${ XDG_CONFIG_HOME :- $HOME /.config } /shell/zshnameddirrc "
2020-07-04 14:23:27 +02:00
# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options += ( globdots) # Include hidden files.
2020-10-28 13:48:43 +01:00
#does not return error if argument cannot be found as file, was annoying for URLs with '?'
setopt NO_NOMATCH
2020-07-04 14:23:27 +02:00
# vi mode
bindkey -v
export KEYTIMEOUT = 1
# Use vim keys in tab complete menu:
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
bindkey -v '^?' backward-delete-char
#bash-like reverse i-search
#bindkey '^R' history-incremental-pattern-search-backward
# 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 " >/dev/null
[ -d " $dir " ] && [ " $dir " != " $( pwd ) " ] && cd " $dir "
fi
}
#Same as Luke does with lf but with ranger
rangercd ( ) {
tmp = " $( mktemp) "
ranger --choosedir= " $tmp " " $@ "
if [ -f " $tmp " ] ; then
dir = " $( cat " $tmp " ) "
rm -f " $tmp " >/dev/null
[ -d " $dir " ] && [ " $dir " != " $( pwd ) " ] && cd " $dir "
fi
}
bindkey -s '^o' 'rangercd\n'
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
#Fuzzy finder integration
2023-10-12 15:12:12 +02:00
source /usr/share/fzf/key-bindings.zsh
2020-07-04 14:23:27 +02:00
2023-10-12 15:12:12 +02:00
#source /usr/share/zsh/plugins/*/*.zsh
2020-07-04 14:23:27 +02:00
#AUTOSUGGEST CONFIG
bindkey '^ ' autosuggest-accept
bindkey '^<Tab>' autosuggest-accept
bindkey '^x' autosuggest-execute
zmodload zsh/zpty #needed for tab completion autosuggest
ZSH_AUTOSUGGEST_USE_ASYNC = 1 #can be set to anything, as long as it's set it will work asynchronously
2020-11-03 11:09:30 +01:00
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE = 20 #Might be useful for large buffers, but async might be enough
2020-07-04 14:23:27 +02:00
ZSH_AUTOSUGGEST_STRATEGY = ( match_prev_cmd completion) # completion strategy, possible values: history, completion, match_prev_cmd or a combination of those
ZLE_PROMPT_INDENT = 0
2023-10-12 15:12:12 +02:00
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
2020-07-08 18:57:01 +02:00
# increment/decriment via Ctrl+a, Ctrl+x
2020-10-02 15:33:33 +02:00
source $HOME /.local/src/vi-increment/vi-increment.zsh
2020-07-04 14:23:27 +02:00
# Load syntax highlighting; should be last.
2023-10-12 15:12:12 +02:00
source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null
LS_COLORS = 'rs=0:di=41;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:' ;