-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add profiling support - Minor cleanups to zqs switch code to make it more readable Signed-off-by: Joe Block <[email protected]>
- Loading branch information
Showing
1 changed file
with
45 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
if [[ -f ~/.zqs-zprof-enabled ]]; then | ||
zmodload zsh/zprof | ||
fi | ||
# Copyright 2006-2023 Joseph Block <[email protected]> | ||
# | ||
# BSD licensed, see LICENSE.txt | ||
|
@@ -155,7 +158,7 @@ function _zqs-update-stale-settings-files() { | |
# pollution in the user's environment. | ||
if [[ -z "ZSH_QUICKSTART_SKIP_TRAPINT" ]]; then | ||
echo "'ZSH_QUICKSTART_SKIP_TRAPINT' is deprecated in favor of running 'zqs disable-control-c-decorator' to write a settings knob." | ||
zqs-quickstart-disable-control-c-decorator | ||
zqs-disable-control-c-decorator | ||
fi | ||
} | ||
|
||
|
@@ -178,21 +181,21 @@ function zsh-quickstart-select-powerlevel10k() { | |
# Binary feature settings functions should always be named | ||
# zsh-quickstart-disable-FEATURE and zsh-quickstart-enable-FEATURE | ||
|
||
function zsh-quickstart-disable-bindkey-handling() { | ||
function zqs-disable-bindkey-handling() { | ||
_zqs-set-setting handle-bindkeys false | ||
} | ||
|
||
function zsh-quickstart-enable-bindkey-handling() { | ||
function zqs-enable-bindkey-handling() { | ||
_zqs-set-setting handle-bindkeys true | ||
} | ||
|
||
function zqs-quickstart-disable-control-c-decorator() { | ||
function zqs-disable-control-c-decorator() { | ||
_zqs-set-setting control-c-decorator false | ||
echo "Disabled the control-c decorator in future zsh sessions." | ||
echo "You can re-enable the quickstart's control-c decorator by running 'zqs enable-control-c-decorator'" | ||
} | ||
|
||
function zqs-quickstart-enable-control-c-decorator() { | ||
function zqs-enable-control-c-decorator() { | ||
echo "The control-c decorator is enabled for future zsh sessions." | ||
echo "You can disable the quickstart's control-c decorator by running 'zqs disable-control-c-decorator'" | ||
_zqs-set-setting control-c-decorator true | ||
|
@@ -767,18 +770,28 @@ function zqs-help() { | |
echo "Quickstart settings commands:" | ||
echo "zqs disable-bindkey-handling - Set the quickstart to not touch any bindkey settings. Useful if you're using another plugin to handle it." | ||
echo "zqs enable-bindkey-handling - Set the quickstart to configure your bindkey settings. This is the default behavior." | ||
|
||
echo "zqs enable-control-c-decorator - Creates a TRAPINT function to display '^C' when you type control-c instead of being silent. Default behavior." | ||
echo "zqs disable-control-c-decorator - No longer creates a TRAPINT function to display '^C' when you type control-c." | ||
echo "zqs disable-omz-plugins - Set the quickstart to not load oh-my-zsh plugins if you're using the standard plugin list" | ||
|
||
echo "zqs enable-omz-plugins - Set the quickstart to load oh-my-zsh plugins if you're using the standard plugin list" | ||
echo "zqs disable-omz-plugins - Set the quickstart to not load oh-my-zsh plugins if you're using the standard plugin list" | ||
|
||
echo "zqs enable-ssh-askpass-require - Set the quickstart to prompt for your ssh passphrase on the command line." | ||
echo "zqs disable-ssh-askpass-require - Set the quickstart to prompt for your ssh passphrase via a gui program. This is the default behavior" | ||
|
||
echo "zqs disable-ssh-key-listing - Set the quickstart to not display all the loaded ssh keys" | ||
echo "zqs enable-ssh-key-listing - Set the quickstart to display all the loaded ssh keys. This is the default behavior." | ||
|
||
echo "zqs disable-ssh-key-loading - Set the quickstart to not load your ssh keys. Useful if you're storing them in a yubikey." | ||
echo "zqs enable-ssh-key-loading - Set the quickstart to load your ssh keys if they aren't already in an ssh agent. This is the default behavior." | ||
|
||
echo "zqs disable-zmv-autoloading - Set the quickstart to not run 'autoload -U zmv'. Useful if you're using another plugin to handle it." | ||
echo "zqs enable-zmv-autoloading - Set the quickstart to run 'autoload -U zmv'. This is the default behavior." | ||
|
||
echo "zqs enable-zsh-profiling - Set the quickstart to turn on global profiling" | ||
echo "zqs disable-zsh-profiling - Set the quickstart to disable global profiling" | ||
|
||
echo "zqs delete-setting SETTINGNAME - Remove a zqs setting file" | ||
echo "zqs get-setting SETTINGNAME [optional default value] - load a zqs setting" | ||
echo "zqs set-setting SETTINGNAME value - Set an arbitrary zqs setting" | ||
|
@@ -790,16 +803,17 @@ function zqs() { | |
_check-for-zsh-quickstart-update | ||
;; | ||
'disable-bindkey-handling') | ||
zsh-quickstart-disable-bindkey-handling | ||
zqs-disable-bindkey-handling | ||
;; | ||
'enable-bindkey-handling') | ||
zsh-quickstart-enable-bindkey-handling | ||
zqs-enable-bindkey-handling | ||
;; | ||
|
||
'disable-control-c-decorator') | ||
zqs-quickstart-disable-control-c-decorator | ||
zqs-disable-control-c-decorator | ||
;; | ||
'enable-control-c-decorator') | ||
zqs-quickstart-enable-control-c-decorator | ||
zqs-enable-control-c-decorator | ||
;; | ||
|
||
'disable-zmv-autoloading') | ||
|
@@ -808,30 +822,44 @@ function zqs() { | |
'enable-zmv-autoloading') | ||
_zqs-enable-zmv-autoloading | ||
;; | ||
|
||
'disable-omz-plugins') | ||
zsh-quickstart-disable-omz-plugins | ||
;; | ||
'enable-omz-plugins') | ||
zsh-quickstart-enable-omz-plugins | ||
;; | ||
|
||
'enable-ssh-askpass-require') | ||
zsh-quickstart-enable-ssh-askpass-require | ||
;; | ||
'disable-ssh-askpass-require') | ||
zsh-quickstart-disable-ssh-askpass-require | ||
;; | ||
|
||
'enable-ssh-key-listing') | ||
_zqs-set-setting list-ssh-keys true | ||
;; | ||
'disable-ssh-key-listing') | ||
_zqs-set-setting list-ssh-keys false | ||
;; | ||
|
||
'disable-ssh-key-loading') | ||
_zqs-set-setting load-ssh-keys false | ||
;; | ||
'enable-ssh-key-loading') | ||
_zqs-set-setting load-ssh-keys true | ||
;; | ||
|
||
# Profiling checks happen before the settings code is loaded, so we | ||
# touch the actual file instead of reading via _zqs-get-setting | ||
'disable-zsh-profiling') | ||
touch ~/.zqs-zprof-enabled | ||
;; | ||
'enable-zsh-profiling') | ||
rm -f ~/.zqs-zprof-enabled | ||
;; | ||
|
||
'selfupdate') | ||
_update-zsh-quickstart | ||
;; | ||
|
@@ -842,9 +870,11 @@ function zqs() { | |
'update-plugins') | ||
zgenom update | ||
;; | ||
|
||
'cleanup') | ||
zgenom clean | ||
;; | ||
|
||
'delete-setting') | ||
shift | ||
_zqs-delete-setting $@ | ||
|
@@ -857,9 +887,14 @@ function zqs() { | |
shift | ||
_zqs-set-setting $@ | ||
;; | ||
|
||
*) | ||
zqs-help | ||
;; | ||
|
||
esac | ||
} | ||
|
||
if [[ -f ~/.zqs-zprof-enabled ]]; then | ||
zprof | ||
fi |