1
0
mirror of https://github.com/akelge/zsh synced 2025-12-14 22:25:13 +00:00

Added async module and hooks management

This commit is contained in:
2021-12-16 11:26:05 +01:00
parent c8576d59ca
commit 293ef30aaa
4 changed files with 705 additions and 3 deletions

27
zsh.d/60-hooks.zsh Normal file
View File

@ -0,0 +1,27 @@
# Hooks for zsh
#
# - precmd
# - chpwd
# - preexec
# - periodic
# - zshaddhistory
# - zshexit
#
# Gitfetch precmd hook
# Empty, but required, callback function
# We can implement logging here
function completed_callback() {}
# Create worker for async precmd
async_start_worker _precmd
async_register_callback _precmd completed_callback
# Async invocation of gitfect on precmd worker
function gitfetch_hook() {
async_job _precmd gitfetch $PWD
}
# Add async function to precmd hook
add-zsh-hook precmd gitfetch_hook