Krolyxon
Commit 1ac0f69

Branches

Refs →

aurora.configzsh.zshrc

67 lines · 2.1 KB · Bourne Again Shell (bash)

1autoload -U colors && colors # Load colors
2PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
3setopt autocd # Automatically cd into typed directory.
4stty stop undef # Disable ctrl-s to freeze terminal.
5
6# History in cache directory:
7HISTSIZE=10000
8SAVEHIST=10000
9HISTFILE=~/.cache/history
10
11# Load aliases if existent.
12[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc"
13
14# Basic auto/tab complete:
15autoload -U compinit
16zstyle ':completion:*' menu select
17zmodload zsh/complist
18compinit
19_comp_options+=(globdots) # Include hidden files.
20
21# vi mode
22bindkey -v
23export KEYTIMEOUT=1
24
25# Use vim keys in tab complete menu:
26bindkey -M menuselect 'h' vi-backward-char
27bindkey -M menuselect 'k' vi-up-line-or-history
28bindkey -M menuselect 'l' vi-forward-char
29bindkey -M menuselect 'j' vi-down-line-or-history
30bindkey -v '^?' backward-delete-char
31
32# Change cursor shape for different vi modes.
33function zle-keymap-select () {
34 case $KEYMAP in
35 vicmd) echo -ne '\e[1 q';; # block
36 viins|main) echo -ne '\e[5 q';; # beam
37 esac
38}
39
40# Yazi shell wrapper
41function y() {
42 local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
43 yazi "$@" --cwd-file="$tmp"
44 IFS= read -r -d '' cwd < "$tmp"
45 [ -n "$cwd" ] && [ "$cwd" != "$PWD" ] && builtin cd -- "$cwd"
46 rm -f -- "$tmp"
47}
48
49zle -N zle-keymap-select
50zle-line-init() {
51 zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
52 echo -ne "\e[5 q"
53}
54zle -N zle-line-init
55echo -ne '\e[5 q' # Use beam shape cursor on startup.
56preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
57
58# Edit line in vim with ctrl-e:
59autoload edit-command-line; zle -N edit-command-line
60bindkey '^e' edit-command-line
61
62# Enable searching through history
63bindkey '^R' history-incremental-pattern-search-backward
64
65#loeading syntax highlighter and autosgguestions plugin. should be last.
66source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null
67source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh