63 lines
1.7 KiB
Plaintext
63 lines
1.7 KiB
Plaintext
bindkey "^[[1;5C" forward-word
|
|
bindkey "^[[1;5D" backward-word
|
|
|
|
if command -v bat &> /dev/null; then
|
|
alias myip="curl https://ipinfo.io/json 2> /dev/null | bat -l JSON --file-name=https://ipinfo.io/json -p --paging=never"
|
|
else
|
|
alias myip="curl https://ipinfo.io/json 2> /dev/null"
|
|
fi
|
|
|
|
alias ip='ip -c'
|
|
|
|
function _kfg {
|
|
local -a _options _commands _programs
|
|
|
|
_programs=(
|
|
'all:Install everything'
|
|
'zsh:Powerful Shell'
|
|
'tmux:Terminal Multiplexer'
|
|
'unp:Perl script to make file archive extraction easier'
|
|
'bat:cat replacement with syntax highlighting and git integration'
|
|
'lsd:ls replacement with colors, icons, tree-view and more'
|
|
'omp:Customisable shell prompt renderer'
|
|
'zoxide:A smarter cd command'
|
|
'fzf:A command-line fuzzy finder'
|
|
'fzf-tab:Replace zsh default completion selection menu with fzf'
|
|
)
|
|
|
|
_commands=(
|
|
'update:Update kfg'
|
|
'install:Install programs and configs'
|
|
'version:Print version number'
|
|
)
|
|
|
|
_options=(
|
|
{-h,--help}'[Show this help]'
|
|
{-y,--yes}'[Skip confirmation questions]'
|
|
#{-a,--arch}' STRING [Set the architecture string to be used when downloading files from repositories. Most common are "amd64", "arm64", "armhf", etc]'
|
|
{-d,--debug}'[Print debug output]'
|
|
)
|
|
|
|
function _kfg_install {
|
|
_arguments -C '*:: :->subcmds'
|
|
if (( CURRENT == 1 ));then
|
|
_describe -t programs "kfg install programs" _programs
|
|
return
|
|
else
|
|
_arguments $_options
|
|
return
|
|
fi
|
|
}
|
|
|
|
_arguments -C '*:: :->subcmds'
|
|
if (( CURRENT == 1 ));then
|
|
_describe -t commands "kfg command" _commands
|
|
return
|
|
fi
|
|
|
|
case "$words[1]" in
|
|
install) _kfg_install && return 0 ;;
|
|
*) _kfg_options && return 0 ;;
|
|
esac
|
|
}
|
|
compdef _kfg kfg |