Merge branch 'trunk' of https://vcs.otl-hga.net/nicole/zeesh into trunk

This commit is contained in:
Nicole O'Connor 2023-04-04 12:43:59 -07:00
commit c7538531a0
5 changed files with 63 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.swp
pull.log
update.tbl

View File

@ -19,12 +19,26 @@ function zeesh_update () {
fi
[[ _zshrc_updates_pending -eq 1 ]] && ticker_message "zeesh: stub updates pending"
echo "lastchk=$(date +%s)" > ~/.local/share/zeesh/update.tbl
fi
}
if [[ $_zeeshdev_ignore_updates != 1 ]]; then
ticker_message "zeesh: checking network"
curl -s http://lavacano.net --connect-timeout 1 --max-time 3 > /dev/null && zeesh_update
curl -s https://vcs.otl-hga.net --connect-timeout 1 --max-time 3 > /dev/null
network_ok=$?
if [[ $network_ok ]]; then
if [[ -f ~/.local/share/zeesh/update.tbl ]]; then
eval $(cat ~/.local/share/zeesh/update.tbl)
else
lastchk=0
fi
curtime=$(date +%s)
# if it's been fifteen minutes since the last update, do the update
[[ ${curtime} -gt $(( lastchk + 900 )) ]] && zeesh_update
fi
else
ticker_message "zeesh: skipping updates (fuse blown)"
fi

View File

@ -17,7 +17,7 @@ zstyle ':completion:*' select-prompt '%F{blue}%B%l%b \(%p\)%f'
zstyle ':completion:*' squeeze-slashes true
zstyle ':completion:*' use-compctl true
zstyle ':completion:*' verbose true
zstyle :compinstall filename '/home/nicole/.local/share/zeesh/compinstall.zsh'
zstyle :compinstall filename '/home/nicole/.local/share/zeesh/modules/compinstall.zsh'
autoload -Uz compinit
compinit

42
modules/kbd.zsh Normal file
View File

@ -0,0 +1,42 @@
# stolen from ArchWiki
# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo
typeset -g -A key
key[Home]="${terminfo[khome]}"
key[End]="${terminfo[kend]}"
key[Insert]="${terminfo[kich1]}"
key[Backspace]="${terminfo[kbs]}"
key[Delete]="${terminfo[kdch1]}"
key[Up]="${terminfo[kcuu1]}"
key[Down]="${terminfo[kcud1]}"
key[Left]="${terminfo[kcub1]}"
key[Right]="${terminfo[kcuf1]}"
key[PageUp]="${terminfo[kpp]}"
key[PageDown]="${terminfo[knp]}"
key[Shift-Tab]="${terminfo[kcbt]}"
# setup key accordingly
[[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode
[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char
[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history
[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char
[[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
autoload -Uz add-zle-hook-widget
function zle_application_mode_start { echoti smkx }
function zle_application_mode_stop { echoti rmkx }
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
fi

4
modules/opam.zsh Normal file
View File

@ -0,0 +1,4 @@
# opam configuration
[[ ! -r /home/nicole/.opam/opam-init/init.zsh ]] || source /home/nicole/.opam/opam-init/init.zsh > /dev/null 2> /dev/null