Skip to content

Commit

Permalink
Merge pull request #285 from unixorn/add-profiler-option
Browse files Browse the repository at this point in the history
Add profiling support
  • Loading branch information
unixorn authored Feb 29, 2024
2 parents f13efd3 + 4fba82b commit 14eb981
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Running the following commands will toggle behavior the next time you start a sh
* `zsh-quickstart-select-powerlevel10k` - Switch to the [powerlevel10k](https://github.com/romkatv/powerlevel10k) prompt now used as the kit's default.
* `zsh-quickstart-select-bullet-train` - Switch back to the [bullet-train](https://github.com/caiogondim/bullet-train.zsh) prompt originally used in the kit.
* You can disable printing the list of `ssh` keys by executing `zqs disable-ssh-key-listing`.
* `bash` prints `^C` when you're typing a command and hit control-c to cancel it, so it is easy to see it wasn't executed. By default, ZSH doesn't print the `^C`. I prefer seeing the `^C`, so by default, the quickstart traps `SIGINT` and prints the `^C`. You can disable this behavior by running `zqs enable-control-c-decorator`.
* `bash` prints `^C` when you're typing a command and hit control-c to cancel it, so it is easy to see it wasn't executed. By default, ZSH doesn't print the `^C`. I prefer seeing the `^C`, so by default, the quickstart traps `SIGINT` and prints the `^C`. You can disable this behavior by running `zqs disable-control-c-decorator` and enable it with `zqs enable-control-c-decorator`.

#### zqs

Expand Down Expand Up @@ -298,6 +298,14 @@ Don't run `autoload -U zmv` when creating a new session.

Run `autoload -U zmv` when creating a new session. This is the default behavior.

##### `zqs-disable-zsh-profiling

Disable ZSH's profiler. This is the default.

##### `zqs-enable-zsh-profiling

Turn on ZSH's profiler

##### zqs selfupdate

Force an immediate update of the quickstart kit.
Expand Down
15 changes: 15 additions & 0 deletions zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
# All files in there will be sourced, and keeping your customizations
# there will keep you from having to maintain a separate fork of the
# quickstart kit.
if [[ -f ~/.zqs-zprof-enabled ]]; then
zmodload zsh/zprof
fi

# Check if a command exists
function can_haz() {
Expand Down Expand Up @@ -832,6 +835,14 @@ function zqs() {
'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')
rm -f ~/.zqs-zprof-enabled
;;
'enable-zsh-profiling')
touch ~/.zqs-zprof-enabled
;;
'selfupdate')
_update-zsh-quickstart
;;
Expand Down Expand Up @@ -863,3 +874,7 @@ function zqs() {

esac
}

if [[ -f ~/.zqs-zprof-enabled ]]; then
zprof
fi

0 comments on commit 14eb981

Please sign in to comment.