mirror of
https://github.com/kogakure/dotfiles.git
synced 2026-02-03 20:25:30 +00:00
feat(zsh): add auto complete for cht.sh
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
~/.vale.ini: vale.ini
|
||||
~/.vale: .vale
|
||||
~/.wget: wget
|
||||
~/.zsh.d: zsh
|
||||
~/.zshrc: zshrc
|
||||
|
||||
- shell:
|
||||
|
||||
21
zsh/_cht
Normal file
21
zsh/_cht
Normal file
@@ -0,0 +1,21 @@
|
||||
#compdef cht.sh
|
||||
|
||||
__CHTSH_LANGS=($(curl -s cheat.sh/:list))
|
||||
_arguments -C \
|
||||
'--help[show this help message and exit]: :->noargs' \
|
||||
'--shell[enter shell repl]: :->noargs' \
|
||||
'1:Cheat Sheet:->lang' \
|
||||
'*::: :->noargs' && return 0
|
||||
|
||||
if [[ CURRENT -ge 1 ]]; then
|
||||
case $state in
|
||||
noargs)
|
||||
_message "nothing to complete";;
|
||||
lang)
|
||||
compadd -X "Cheat Sheets" ${__CHTSH_LANGS[@]};;
|
||||
*)
|
||||
_message "Unknown state, error in autocomplete";;
|
||||
esac
|
||||
|
||||
return
|
||||
fi
|
||||
5
zshrc
5
zshrc
@@ -335,6 +335,9 @@ antigen bundle zsh-users/zsh-syntax-highlighting
|
||||
# Tell Antigen that you’re done
|
||||
antigen apply
|
||||
|
||||
# Additional zsh plugins
|
||||
fpath=(~/.zsh.d/ $fpath)
|
||||
|
||||
# *** *** Aliases *** ***
|
||||
|
||||
# ZSH
|
||||
@@ -432,5 +435,3 @@ alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"
|
||||
# Empty the Trash on all mounted volumes and the main HDD
|
||||
# Also, clear Apple’s System Logs to improve shell startup speed
|
||||
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user