diff options
author | Eric Nielsen <eric@amalgamar.com.br> | 2021-03-15 05:39:35 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-15 11:39:35 +0100 |
commit | 6fd7d7b5010c28d0557e4ff562187098abaa3bc6 (patch) | |
tree | 2967ac86391c8e5f2537c4f12a355171f71ba6cc /src/configs/character.rs | |
parent | c91b293c9df4c014b049ca8cbdf921f02d27537a (diff) |
fix(zsh): Set PROMPT just once (#2428)
No need to forcefully set the `PROMPT` variable every time the prompt is
to be shown. Just set it once, leaving the command to be evaluated every
time the prompt is to be shown, by enabling the `promptsubst` option.
Setting it once is also friendlier to users that want to experiment with
another prompt theme by temporarily setting `PROMPT` to something else.
This would currently not be possible, because the variable is always
reset before every prompt draw (precmd) and keymap change
(zle-keymap-select).
Some other updates to take better advantage of the zsh script dialect:
* `$` is not required to read variables inside `(( ))` arithmetic
expressions.
* The zsh dialect to check if a variable is set is `${+var}`. Better
than `${var+1}`, which substitutes 1 if var is set, which is
intended for more general substitutions, not just to check if var is
set.
* The number of jobs can be read using the `%j` escape sequence, which
is expanded when the `promptpercent` option is set.
Also simplified a couple of code lines by avoiding a temporary
`STARSHIP_START_TIME` variable, since we already have
`STARSHIP_CAPTURED_TIME`.
Diffstat (limited to 'src/configs/character.rs')
0 files changed, 0 insertions, 0 deletions