This patch adds the git library function for building a
short string that represents the output of git diff --numstat.
This gives theme designers the ability to add the
Number of files changed, number of lines added and number of
lines removed in their prompt for a git repository, while the user's
current working directory is in the git repo.
The new function supports prefix and suffix for each of the
options, files changed, lines added and lines removed.
To colorize the output, you can do something like this in your
theme file
ZSH_THEME_GIT_FILES_CHANGED_PREFIX="%{$fg[yellow]%}"
ZSH_THEME_GIT_FILES_CHANGED_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_LINES_ADDED_PREFIX="%{$fg[green]%}"
ZSH_THEME_GIT_LINES_ADDED_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_LINES_REMOVED_PREFIX="%{$fg[red]%}"
ZSH_THEME_GIT_LINES_REMOVED_SUFFIX="%{$fg[blue]%}"
For example, if there are
3 files changed, 10 lines added and no lines removed you will get
3f:10+
1 files changed, 20 lines added and 6 lines removed:
1f:20+:6-
- single line
- quite simple by default: user@host:$PWD
- green for local shell as non root
- red for ssh shell as non root
- magenta for root sessions
- prefix with remote address for ssh shells
- prefix to detect docker containers or chroot
- git plugin to display current branch and status
The sub-command `reclaim` is quite useful for freeing up disk space.
`reclaim` is a useful command that is missing from the list of completions in the plugin.
The description is for the `reclaim` sub-command is:
"port reclaim will find files that can be removed to reclaim disk space by uninstalling inactive ports on your system as well as unnecessary unrequested ports, and removing unneeded or unused installation files. The user is then provided interactive options for files to remove. No files are removed initially, until the user selects them from the provided list."
For all the details use this command on a system with Macports installed:
`port help reclaim`
BREAKING CHANGE: the key binding to open an editor to edit the command line has
been moved from being `v` (press v once) to being `vv` (press v twice). Now, the
action for `v` is the default `visual-mode`, as is in Vim.
Fixes#9573
- Added follow redirects curl flag to fix the 301 response
- Updated trusted users URL format
- Changed from `pgp.mit.edu` keyserver to `keyserver.ubuntu.com` keyserver
It wasn’t clear where I should set the `NVM_AUTOLOAD` variable. The clue was to be found in [the docs for another plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/fzf). It seems setting values need to come before Oh My Zsh is sourced.
Updated read me to reflect this, and the fact that one of the settings mentioned is specific to nvm, not this plugin.
BREAKING CHANGE: changes deprecated `brew cask reinstall $(...)` alias to use
`brew upgrade --cask` instead. If you don't have this command, run `brew update` to
get the latest Homebrew CLI version.
Co-authored-by: jakepez <jake@findjake.com>
*Bugs*
The following bugs have been fixed:
- All generators ignored errors from external commands. For example,
if `/usr/share/dict/words` was unreadable, `genpass-xkcd` would
print "0-" as a password and return success.
- All generators silently ignored the argument if it wasn't a number.
For example, `genpass-apple -2` was generating one password and
not printing any errors.
- All generators silently ignored extra arguments. For example,
`genpass-apple -n 2` was generating one password and not printing
any errors.
- `genpass-xkcd` was generating passwords with less than 128 bits of
security margin in contradiction to documentation. The smaller the
dictionary size, the weaker the passwords it was generating. For a
dictionary with 27 words, `genpass-xkcd` was generating passwords
with 93 bits of security margin (`log2(27!)`).
- The source of random data used by `genpass-xkcd` was not
cryptographically secure in contradiction to documentation. See:
https://www.gnu.org/software/coreutils/manual/html_node/Random-sources.html
- `genpass-apple` could generate a password with non-ascii characters
depending on user locale. For example, passwords could contain 'İ'
for users with Turkish locale.
- `genpass-apple` didn't work with `ksh_arrays` shell option.
- `genpass-xkcd` was printing spurious errors with `ksh_arrays` shell
option.
- `genpass-xkcd` was producing too short (weak) or too strong (long)
and/or printing errors when `IFS` was set to non-default value.
- All generators were printing fewer passwords than requested and
returning success when passed a very large number as an argument.
*Usability*
Generators are now implemented as self-contained executable files.
They can be invoked from scripts with no additional setup.
Generators no longer depend on external commands. The only dependencies
are `/dev/urandom` and, for `genpass-xkcd`, `/usr/share/dict/words`.
All generators used to silently ignore all arguments after the first
and the first argument if it wasn't a number. For example, both
`genpass-apple -2` and `genpass-apple -n 2` were generating one password
and not printing any errors. Now these print an error and fail.
*Performance*
The time it takes to load the plugin has been greatly reduced. This
translates into faster zsh startup when the plugin is enabled.
Incidentally, two generators out of three have been sped up to a large
degree while one generator (`genpass-xkcd`) has gotten slower. This is
unlikely to matter one way or another unless generating a very large
number of passwords. In the latter case `genpass-xkcd` is now also
faster than it used to be.
The following table shows benchmark results from Linux x86-64 on i9-7900X.
The numbers in the second and third columns show how many times a given
command could be executed per second. Higher numbers are better.
command | before (Hz) | after (Hz) | speedup |
----------------------------|------------:|-----------:|--------:|
`source genpass.plugin.zsh` | 4810 | 68700 | +1326% |
`genpass-apple` | 30.3 | 893 | +2846% |
`genpass-monkey` | 203 | 5290 | +2504% |
`genpass-xkcd` | 34.4 | 14.5 | -58% |
`genpass-xkcd 1000` | 0.145 | 0.804 | +454% |
This also allows the option to put extra paragraphs after the BREAKING CHANGE
message while properly displaying the breaking change message. Useful, for
example, to add signed-off or co-authored lines.