zsh config

This commit is contained in:
2024-09-28 04:23:06 +02:00
commit bfdc515816
4 changed files with 218 additions and 0 deletions

8
.zsh_alias Normal file
View File

@@ -0,0 +1,8 @@
alias keepass="/home/shatteredmint/scripts/keepass.sh"
alias customasm="/home/shatteredmint/build/customasm-0.13.5/target/debug/customasm"
alias configure='nvim ~/.zshrc && nvim ~/.zsh_alias && nvim ~/.zsh_theme && source ~/.zshrc'
alias ll='ls -l'
alias la='ls -a'
alias lla='ls -la'

173
.zsh_bcachefs Normal file
View File

@@ -0,0 +1,173 @@
#compdef bcachefs
autoload -U is-at-least
_bcachefs() {
typeset -A opt_args
typeset -a _arguments_options
local ret=1
if is-at-least 5.2; then
_arguments_options=(-s -S -C)
else
_arguments_options=(-s -C)
fi
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
":: :_bcachefs_commands" \
"*::: :->bcachefs" \
&& ret=0
case $state in
(bcachefs)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:bcachefs-command-$line[1]:"
case $line[1] in
(list)
_arguments "${_arguments_options[@]}" \
'-b+[Btree to list from]:BTREE: ' \
'--btree=[Btree to list from]:BTREE: ' \
'-l+[Btree depth to descend to (0 == leaves)]:LEVEL: ' \
'--level=[Btree depth to descend to (0 == leaves)]:LEVEL: ' \
'-s+[Start position to list from]:START: ' \
'--start=[Start position to list from]:START: ' \
'-e+[End position]:END: ' \
'--end=[End position]:END: ' \
'-m+[]:MODE:(keys formats nodes nodes-ondisk)' \
'--mode=[]:MODE:(keys formats nodes nodes-ondisk)' \
'-c+[Force color on/off. Default\: autodetect tty]:COLORIZE:(true false)' \
'--colorize=[Force color on/off. Default\: autodetect tty]:COLORIZE:(true false)' \
'-f[Check (fsck) the filesystem first]' \
'--fsck[Check (fsck) the filesystem first]' \
'-v[Verbose mode]' \
'--verbose[Verbose mode]' \
'-h[Print help]' \
'--help[Print help]' \
'*::devices:_files' \
&& ret=0
;;
(mount)
_arguments "${_arguments_options[@]}" \
'-k+[Where the password would be loaded from.]:KEY_LOCATION:(none fail wait ask)' \
'--key-location=[Where the password would be loaded from.]:KEY_LOCATION:(none fail wait ask)' \
'-o+[Mount options]:OPTIONS: ' \
'-c+[Force color on/off. Default\: autodetect tty]:COLORIZE:(true false)' \
'--colorize=[Force color on/off. Default\: autodetect tty]:COLORIZE:(true false)' \
'*-v[Verbose mode]' \
'*--verbose[Verbose mode]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
':dev -- Device, or UUID=<UUID>:' \
'::mountpoint -- Where the filesystem should be mounted. If not set, then the filesystem won'\''t actually be mounted. But all steps preceeding mounting the filesystem (e.g. asking for passphrase) will still be performed:_files' \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
':shell:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_bcachefs__help_commands" \
"*::: :->help" \
&& ret=0
case $state in
(help)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:bcachefs-help-command-$line[1]:"
case $line[1] in
(list)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(mount)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
esac
;;
esac
;;
esac
;;
esac
}
(( $+functions[_bcachefs_commands] )) ||
_bcachefs_commands() {
local commands; commands=(
'list:List filesystem metadata in textual form' \
'mount:Mount a bcachefs filesystem by its UUID' \
'completions:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'bcachefs commands' commands "$@"
}
(( $+functions[_bcachefs__completions_commands] )) ||
_bcachefs__completions_commands() {
local commands; commands=()
_describe -t commands 'bcachefs completions commands' commands "$@"
}
(( $+functions[_bcachefs__help__completions_commands] )) ||
_bcachefs__help__completions_commands() {
local commands; commands=()
_describe -t commands 'bcachefs help completions commands' commands "$@"
}
(( $+functions[_bcachefs__help_commands] )) ||
_bcachefs__help_commands() {
local commands; commands=(
'list:List filesystem metadata in textual form' \
'mount:Mount a bcachefs filesystem by its UUID' \
'completions:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'bcachefs help commands' commands "$@"
}
(( $+functions[_bcachefs__help__help_commands] )) ||
_bcachefs__help__help_commands() {
local commands; commands=()
_describe -t commands 'bcachefs help help commands' commands "$@"
}
(( $+functions[_bcachefs__help__list_commands] )) ||
_bcachefs__help__list_commands() {
local commands; commands=()
_describe -t commands 'bcachefs help list commands' commands "$@"
}
(( $+functions[_bcachefs__list_commands] )) ||
_bcachefs__list_commands() {
local commands; commands=()
_describe -t commands 'bcachefs list commands' commands "$@"
}
(( $+functions[_bcachefs__help__mount_commands] )) ||
_bcachefs__help__mount_commands() {
local commands; commands=()
_describe -t commands 'bcachefs help mount commands' commands "$@"
}
(( $+functions[_bcachefs__mount_commands] )) ||
_bcachefs__mount_commands() {
local commands; commands=()
_describe -t commands 'bcachefs mount commands' commands "$@"
}
if [ "$funcstack[1]" = "_bcachefs" ]; then
_bcachefs "$@"
else
compdef _bcachefs bcachefs
fi

2
.zsh_theme Normal file
View File

@@ -0,0 +1,2 @@
setopt PROMPT_SUBST
PROMPT='%F{green}%*%f %F{blue}%~%f %F{red}${vcs_info_msg_0_}%f '

35
.zshrc Normal file
View File

@@ -0,0 +1,35 @@
# The following lines were added by compinstall
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' menu select=4
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle :compinstall filename '/home/shatteredmint/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt autocd extendedglob nomatch notify
unsetopt beep
bindkey -v
# End of lines configured by zsh-newuser-install
#### custom config
# keybinds
bindkey -M vicmd 'k' history-search-backward
bindkey -M viins '^k' history-search-backward
# prompt
autoload -Uz vcs_info
precmd() { vcs_info }
zstyle ':vcs_info:git:*' formats '%b '
source ~/.zsh_theme
source ~/.zsh_alias