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:
27
zsh.d/60-hooks.zsh
Normal file
27
zsh.d/60-hooks.zsh
Normal 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
|
||||
Reference in New Issue
Block a user