Merge branch 'main' of git.clustercockpit.org:moebiusband/dotfiles

This commit is contained in:
Jan Eitzinger 2024-03-05 21:05:32 +01:00
commit 6aad5471f4
130 changed files with 618 additions and 1868 deletions

View File

@ -1,5 +1,11 @@
# Changelog # Changelog
## v0.7.0
- Enable asynchronous mode by default (#498)
- No longer wrap user widgets starting with `autosuggest-` prefix (#496)
- Fix a bug wrapping widgets that modify the buffer (#541)
## v0.6.4 ## v0.6.4
- Fix `vi-forward-char` triggering a bell when using it to accept a suggestion (#488) - Fix `vi-forward-char` triggering a bell when using it to accept a suggestion (#488)
- New configuration option to skip completion suggestions when buffer matches a pattern (#487) - New configuration option to skip completion suggestions when buffer matches a pattern (#487)

View File

@ -3,19 +3,21 @@
* [Packages](#packages) * [Packages](#packages)
* [Antigen](#antigen) * [Antigen](#antigen)
* [Oh My Zsh](#oh-my-zsh) * [Oh My Zsh](#oh-my-zsh)
* [HomeBrew](#homebrew)
* [Manual](#manual-git-clone) * [Manual](#manual-git-clone)
## Packages ## Packages
| System | Package | | System | Package |
| ------------- | ------------- | | ------------- | ------------- |
| Alpine Linux | [zsh-autosuggestions](https://pkgs.alpinelinux.org/packages?name=zsh-autosuggestions) |
| Debian / Ubuntu | [zsh-autosuggestions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-autosuggestions&package=zsh-autosuggestions) | | Debian / Ubuntu | [zsh-autosuggestions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-autosuggestions&package=zsh-autosuggestions) |
| Fedora / CentOS / RHEL / Scientific Linux | [zsh-autosuggestions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-autosuggestions&package=zsh-autosuggestions) | | Fedora / CentOS / RHEL / Scientific Linux | [zsh-autosuggestions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-autosuggestions&package=zsh-autosuggestions) |
| OpenSUSE / SLE | [zsh-autosuggestions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-autosuggestions&package=zsh-autosuggestions) | | OpenSUSE / SLE | [zsh-autosuggestions OBS repository](https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-autosuggestions&package=zsh-autosuggestions) |
| Arch Linux / Manjaro / Antergos / Hyperbola | [zsh-autosuggestions](https://www.archlinux.org/packages/zsh-autosuggestions), [zsh-autosuggestions-git](https://aur.archlinux.org/packages/zsh-autosuggestions-git) | | Arch Linux / Manjaro / Antergos / Hyperbola | [zsh-autosuggestions](https://www.archlinux.org/packages/zsh-autosuggestions), [zsh-autosuggestions-git](https://aur.archlinux.org/packages/zsh-autosuggestions-git) |
| NixOS | [zsh-autosuggestions](https://github.com/NixOS/nixpkgs/blob/master/pkgs/shells/zsh/zsh-autosuggestions/default.nix) | | NixOS | [zsh-autosuggestions](https://github.com/NixOS/nixpkgs/blob/master/pkgs/shells/zsh/zsh-autosuggestions/default.nix) |
| Void Linux | [zsh-autosuggestions](https://github.com/void-linux/void-packages/blob/master/srcpkgs/zsh-autosuggestions/template) | | Void Linux | [zsh-autosuggestions](https://github.com/void-linux/void-packages/blob/master/srcpkgs/zsh-autosuggestions/template) |
| Mac OS | [homebrew](https://github.com/Homebrew/homebrew-core/blob/master/Formula/zsh-autosuggestions.rb) | | Mac OS | [homebrew](https://github.com/Homebrew/homebrew-core/blob/master/Formula/z/zsh-autosuggestions.rb) |
| NetBSD | [pkgsrc](http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/shells/zsh-autosuggestions/README.html) | | NetBSD | [pkgsrc](http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/shells/zsh-autosuggestions/README.html) |
## Antigen ## Antigen
@ -39,7 +41,25 @@
2. Add the plugin to the list of plugins for Oh My Zsh to load (inside `~/.zshrc`): 2. Add the plugin to the list of plugins for Oh My Zsh to load (inside `~/.zshrc`):
```sh ```sh
plugins=(zsh-autosuggestions) plugins=(
# other plugins...
zsh-autosuggestions
)
```
3. Start a new terminal session.
## Homebrew
1. Install command:
```sh
brew install zsh-autosuggestions
```
2. To activate the autosuggestions, add the following at the end of your .zshrc:
```sh
source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
``` ```
3. Start a new terminal session. 3. Start a new terminal session.

View File

@ -1,5 +1,5 @@
Copyright (c) 2013 Thiago de Arruda Copyright (c) 2013 Thiago de Arruda
Copyright (c) 2016-2019 Eric Freese Copyright (c) 2016-2021 Eric Freese
Permission is hereby granted, free of charge, to any person Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation obtaining a copy of this software and associated documentation

View File

@ -1,4 +1,4 @@
SRC_DIR := ./src SRC_DIR := ./src
SRC_FILES := \ SRC_FILES := \
$(SRC_DIR)/config.zsh \ $(SRC_DIR)/config.zsh \

View File

@ -53,7 +53,7 @@ For more info, read the Character Highlighting section of the zsh manual: `man z
`ZSH_AUTOSUGGEST_STRATEGY` is an array that specifies how suggestions should be generated. The strategies in the array are tried successively until a suggestion is found. There are currently three built-in strategies to choose from: `ZSH_AUTOSUGGEST_STRATEGY` is an array that specifies how suggestions should be generated. The strategies in the array are tried successively until a suggestion is found. There are currently three built-in strategies to choose from:
- `history`: Chooses the most recent match from history. - `history`: Chooses the most recent match from history.
- `completion`: Chooses a suggestion based on what tab-completion would suggest. (requires `zpty` module) - `completion`: Chooses a suggestion based on what tab-completion would suggest. (requires `zpty` module, which is included with zsh since 4.0.1)
- `match_prev_cmd`: Like `history`, but chooses the most recent match whose preceding history item matches the most recently executed command ([more info](src/strategies/match_prev_cmd.zsh)). Note that this strategy won't work as expected with ZSH options that don't preserve the history order such as `HIST_IGNORE_ALL_DUPS` or `HIST_EXPIRE_DUPS_FIRST`. - `match_prev_cmd`: Like `history`, but chooses the most recent match whose preceding history item matches the most recently executed command ([more info](src/strategies/match_prev_cmd.zsh)). Note that this strategy won't work as expected with ZSH options that don't preserve the history order such as `HIST_IGNORE_ALL_DUPS` or `HIST_EXPIRE_DUPS_FIRST`.
For example, setting `ZSH_AUTOSUGGEST_STRATEGY=(history completion)` will first try to find a suggestion from your history, but, if it can't find a match, will find a suggestion from the completion engine. For example, setting `ZSH_AUTOSUGGEST_STRATEGY=(history completion)` will first try to find a suggestion from your history, but, if it can't find a match, will find a suggestion from the completion engine.
@ -79,9 +79,11 @@ Widgets that modify the buffer and are not found in any of these arrays will fet
Set `ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE` to an integer value to disable autosuggestion for large buffers. The default is unset, which means that autosuggestion will be tried for any buffer size. Recommended value is 20. Set `ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE` to an integer value to disable autosuggestion for large buffers. The default is unset, which means that autosuggestion will be tried for any buffer size. Recommended value is 20.
This can be useful when pasting large amount of text in the terminal, to avoid triggering autosuggestion for strings that are too long. This can be useful when pasting large amount of text in the terminal, to avoid triggering autosuggestion for strings that are too long.
### Enable Asynchronous Mode ### Asynchronous Mode
As of `v0.4.0`, suggestions can be fetched asynchronously. To enable this behavior, set the `ZSH_AUTOSUGGEST_USE_ASYNC` variable (it can be set to anything). Suggestions are fetched asynchronously by default in zsh versions 5.0.8 and greater. To disable asynchronous suggestions and fetch them synchronously instead, `unset ZSH_AUTOSUGGEST_USE_ASYNC` after sourcing the plugin.
Alternatively, if you are using a version of zsh older than 5.0.8 and want to enable asynchronous mode, set the `ZSH_AUTOSUGGEST_USE_ASYNC` variable after sourcing the plugin (it can be set to anything). Note that there is [a bug](https://github.com/zsh-users/zsh-autosuggestions/issues/364#issuecomment-481423232) in versions of zsh older than 5.0.8 where <kbd>ctrl</kbd> + <kbd>c</kbd> will fail to reset the prompt immediately after fetching a suggestion asynchronously.
### Disabling automatic widget re-binding ### Disabling automatic widget re-binding
@ -89,13 +91,13 @@ Set `ZSH_AUTOSUGGEST_MANUAL_REBIND` (it can be set to anything) to disable autom
### Ignoring history suggestions that match a pattern ### Ignoring history suggestions that match a pattern
Set `ZSH_AUTOSUGGEST_HISTORY_IGNORE` to a glob pattern to prevent offering suggestions for history entries that match the pattern. For example, set it to `"cd *"` to never suggest any `cd` commands from history. Or set to `"?(#c50,)"` to never suggest anything 50 characters or longer. Set `ZSH_AUTOSUGGEST_HISTORY_IGNORE` to a [glob pattern](http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Operators) to prevent offering suggestions for history entries that match the pattern. For example, set it to `"cd *"` to never suggest any `cd` commands from history. Or set to `"?(#c50,)"` to never suggest anything 50 characters or longer.
**Note:** This only affects the `history` and `match_prev_cmd` suggestion strategies. **Note:** This only affects the `history` and `match_prev_cmd` suggestion strategies.
### Skipping completion suggestions for certain cases ### Skipping completion suggestions for certain cases
Set `ZSH_AUTOSUGGEST_COMPLETION_IGNORE` to a glob pattern to prevent offering completion suggestions when the buffer matches that pattern. For example, set it to `"git *"` to disable completion suggestions for git subcommands. Set `ZSH_AUTOSUGGEST_COMPLETION_IGNORE` to a [glob pattern](http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Operators) to prevent offering completion suggestions when the buffer matches that pattern. For example, set it to `"git *"` to disable completion suggestions for git subcommands.
**Note:** This only affects the `completion` suggestion strategy. **Note:** This only affects the `completion` suggestion strategy.

View File

@ -1 +1 @@
v0.6.4 v0.7.0

View File

@ -14,3 +14,4 @@
5.5.1 5.5.1
5.6.2 5.6.2
5.7.1 5.7.1
5.8

View File

@ -1,15 +0,0 @@
version: 2
jobs:
build:
parallelism: 4
shell: /bin/bash --login
docker:
- image: ericfreese/zsh-autosuggestions-test:latest
steps:
- checkout
- run:
name: Running tests
command: |
for v in $(grep "^[^#]" ZSH_VERSIONS | awk "(NR + $CIRCLE_NODE_INDEX) % $CIRCLE_NODE_TOTAL == 0"); do
TEST_ZSH_BIN=zsh-$v make test || exit 1
done

View File

@ -1,18 +0,0 @@
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4
[*.md]
indent_style = space
[*.rb]
indent_style = space
indent_size = 2
[*.yml]
indent_style = space
indent_size = 2

View File

@ -1 +0,0 @@
ref: refs/heads/master

View File

@ -1,13 +0,0 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://github.com/zsh-users/zsh-autosuggestions
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master

View File

@ -1 +0,0 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@ -1,15 +0,0 @@
#!/bin/sh
#
# An example hook script to check the commit log message taken by
# applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit. The hook is
# allowed to edit the commit message file.
#
# To enable this hook, rename this file to "applypatch-msg".
. git-sh-setup
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
:

View File

@ -1,24 +0,0 @@
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
# This example catches duplicate Signed-off-by lines.
test "" = "$(grep '^Signed-off-by: ' "$1" |
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
echo >&2 Duplicate Signed-off-by lines.
exit 1
}

View File

@ -1,114 +0,0 @@
#!/usr/bin/perl
use strict;
use warnings;
use IPC::Open2;
# An example hook script to integrate Watchman
# (https://facebook.github.io/watchman/) with git to speed up detecting
# new and modified files.
#
# The hook is passed a version (currently 1) and a time in nanoseconds
# formatted as a string and outputs to stdout all files that have been
# modified since the given time. Paths must be relative to the root of
# the working tree and separated by a single NUL.
#
# To enable this hook, rename this file to "query-watchman" and set
# 'git config core.fsmonitor .git/hooks/query-watchman'
#
my ($version, $time) = @ARGV;
# Check the hook interface version
if ($version == 1) {
# convert nanoseconds to seconds
$time = int $time / 1000000000;
} else {
die "Unsupported query-fsmonitor hook version '$version'.\n" .
"Falling back to scanning...\n";
}
my $git_work_tree;
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
$git_work_tree = Win32::GetCwd();
$git_work_tree =~ tr/\\/\//;
} else {
require Cwd;
$git_work_tree = Cwd::cwd();
}
my $retry = 1;
launch_watchman();
sub launch_watchman {
my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
or die "open2() failed: $!\n" .
"Falling back to scanning...\n";
# In the query expression below we're asking for names of files that
# changed since $time but were not transient (ie created after
# $time but no longer exist).
#
# To accomplish this, we're using the "since" generator to use the
# recency index to select candidate nodes and "fields" to limit the
# output to file names only. Then we're using the "expression" term to
# further constrain the results.
#
# The category of transient files that we want to ignore will have a
# creation clock (cclock) newer than $time_t value and will also not
# currently exist.
my $query = <<" END";
["query", "$git_work_tree", {
"since": $time,
"fields": ["name"],
"expression": ["not", ["allof", ["since", $time, "cclock"], ["not", "exists"]]]
}]
END
print CHLD_IN $query;
close CHLD_IN;
my $response = do {local $/; <CHLD_OUT>};
die "Watchman: command returned no output.\n" .
"Falling back to scanning...\n" if $response eq "";
die "Watchman: command returned invalid output: $response\n" .
"Falling back to scanning...\n" unless $response =~ /^\{/;
my $json_pkg;
eval {
require JSON::XS;
$json_pkg = "JSON::XS";
1;
} or do {
require JSON::PP;
$json_pkg = "JSON::PP";
};
my $o = $json_pkg->new->utf8->decode($response);
if ($retry > 0 and $o->{error} and $o->{error} =~ m/unable to resolve root .* directory (.*) is not watched/) {
print STDERR "Adding '$git_work_tree' to watchman's watch list.\n";
$retry--;
qx/watchman watch "$git_work_tree"/;
die "Failed to make watchman watch '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
# Watchman will always return all files on the first query so
# return the fast "everything is dirty" flag to git and do the
# Watchman query just to get it over with now so we won't pay
# the cost in git to look up each individual file.
print "/\0";
eval { launch_watchman() };
exit 0;
}
die "Watchman: $o->{error}.\n" .
"Falling back to scanning...\n" if $o->{error};
binmode STDOUT, ":utf8";
local $, = "\0";
print @{$o->{files}};
}

View File

@ -1,8 +0,0 @@
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
exec git update-server-info

View File

@ -1,14 +0,0 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed
# by applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-applypatch".
. git-sh-setup
precommit="$(git rev-parse --git-path hooks/pre-commit)"
test -x "$precommit" && exec "$precommit" ${1+"$@"}
:

View File

@ -1,49 +0,0 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --

View File

@ -1,13 +0,0 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git merge" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message to
# stderr if it wants to stop the merge commit.
#
# To enable this hook, rename this file to "pre-merge-commit".
. git-sh-setup
test -x "$GIT_DIR/hooks/pre-commit" &&
exec "$GIT_DIR/hooks/pre-commit"
:

View File

@ -1,53 +0,0 @@
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
# <local ref> <local sha1> <remote ref> <remote sha1>
#
# This sample shows how to prevent push of commits where the log message starts
# with "WIP" (work in progress).
remote="$1"
url="$2"
z40=0000000000000000000000000000000000000000
while read local_ref local_sha remote_ref remote_sha
do
if [ "$local_sha" = $z40 ]
then
# Handle delete
:
else
if [ "$remote_sha" = $z40 ]
then
# New branch, examine all commits
range="$local_sha"
else
# Update to existing branch, examine new commits
range="$remote_sha..$local_sha"
fi
# Check for WIP commit
commit=`git rev-list -n 1 --grep '^WIP' "$range"`
if [ -n "$commit" ]
then
echo >&2 "Found WIP commit in $local_ref, not pushing"
exit 1
fi
fi
done
exit 0

View File

@ -1,169 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $2 -- the branch being rebased (or empty when rebasing the current branch).
#
# This sample shows how to prevent topic branches that are already
# merged to 'next' branch from getting rebased, because allowing it
# would result in rebasing already published history.
publish=next
basebranch="$1"
if test "$#" = 2
then
topic="refs/heads/$2"
else
topic=`git symbolic-ref HEAD` ||
exit 0 ;# we do not interrupt rebasing detached HEAD
fi
case "$topic" in
refs/heads/??/*)
;;
*)
exit 0 ;# we do not interrupt others.
;;
esac
# Now we are dealing with a topic branch being rebased
# on top of master. Is it OK to rebase it?
# Does the topic really exist?
git show-ref -q "$topic" || {
echo >&2 "No such branch $topic"
exit 1
}
# Is topic fully merged to master?
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
if test -z "$not_in_master"
then
echo >&2 "$topic is fully merged to master; better remove it."
exit 1 ;# we could allow it, but there is no point.
fi
# Is topic ever merged to next? If so you should not be rebasing it.
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
only_next_2=`git rev-list ^master ${publish} | sort`
if test "$only_next_1" = "$only_next_2"
then
not_in_topic=`git rev-list "^$topic" master`
if test -z "$not_in_topic"
then
echo >&2 "$topic is already up to date with master"
exit 1 ;# we could allow it, but there is no point.
else
exit 0
fi
else
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
/usr/bin/perl -e '
my $topic = $ARGV[0];
my $msg = "* $topic has commits already merged to public branch:\n";
my (%not_in_next) = map {
/^([0-9a-f]+) /;
($1 => 1);
} split(/\n/, $ARGV[1]);
for my $elem (map {
/^([0-9a-f]+) (.*)$/;
[$1 => $2];
} split(/\n/, $ARGV[2])) {
if (!exists $not_in_next{$elem->[0]}) {
if ($msg) {
print STDERR $msg;
undef $msg;
}
print STDERR " $elem->[1]\n";
}
}
' "$topic" "$not_in_next" "$not_in_master"
exit 1
fi
<<\DOC_END
This sample hook safeguards topic branches that have been
published from being rewound.
The workflow assumed here is:
* Once a topic branch forks from "master", "master" is never
merged into it again (either directly or indirectly).
* Once a topic branch is fully cooked and merged into "master",
it is deleted. If you need to build on top of it to correct
earlier mistakes, a new topic branch is created by forking at
the tip of the "master". This is not strictly necessary, but
it makes it easier to keep your history simple.
* Whenever you need to test or publish your changes to topic
branches, merge them into "next" branch.
The script, being an example, hardcodes the publish branch name
to be "next", but it is trivial to make it configurable via
$GIT_DIR/config mechanism.
With this workflow, you would want to know:
(1) ... if a topic branch has ever been merged to "next". Young
topic branches can have stupid mistakes you would rather
clean up before publishing, and things that have not been
merged into other branches can be easily rebased without
affecting other people. But once it is published, you would
not want to rewind it.
(2) ... if a topic branch has been fully merged to "master".
Then you can delete it. More importantly, you should not
build on top of it -- other people may already want to
change things related to the topic as patches against your
"master", so if you need further changes, it is better to
fork the topic (perhaps with the same name) afresh from the
tip of "master".
Let's look at this example:
o---o---o---o---o---o---o---o---o---o "next"
/ / / /
/ a---a---b A / /
/ / / /
/ / c---c---c---c B /
/ / / \ /
/ / / b---b C \ /
/ / / / \ /
---o---o---o---o---o---o---o---o---o---o---o "master"
A, B and C are topic branches.
* A has one fix since it was merged up to "next".
* B has finished. It has been fully merged up to "master" and "next",
and is ready to be deleted.
* C has not merged to "next" at all.
We would want to allow C to be rebased, refuse A, and encourage
B to be deleted.
To compute (1):
git rev-list ^master ^topic next
git rev-list ^master next
if these match, topic has not merged in next at all.
To compute (2):
git rev-list master..topic
if this is empty, it is fully merged to "master".
DOC_END

View File

@ -1,24 +0,0 @@
#!/bin/sh
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
if test -n "$GIT_PUSH_OPTION_COUNT"
then
i=0
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
do
eval "value=\$GIT_PUSH_OPTION_$i"
case "$value" in
echoback=*)
echo "echo from the pre-receive-hook: ${value#*=}" >&2
;;
reject)
exit 1
esac
i=$((i + 1))
done
fi

View File

@ -1,42 +0,0 @@
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg".
# This hook includes three examples. The first one removes the
# "# Please enter the commit message..." help message.
#
# The second includes the output of "git diff --name-status -r"
# into the message, just before the "git status" output. It is
# commented because it doesn't cope with --amend or with squashed
# commits.
#
# The third example adds a Signed-off-by line to the message, that can
# still be edited. This is rarely a good idea.
COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
# case "$COMMIT_SOURCE,$SHA1" in
# ,|template,)
# /usr/bin/perl -i.bak -pe '
# print "\n" . `git diff --cached --name-status -r`
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
# *) ;;
# esac
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
# if test -z "$COMMIT_SOURCE"
# then
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
# fi

View File

@ -1,128 +0,0 @@
#!/bin/sh
#
# An example hook script to block unannotated tags from entering.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
# Config
# ------
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won't be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won't be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
# hooks.denycreatebranch
# This boolean sets whether remotely creating branches will be denied
# in the repository. By default this is allowed.
#
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
# --- Safety check
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
echo " (if you want, you could supply GIT_DIR then run" >&2
echo " $0 <ref> <oldrev> <newrev>)" >&2
exit 1
fi
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
exit 1
fi
# --- Config
allowunannotated=$(git config --bool hooks.allowunannotated)
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
denycreatebranch=$(git config --bool hooks.denycreatebranch)
allowdeletetag=$(git config --bool hooks.allowdeletetag)
allowmodifytag=$(git config --bool hooks.allowmodifytag)
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
case "$projectdesc" in
"Unnamed repository"* | "")
echo "*** Project description file hasn't been set" >&2
exit 1
;;
esac
# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a ref.
zero="0000000000000000000000000000000000000000"
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else
newrev_type=$(git cat-file -t $newrev)
fi
case "$refname","$newrev_type" in
refs/tags/*,commit)
# un-annotated tag
short_refname=${refname##refs/tags/}
if [ "$allowunannotated" != "true" ]; then
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1
fi
;;
refs/tags/*,delete)
# delete tag
if [ "$allowdeletetag" != "true" ]; then
echo "*** Deleting a tag is not allowed in this repository" >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
then
echo "*** Tag '$refname' already exists." >&2
echo "*** Modifying a tag is not allowed in this repository." >&2
exit 1
fi
;;
refs/heads/*,commit)
# branch
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
echo "*** Creating a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/heads/*,delete)
# delete branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/remotes/*,commit)
# tracking branch
;;
refs/remotes/*,delete)
# delete tracking branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
exit 1
fi
;;
*)
# Anything else (is there anything else?)
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
exit 1
;;
esac
# --- Finished
exit 0

View File

@ -1,6 +0,0 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

View File

@ -1 +0,0 @@
0000000000000000000000000000000000000000 ae315ded4dba10685dbbafbfa2ff3c1aefeb490d Jan Eitzinger <jan.eitzinger@fau.de> 1610815475 +0100 clone: from https://github.com/zsh-users/zsh-autosuggestions

View File

@ -1 +0,0 @@
0000000000000000000000000000000000000000 ae315ded4dba10685dbbafbfa2ff3c1aefeb490d Jan Eitzinger <jan.eitzinger@fau.de> 1610815475 +0100 clone: from https://github.com/zsh-users/zsh-autosuggestions

View File

@ -1 +0,0 @@
0000000000000000000000000000000000000000 ae315ded4dba10685dbbafbfa2ff3c1aefeb490d Jan Eitzinger <jan.eitzinger@fau.de> 1610815475 +0100 clone: from https://github.com/zsh-users/zsh-autosuggestions

View File

@ -1,50 +0,0 @@
# pack-refs with: peeled fully-peeled sorted
eff0894a138f64f2752c0e2f0612055d71b0af4f refs/remotes/origin/develop
b27277e7ff0f877f3189211ccd57da9ebec5e743 refs/remotes/origin/experiments/strategies-by-pattern
767d55eba0355d9ef9270df3ca257a936cf0eac5 refs/remotes/origin/features/background-initialization
36dae44064a7bf088fb1dec74c8463d5b6f3d3c8 refs/remotes/origin/features/hist-words-suggestions
161de32912a3426dc686db38250913227dd91948 refs/remotes/origin/features/redraw-hook
15bcfd712664bb301113761f886718fd3bea7bc2 refs/remotes/origin/fixes/copy-earlier-word
141f497d1751ea7c8f3bd7e4fb0e2e031d6d302b refs/remotes/origin/fixes/kill-multiple-words
4ccfdb2435ea4b82983bf22bb2913c0773992cce refs/remotes/origin/fixes/partial-accept-duplicate-word
9fb96753069b919deaaacb6f659be2339dfeb4d2 refs/remotes/origin/fixes/slow_bracketed_paste_magic
ae315ded4dba10685dbbafbfa2ff3c1aefeb490d refs/remotes/origin/master
20c0ea841bafa78d8fb75c767e780248bfdf11a4 refs/remotes/origin/no-server
5f13490bae58bc42045b2a19fc3e446df75417a5 refs/tags/0.0.1
7dc9e0f92631d03d289bdcf67530c84e72b18aa3 refs/tags/pre-v0.1.0
6a4b2b386534461d479155c7f9503b1063800398 refs/tags/v0.1.0
f154d25fb3b734235bff7d508d885e7db851c4ca refs/tags/v0.1.1
0ae590729428a0b6aea682a04d74404a124cb909 refs/tags/v0.2.0
31452887d20069d882e31eafaf46890e6500b4af refs/tags/v0.2.1
2b449a62f8b6fc69e44db3eaf46c5c36c1853bfa refs/tags/v0.2.10
ba029e83d0aa2d859d7ac46299462fa5b5a43a68 refs/tags/v0.2.11
aa859a282dddf97cadce45255fad95930fc3f503 refs/tags/v0.2.12
2a5791710a9038ad21b9f528e6923f33fe3b8edd refs/tags/v0.2.13
9d100f4f321000b80b73638a6406e8486c35ce16 refs/tags/v0.2.14
c761dc81509b137748190d254e8beb6845dedf21 refs/tags/v0.2.15
0a42f872b84ecdd17b2d4d4e4422f3af8bf8959b refs/tags/v0.2.16
f0a745576ff69fa608421ee7214d4cd77b43e62f refs/tags/v0.2.17
011f5420fcc61d1c8fdd7510c4b560b0ca7f6412 refs/tags/v0.2.2
266437c98a7e3d9b24fa82e6a35d8dc54946f1d2 refs/tags/v0.2.3
cd71081303287498f940e6158cfce13583d4293f refs/tags/v0.2.4
76f415bf4360705a819c92787b188ddd813d374c refs/tags/v0.2.5
3ce1adb55dfb558c7f9b60056356fdb7d3567403 refs/tags/v0.2.6
45ab49d1f2024f9422ab9eb41178e4d9edf2e91c refs/tags/v0.2.7
dd9a8789a758966eed6943adad5338b2213df4a2 refs/tags/v0.2.8
0faa2b6584928a17fef8904e8439d1268729f37a refs/tags/v0.2.9
1ed9155f89956310eb0cfce59f95e6f3e2ecbcd2 refs/tags/v0.3.0
87facd9b85630f288433aa0a20a963cffc612ee5 refs/tags/v0.3.1
cce68de46d37697f561a23c51db629ee2bbd18db refs/tags/v0.3.2
9cfaf5d3424ceb5fedd2c7e3253f823faae74383 refs/tags/v0.3.3
2cb6eb6e29852e64a146b0284275ecdc0661b082 refs/tags/v0.4.0
9f9237ab8a530eeff389161202bbc7283ad6af3e refs/tags/v0.4.1
15931f04ffac91a2f9a1a044b6b3ee4050751064 refs/tags/v0.4.2
d7c796719e6352666f7a9c94da9ddaed10f3217d refs/tags/v0.4.3
a7f0106b31c2538a36cab30428e6ca65d9a2ae60 refs/tags/v0.5.0
cbf0e24b1863c44606bbdd1edcb1c1b40efbcb55 refs/tags/v0.5.1
733abd4af0f23f217caa2a303fbef66382d19d6f refs/tags/v0.5.2
b3b34eab49b8e44f2df93d746640329a45722c0b refs/tags/v0.6.0
112dd3e3c7d1e038c46a2af92d38f4b9aa2ffb17 refs/tags/v0.6.1
c80605595c209e4ee60c3d121ab159ebc6d66547 refs/tags/v0.6.2
146020d9b28c70a5edd93d19bbef9c5cb05d4b62 refs/tags/v0.6.3
ae315ded4dba10685dbbafbfa2ff3c1aefeb490d refs/tags/v0.6.4

View File

@ -1 +0,0 @@
ae315ded4dba10685dbbafbfa2ff3c1aefeb490d

View File

@ -1 +0,0 @@
ref: refs/remotes/origin/master

View File

@ -1,36 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
### Describe the bug
<!-- A clear and concise description of what the bug is. -->
### To Reproduce
Steps to reproduce the behavior:
<!-- If you are not able to reproduce it by running `zsh -df` and sourcing the plugin manually, it means there that the issue is caused by something in your local config file(s). Temporarily comment out or remove sections of your config and restart `zsh` until you narrow down exactly what is causing the issue. -->
```sh
% zsh -df
% source path/to/zsh-autosuggestions.zsh
% ... # what do you do to reproduce?
```
### Expected behavior
<!-- A clear and concise description of what you expected to happen. -->
### Screenshots
<!-- If applicable, add screenshots to help explain your problem. -->
### Desktop
- OS + distribution: <!-- e.g. Arch Linux 2019.07.01 -->
- Zsh version: <!-- `echo $ZSH_VERSION` -->
- Plugin version: <!-- or git commit hash if installed via git -->
### Additional context
<!-- Add any other context about the problem here. -->

View File

@ -1,20 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
### Is your feature request related to a problem? Please describe.
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
### Describe the solution you'd like
<!-- A clear and concise description of what you want to happen. -->
### Describe alternatives you've considered
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
### Additional context
<!-- Add any other context or screenshots about the feature request here. -->

View File

@ -1,3 +0,0 @@
--color
--require spec_helper
--format documentation

View File

@ -1,30 +0,0 @@
# Rails:
# Enabled: true
AllCops:
TargetRubyVersion: 2.3
Include:
- '**/Rakefile'
- '**/config.ru'
- '**/Gemfile'
Metrics/LineLength:
Max: 120
Style/Documentation:
Enabled: false
Style/DotPosition:
EnforcedStyle: trailing
Style/FrozenStringLiteralComment:
Enabled: false
Style/Lambda:
Enabled: false
Style/MultilineMethodCallIndentation:
EnforcedStyle: indented
Style/TrailingUnderscoreVariable:
Enabled: false

View File

@ -1,11 +1,6 @@
describe 'a multi-line suggestion' do describe 'a multi-line suggestion' do
it 'should be displayed on multiple lines' do it 'should be displayed on multiple lines' do
with_history(-> { with_history("echo \"\n\"") do
session.send_string('echo "')
session.send_keys('enter')
session.send_string('"')
session.send_keys('enter')
}) do
session.send_keys('e') session.send_keys('e')
wait_for { session.content }.to eq("echo \"\n\"") wait_for { session.content }.to eq("echo \"\n\"")
end end

View File

@ -1,7 +0,0 @@
describe 'suggestion fetching' do
it 'is performed synchronously'
context 'when ZSH_AUTOSUGGEST_USE_ASYNC is set' do
it 'is performed asynchronously'
end
end

View File

@ -1,6 +1,7 @@
require 'pry' require 'pry'
require 'rspec/wait' require 'rspec/wait'
require 'terminal_session' require 'terminal_session'
require 'tempfile'
RSpec.shared_context 'terminal session' do RSpec.shared_context 'terminal session' do
let(:term_opts) { {} } let(:term_opts) { {} }
@ -21,18 +22,20 @@ RSpec.shared_context 'terminal session' do
end end
def with_history(*commands, &block) def with_history(*commands, &block)
session.run_command('fc -p') Tempfile.create do |f|
f.write(commands.map{|c| c.gsub("\n", "\\\n")}.join("\n"))
f.flush
commands.each do |c| session.run_command('fc -p')
c.respond_to?(:call) ? c.call : session.run_command(c) session.run_command("fc -R #{f.path}")
session.clear_screen
yield block
session.send_keys('C-c')
session.run_command('fc -P')
end end
session.clear_screen
yield block
session.send_keys('C-c')
session.run_command('fc -P')
end end
end end

View File

@ -1,58 +1,71 @@
shared_examples 'special characters' do shared_examples 'special characters' do
describe 'a special character in the buffer' do describe 'a special character in the buffer should be treated like any other character' do
it 'should be treated like any other character' do it 'asterisk' do
with_history('echo "hello*"', 'echo "hello."') do with_history('echo "hello*"', 'echo "hello."') do
session.send_string('echo "hello*') session.send_string('echo "hello*')
wait_for { session.content }.to eq('echo "hello*"') wait_for { session.content }.to eq('echo "hello*"')
end end
end
it 'question mark' do
with_history('echo "hello?"', 'echo "hello."') do with_history('echo "hello?"', 'echo "hello."') do
session.send_string('echo "hello?') session.send_string('echo "hello?')
wait_for { session.content }.to eq('echo "hello?"') wait_for { session.content }.to eq('echo "hello?"')
end end
end
it 'backslash' do
with_history('echo "hello\nworld"') do with_history('echo "hello\nworld"') do
session.send_string('echo "hello\\') session.send_string('echo "hello\\')
wait_for { session.content }.to eq('echo "hello\nworld"') wait_for { session.content }.to eq('echo "hello\nworld"')
end end
end
it 'double backslash' do
with_history('echo "\\\\"') do with_history('echo "\\\\"') do
session.send_string('echo "\\\\') session.send_string('echo "\\\\')
wait_for { session.content }.to eq('echo "\\\\"') wait_for { session.content }.to eq('echo "\\\\"')
end end
end
it 'tilde' do
with_history('echo ~/foo') do with_history('echo ~/foo') do
session.send_string('echo ~') session.send_string('echo ~')
wait_for { session.content }.to eq('echo ~/foo') wait_for { session.content }.to eq('echo ~/foo')
end end
end
it 'parentheses' do
with_history('echo "$(ls foo)"') do with_history('echo "$(ls foo)"') do
session.send_string('echo "$(') session.send_string('echo "$(')
wait_for { session.content }.to eq('echo "$(ls foo)"') wait_for { session.content }.to eq('echo "$(ls foo)"')
end end
end
it 'square bracket' do
with_history('echo "$history[123]"') do with_history('echo "$history[123]"') do
session.send_string('echo "$history[') session.send_string('echo "$history[')
wait_for { session.content }.to eq('echo "$history[123]"') wait_for { session.content }.to eq('echo "$history[123]"')
session.send_string('123]') session.send_string('123]')
wait_for { session.content }.to eq('echo "$history[123]"') wait_for { session.content }.to eq('echo "$history[123]"')
end end
end
it 'octothorpe' do
with_history('echo "#yolo"') do with_history('echo "#yolo"') do
session.send_string('echo "#') session.send_string('echo "#')
wait_for { session.content }.to eq('echo "#yolo"') wait_for { session.content }.to eq('echo "#yolo"')
end end
end
with_history('echo "#foo"', 'echo $#abc') do it 'caret' do
session.send_string('echo "#')
wait_for { session.content }.to eq('echo "#foo"')
end
with_history('echo "^A"', 'echo "^B"') do with_history('echo "^A"', 'echo "^B"') do
session.send_string('echo "^A') session.send_string('echo "^A')
wait_for { session.content }.to eq('echo "^A"') wait_for { session.content }.to eq('echo "^A"')
end end
end
it 'dash' do
with_history('-foo() {}') do with_history('-foo() {}') do
session.send_string('-') session.send_string('-')
wait_for { session.content }.to eq('-foo() {}') wait_for { session.content }.to eq('-foo() {}')

View File

@ -44,7 +44,8 @@ _zsh_autosuggest_async_request() {
# There's a weird bug here where ^C stops working unless we force a fork # There's a weird bug here where ^C stops working unless we force a fork
# See https://github.com/zsh-users/zsh-autosuggestions/issues/364 # See https://github.com/zsh-users/zsh-autosuggestions/issues/364
command true autoload -Uz is-at-least
is-at-least 5.8 || command true
# Read the pid from the child process # Read the pid from the child process
read _ZSH_AUTOSUGGEST_CHILD_PID <&$_ZSH_AUTOSUGGEST_ASYNC_FD read _ZSH_AUTOSUGGEST_CHILD_PID <&$_ZSH_AUTOSUGGEST_ASYNC_FD

View File

@ -69,7 +69,7 @@ _zsh_autosuggest_bind_widgets() {
ignore_widgets=( ignore_widgets=(
.\* .\*
_\* _\*
autosuggest-\* ${_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS/#/autosuggest-}
$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\* $ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\*
$ZSH_AUTOSUGGEST_IGNORE_WIDGETS $ZSH_AUTOSUGGEST_IGNORE_WIDGETS
) )

View File

@ -18,6 +18,16 @@ _zsh_autosuggest_start() {
_zsh_autosuggest_bind_widgets _zsh_autosuggest_bind_widgets
} }
# Mark for auto-loading the functions that we use
autoload -Uz add-zsh-hook is-at-least
# Automatically enable asynchronous mode in newer versions of zsh. Disable for
# older versions because there is a bug when using async mode where ^C does not
# work immediately after fetching a suggestion.
# See https://github.com/zsh-users/zsh-autosuggestions/issues/364
if is-at-least 5.0.8; then
typeset -g ZSH_AUTOSUGGEST_USE_ASYNC=
fi
# Start the autosuggestion widgets on the next precmd # Start the autosuggestion widgets on the next precmd
autoload -Uz add-zsh-hook
add-zsh-hook precmd _zsh_autosuggest_start add-zsh-hook precmd _zsh_autosuggest_start

View File

@ -45,8 +45,6 @@ _zsh_autosuggest_capture_completion_widget() {
zle -N autosuggest-capture-completion _zsh_autosuggest_capture_completion_widget zle -N autosuggest-capture-completion _zsh_autosuggest_capture_completion_widget
_zsh_autosuggest_capture_setup() { _zsh_autosuggest_capture_setup() {
autoload -Uz is-at-least
# There is a bug in zpty module in older zsh versions by which a # There is a bug in zpty module in older zsh versions by which a
# zpty that exits will kill all zpty processes that were forked # zpty that exits will kill all zpty processes that were forked
# before it. Here we set up a zsh exit hook to SIGKILL the zpty # before it. Here we set up a zsh exit hook to SIGKILL the zpty

View File

@ -20,7 +20,7 @@ _zsh_autosuggest_enable() {
# Toggle suggestions (enable/disable) # Toggle suggestions (enable/disable)
_zsh_autosuggest_toggle() { _zsh_autosuggest_toggle() {
if [[ -n "${_ZSH_AUTOSUGGEST_DISABLED+x}" ]]; then if (( ${+_ZSH_AUTOSUGGEST_DISABLED} )); then
_zsh_autosuggest_enable _zsh_autosuggest_enable
else else
_zsh_autosuggest_disable _zsh_autosuggest_disable
@ -61,25 +61,14 @@ _zsh_autosuggest_modify() {
return $retval return $retval
fi fi
# Optimize if manually typing in the suggestion # Optimize if manually typing in the suggestion or if buffer hasn't changed
if (( $#BUFFER > $#orig_buffer )); then if [[ "$BUFFER" = "$orig_buffer"* && "$orig_postdisplay" = "${BUFFER:$#orig_buffer}"* ]]; then
local added=${BUFFER#$orig_buffer} POSTDISPLAY="${orig_postdisplay:$(($#BUFFER - $#orig_buffer))}"
# If the string added matches the beginning of the postdisplay
if [[ "$added" = "${orig_postdisplay:0:$#added}" ]]; then
POSTDISPLAY="${orig_postdisplay:$#added}"
return $retval
fi
fi
# Don't fetch a new suggestion if the buffer hasn't changed
if [[ "$BUFFER" = "$orig_buffer" ]]; then
POSTDISPLAY="$orig_postdisplay"
return $retval return $retval
fi fi
# Bail out if suggestions are disabled # Bail out if suggestions are disabled
if [[ -n "${_ZSH_AUTOSUGGEST_DISABLED+x}" ]]; then if (( ${+_ZSH_AUTOSUGGEST_DISABLED} )); then
return $? return $?
fi fi
@ -205,8 +194,21 @@ _zsh_autosuggest_partial_accept() {
} }
() { () {
typeset -ga _ZSH_AUTOSUGGEST_BUILTIN_ACTIONS
_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS=(
clear
fetch
suggest
accept
execute
enable
disable
toggle
)
local action local action
for action in clear modify fetch suggest accept partial_accept execute enable disable toggle; do for action in $_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS modify partial_accept; do
eval "_zsh_autosuggest_widget_$action() { eval "_zsh_autosuggest_widget_$action() {
local -i retval local -i retval
@ -223,12 +225,7 @@ _zsh_autosuggest_partial_accept() {
}" }"
done done
zle -N autosuggest-fetch _zsh_autosuggest_widget_fetch for action in $_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS; do
zle -N autosuggest-suggest _zsh_autosuggest_widget_suggest zle -N autosuggest-$action _zsh_autosuggest_widget_$action
zle -N autosuggest-accept _zsh_autosuggest_widget_accept done
zle -N autosuggest-clear _zsh_autosuggest_widget_clear
zle -N autosuggest-execute _zsh_autosuggest_widget_execute
zle -N autosuggest-enable _zsh_autosuggest_widget_enable
zle -N autosuggest-disable _zsh_autosuggest_widget_disable
zle -N autosuggest-toggle _zsh_autosuggest_widget_toggle
} }

View File

@ -1,8 +1,8 @@
# Fish-like fast/unobtrusive autosuggestions for zsh. # Fish-like fast/unobtrusive autosuggestions for zsh.
# https://github.com/zsh-users/zsh-autosuggestions # https://github.com/zsh-users/zsh-autosuggestions
# v0.6.4 # v0.7.0
# Copyright (c) 2013 Thiago de Arruda # Copyright (c) 2013 Thiago de Arruda
# Copyright (c) 2016-2019 Eric Freese # Copyright (c) 2016-2021 Eric Freese
# #
# Permission is hereby granted, free of charge, to any person # Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation # obtaining a copy of this software and associated documentation
@ -199,7 +199,7 @@ _zsh_autosuggest_bind_widgets() {
ignore_widgets=( ignore_widgets=(
.\* .\*
_\* _\*
autosuggest-\* ${_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS/#/autosuggest-}
$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\* $ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX\*
$ZSH_AUTOSUGGEST_IGNORE_WIDGETS $ZSH_AUTOSUGGEST_IGNORE_WIDGETS
) )
@ -282,7 +282,7 @@ _zsh_autosuggest_enable() {
# Toggle suggestions (enable/disable) # Toggle suggestions (enable/disable)
_zsh_autosuggest_toggle() { _zsh_autosuggest_toggle() {
if [[ -n "${_ZSH_AUTOSUGGEST_DISABLED+x}" ]]; then if (( ${+_ZSH_AUTOSUGGEST_DISABLED} )); then
_zsh_autosuggest_enable _zsh_autosuggest_enable
else else
_zsh_autosuggest_disable _zsh_autosuggest_disable
@ -323,25 +323,14 @@ _zsh_autosuggest_modify() {
return $retval return $retval
fi fi
# Optimize if manually typing in the suggestion # Optimize if manually typing in the suggestion or if buffer hasn't changed
if (( $#BUFFER > $#orig_buffer )); then if [[ "$BUFFER" = "$orig_buffer"* && "$orig_postdisplay" = "${BUFFER:$#orig_buffer}"* ]]; then
local added=${BUFFER#$orig_buffer} POSTDISPLAY="${orig_postdisplay:$(($#BUFFER - $#orig_buffer))}"
# If the string added matches the beginning of the postdisplay
if [[ "$added" = "${orig_postdisplay:0:$#added}" ]]; then
POSTDISPLAY="${orig_postdisplay:$#added}"
return $retval
fi
fi
# Don't fetch a new suggestion if the buffer hasn't changed
if [[ "$BUFFER" = "$orig_buffer" ]]; then
POSTDISPLAY="$orig_postdisplay"
return $retval return $retval
fi fi
# Bail out if suggestions are disabled # Bail out if suggestions are disabled
if [[ -n "${_ZSH_AUTOSUGGEST_DISABLED+x}" ]]; then if (( ${+_ZSH_AUTOSUGGEST_DISABLED} )); then
return $? return $?
fi fi
@ -467,8 +456,21 @@ _zsh_autosuggest_partial_accept() {
} }
() { () {
typeset -ga _ZSH_AUTOSUGGEST_BUILTIN_ACTIONS
_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS=(
clear
fetch
suggest
accept
execute
enable
disable
toggle
)
local action local action
for action in clear modify fetch suggest accept partial_accept execute enable disable toggle; do for action in $_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS modify partial_accept; do
eval "_zsh_autosuggest_widget_$action() { eval "_zsh_autosuggest_widget_$action() {
local -i retval local -i retval
@ -485,14 +487,9 @@ _zsh_autosuggest_partial_accept() {
}" }"
done done
zle -N autosuggest-fetch _zsh_autosuggest_widget_fetch for action in $_ZSH_AUTOSUGGEST_BUILTIN_ACTIONS; do
zle -N autosuggest-suggest _zsh_autosuggest_widget_suggest zle -N autosuggest-$action _zsh_autosuggest_widget_$action
zle -N autosuggest-accept _zsh_autosuggest_widget_accept done
zle -N autosuggest-clear _zsh_autosuggest_widget_clear
zle -N autosuggest-execute _zsh_autosuggest_widget_execute
zle -N autosuggest-enable _zsh_autosuggest_widget_enable
zle -N autosuggest-disable _zsh_autosuggest_widget_disable
zle -N autosuggest-toggle _zsh_autosuggest_widget_toggle
} }
#--------------------------------------------------------------------# #--------------------------------------------------------------------#
@ -541,8 +538,6 @@ _zsh_autosuggest_capture_completion_widget() {
zle -N autosuggest-capture-completion _zsh_autosuggest_capture_completion_widget zle -N autosuggest-capture-completion _zsh_autosuggest_capture_completion_widget
_zsh_autosuggest_capture_setup() { _zsh_autosuggest_capture_setup() {
autoload -Uz is-at-least
# There is a bug in zpty module in older zsh versions by which a # There is a bug in zpty module in older zsh versions by which a
# zpty that exits will kill all zpty processes that were forked # zpty that exits will kill all zpty processes that were forked
# before it. Here we set up a zsh exit hook to SIGKILL the zpty # before it. Here we set up a zsh exit hook to SIGKILL the zpty
@ -804,7 +799,8 @@ _zsh_autosuggest_async_request() {
# There's a weird bug here where ^C stops working unless we force a fork # There's a weird bug here where ^C stops working unless we force a fork
# See https://github.com/zsh-users/zsh-autosuggestions/issues/364 # See https://github.com/zsh-users/zsh-autosuggestions/issues/364
command true autoload -Uz is-at-least
is-at-least 5.8 || command true
# Read the pid from the child process # Read the pid from the child process
read _ZSH_AUTOSUGGEST_CHILD_PID <&$_ZSH_AUTOSUGGEST_ASYNC_FD read _ZSH_AUTOSUGGEST_CHILD_PID <&$_ZSH_AUTOSUGGEST_ASYNC_FD
@ -853,6 +849,16 @@ _zsh_autosuggest_start() {
_zsh_autosuggest_bind_widgets _zsh_autosuggest_bind_widgets
} }
# Mark for auto-loading the functions that we use
autoload -Uz add-zsh-hook is-at-least
# Automatically enable asynchronous mode in newer versions of zsh. Disable for
# older versions because there is a bug when using async mode where ^C does not
# work immediately after fetching a suggestion.
# See https://github.com/zsh-users/zsh-autosuggestions/issues/364
if is-at-least 5.0.8; then
typeset -g ZSH_AUTOSUGGEST_USE_ASYNC=
fi
# Start the autosuggestion widgets on the next precmd # Start the autosuggestion widgets on the next precmd
autoload -Uz add-zsh-hook
add-zsh-hook precmd _zsh_autosuggest_start add-zsh-hook precmd _zsh_autosuggest_start

@ -0,0 +1 @@
Subproject commit d6b0278517970bdd51cc3e576928125e0794f5bc

View File

@ -95,5 +95,5 @@ zstyle ':completion:*:*:*:*:globbed-files' ignored-patterns {'*/',}zsh-syntax-hi
IRC channel IRC channel
----------- -----------
We're on #zsh-syntax-highlighting on freenode. We're on #zsh-syntax-highlighting on Libera.Chat.

View File

@ -3,12 +3,14 @@ How to install
### Using packages ### Using packages
First, install the package:
* Arch Linux: [community/zsh-syntax-highlighting][arch-package] / [AUR/zsh-syntax-highlighting-git][AUR-package] * Arch Linux: [community/zsh-syntax-highlighting][arch-package] / [AUR/zsh-syntax-highlighting-git][AUR-package]
* Debian: `zsh-syntax-highlighting` package [in `stretch`][debian-package] (or in [OBS repository][obs-repository]) * Debian: `zsh-syntax-highlighting` package [in `stretch`][debian-package] (or in [OBS repository][obs-repository])
* Fedora: [zsh-syntax-highlighting package][fedora-package-alt] in Fedora 24+ (or in [OBS repository][obs-repository]) * Fedora: [zsh-syntax-highlighting package][fedora-package-alt] in Fedora 24+ (or in [OBS repository][obs-repository])
* FreeBSD: `pkg install zsh-syntax-highlighting` (port name: [`shells/zsh-syntax-highlighting`][freebsd-port]) * FreeBSD: `pkg install zsh-syntax-highlighting` (port name: [`shells/zsh-syntax-highlighting`][freebsd-port])
* Gentoo: [app-shells/zsh-syntax-highlighting][gentoo-repository] * Gentoo: [app-shells/zsh-syntax-highlighting][gentoo-repository]
* Mac OS X / Homebrew: [brew install zsh-syntax-highlighting][brew-package] * Mac OS X / Homebrew: `brew install zsh-syntax-highlighting` ([formula][brew-package])
* NetBSD: `pkg_add zsh-syntax-highlighting` (port name: [`shells/zsh-syntax-highlighting`][netbsd-port]) * NetBSD: `pkg_add zsh-syntax-highlighting` (port name: [`shells/zsh-syntax-highlighting`][netbsd-port])
* OpenBSD: `pkg_add zsh-syntax-highlighting` (port name: [`shells/zsh-syntax-highlighting`][openbsd-port]) * OpenBSD: `pkg_add zsh-syntax-highlighting` (port name: [`shells/zsh-syntax-highlighting`][openbsd-port])
* openSUSE / SLE: `zsh-syntax-highlighting` package in [OBS repository][obs-repository] * openSUSE / SLE: `zsh-syntax-highlighting` package in [OBS repository][obs-repository]
@ -18,11 +20,11 @@ How to install
[arch-package]: https://www.archlinux.org/packages/zsh-syntax-highlighting [arch-package]: https://www.archlinux.org/packages/zsh-syntax-highlighting
[AUR-package]: https://aur.archlinux.org/packages/zsh-syntax-highlighting-git [AUR-package]: https://aur.archlinux.org/packages/zsh-syntax-highlighting-git
[brew-package]: https://github.com/Homebrew/homebrew-core/blob/master/Formula/zsh-syntax-highlighting.rb [brew-package]: https://github.com/Homebrew/homebrew-core/blob/master/Formula/z/zsh-syntax-highlighting.rb
[debian-package]: https://packages.debian.org/zsh-syntax-highlighting [debian-package]: https://packages.debian.org/zsh-syntax-highlighting
[fedora-package]: https://apps.fedoraproject.org/packages/zsh-syntax-highlighting [fedora-package]: https://apps.fedoraproject.org/packages/zsh-syntax-highlighting
[fedora-package-alt]: https://bodhi.fedoraproject.org/updates/?packages=zsh-syntax-highlighting [fedora-package-alt]: https://bodhi.fedoraproject.org/updates/?packages=zsh-syntax-highlighting
[freebsd-port]: http://www.freshports.org/textproc/zsh-syntax-highlighting/ [freebsd-port]: https://www.freshports.org/textproc/zsh-syntax-highlighting/
[gentoo-repository]: https://packages.gentoo.org/packages/app-shells/zsh-syntax-highlighting [gentoo-repository]: https://packages.gentoo.org/packages/app-shells/zsh-syntax-highlighting
[netbsd-port]: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/shells/zsh-syntax-highlighting/ [netbsd-port]: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/shells/zsh-syntax-highlighting/
[obs-repository]: https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-syntax-highlighting&package=zsh-syntax-highlighting [obs-repository]: https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-syntax-highlighting&package=zsh-syntax-highlighting
@ -32,6 +34,36 @@ How to install
See also [repology's cross-distro index](https://repology.org/metapackage/zsh-syntax-highlighting/versions) See also [repology's cross-distro index](https://repology.org/metapackage/zsh-syntax-highlighting/versions)
Second, enable zsh-syntax-highlighting by sourcing the script. Running this command on the terminal will add the source line to the end of your .zshrc:
* On most Linux distributions (except perhaps NixOS):
```zsh
echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
```
* NetBSD and OpenBSD:
```zsh
echo "source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
```
* Mac OS X / Homebrew:
```zsh
echo "source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
```
Then restart zsh (such as by opening a new instance of your terminal emulator).
Alternatively, add the `source` command manually **at the end** of your `.zshrc`:
* On most Linux distributions (except perhaps NixOS):
`source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh`
* NetBSD and OpenBSD:
`source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh`
Then restart zsh.
### In your ~/.zshrc ### In your ~/.zshrc
@ -75,6 +107,12 @@ This list is incomplete as there are too many
Add `antigen bundle zsh-users/zsh-syntax-highlighting` as the last bundle in Add `antigen bundle zsh-users/zsh-syntax-highlighting` as the last bundle in
your `.zshrc`. your `.zshrc`.
#### [Fig](https://fig.io)
Click the `Install Plugin` button on the [Fig plugin page][fig-plugin].
[fig-plugin]: https://fig.io/plugins/other/zsh-syntax-highlighting
#### [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) #### [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)
1. Clone this repository in oh-my-zsh's plugins directory: 1. Clone this repository in oh-my-zsh's plugins directory:
@ -102,15 +140,15 @@ Zsh-syntax-highlighting is included with Prezto. See the
Add `zgen load zsh-users/zsh-syntax-highlighting` to the end of your `.zshrc`. Add `zgen load zsh-users/zsh-syntax-highlighting` to the end of your `.zshrc`.
#### [zinit](https://github.com/zdharma-continuum/zinit)
Add `zinit light zsh-users/zsh-syntax-highlighting` to the end of your
`.zshrc`.
#### [zplug](https://github.com/zplug/zplug) #### [zplug](https://github.com/zplug/zplug)
Add `zplug "zsh-users/zsh-syntax-highlighting", defer:2` to your `.zshrc`. Add `zplug "zsh-users/zsh-syntax-highlighting", defer:2` to your `.zshrc`.
#### [zplugin](https://github.com/psprint/zplugin)
Add `zplugin load zsh-users/zsh-syntax-highlighting` to the end of your
`.zshrc`.
### System-wide installation ### System-wide installation

View File

@ -5,8 +5,8 @@ zsh-syntax-highlighting [![Build Status][build-status-image]][build-status]
*Requirements: zsh 4.3.11+.* *Requirements: zsh 4.3.11+.*
[fish]: http://www.fishshell.com/ [fish]: https://fishshell.com/
[zsh]: http://www.zsh.org/ [zsh]: https://www.zsh.org/
This package provides syntax highlighting for the shell zsh. It enables This package provides syntax highlighting for the shell zsh. It enables
highlighting of commands whilst they are typed at a zsh prompt into an highlighting of commands whilst they are typed at a zsh prompt into an
@ -73,7 +73,7 @@ enough information to allow computing the highlighting correctly.)
See issues [#288][i288] and [#415][i415] for details. See issues [#288][i288] and [#415][i415] for details.
[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
[i288]: https://github.com/zsh-users/zsh-syntax-highlighting/pull/288 [i288]: https://github.com/zsh-users/zsh-syntax-highlighting/pull/288
[i415]: https://github.com/zsh-users/zsh-syntax-highlighting/pull/415 [i415]: https://github.com/zsh-users/zsh-syntax-highlighting/pull/415

View File

@ -1,15 +1,24 @@
# Changes in HEAD # Changes in HEAD
- Highlight `&>` `>&|` `>&!` `&>|` and `&>!` as redirection.
[#942]
# Changes in 0.8.0
This is a stable bugfix and feature release. Major new features and changes include:
## Changes fixed as part of the switch to zle-line-pre-redraw ## Changes fixed as part of the switch to zle-line-pre-redraw
The changes in this section were fixed by switching to a `zle-line-pre-redraw`-based The changes in this section were fixed by switching to a `zle-line-pre-redraw`-based
implementation. implementation.
Note: The new implementation will only be used on future zsh releases, Note: The new implementation will only be used on future zsh releases,
numbered 5.8.0.3 and newer, due to interoperability issues with other plugins numbered 5.8.1.1 and newer, due to interoperability issues with other plugins
(issues #418 and #579). The underlying zsh feature has been available since (issues #418 and #579). The underlying zsh feature has been available since
zsh 5.2. zsh 5.3.
Whilst under development, the new implementation was known as the Whilst under development, the new implementation was known as the
"feature/redrawhook" topic branch. "feature/redrawhook" topic branch.
@ -56,6 +65,31 @@ Whilst under development, the new implementation was known as the
- Add issue #712 to the previous release's changelog (hereinafter). - Add issue #712 to the previous release's changelog (hereinafter).
- Fix highlighting when using an alias twice inside another alias
[#769, #775]
- Remove lint warning for `env` followed by a pipe
[#797]
- Recognize `proxychains` as a precommand
[#814, #914]
- Honor shwordsplit when expanding parameters
[#687, #818]
- Skip highlighting when keys are still pending in more cases
[#835]
- Recognize `grc` as a precommand
- Recognize `torsocks` and `torift` as precommands
[#898]
- Recognize `cpulimit` as a precommand
[#897]
- Recognize `ktrace` as a precommand
# Changes in 0.8.0-alpha1-pre-redrawhook # Changes in 0.8.0-alpha1-pre-redrawhook
@ -89,8 +123,8 @@ to issue #418.
(#90, part of #245 (feature/redrawhook)) (#90, part of #245 (feature/redrawhook))
[zshcompsys-Standard-Styles]: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Standard-Styles [zshcompsys-Standard-Styles]: https://zsh.sourceforge.io/Doc/Release/Completion-System.html#Standard-Styles
[zshcompsys-Standard-Styles-format]: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#index-format_002c-completion-style [zshcompsys-Standard-Styles-format]: https://zsh.sourceforge.io/Doc/Release/Completion-System.html#index-format_002c-completion-style
@ -168,6 +202,8 @@ to issue #418.
- Recognize `env` as a precommand (e.g., `env FOO=bar ls`) - Recognize `env` as a precommand (e.g., `env FOO=bar ls`)
- Recognize `ionice` as a precommand
- Recognize `strace` as a precommand - Recognize `strace` as a precommand
- Fix an error message on stderr before every prompt when the `WARN_NESTED_VAR` zsh option is set: - Fix an error message on stderr before every prompt when the `WARN_NESTED_VAR` zsh option is set:
@ -289,7 +325,7 @@ This is a stable release, featuring bugfixes and minor improvements.
- The `isearch` and `suffix` [`$zle_highlight` settings][zshzle-Character-Highlighting]. - The `isearch` and `suffix` [`$zle_highlight` settings][zshzle-Character-Highlighting].
(79e4d3d12405, 15db71abd0cc, b56ee542d619; requires zsh 5.3 for `$ISEARCHMATCH_ACTIVE` / `$SUFFIX_ACTIVE` support) (79e4d3d12405, 15db71abd0cc, b56ee542d619; requires zsh 5.3 for `$ISEARCHMATCH_ACTIVE` / `$SUFFIX_ACTIVE` support)
[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
- Possible history expansions in double-quoted strings. - Possible history expansions in double-quoted strings.
(76ea9e1df316) (76ea9e1df316)
@ -735,7 +771,7 @@ in this area.
## Developer-visible changes: ## Developer-visible changes:
- Test harness converted to [TAP](http://testanything.org/tap-specification.html) format - Test harness converted to [TAP](https://testanything.org/tap-specification.html) format
(d99aa58aaaef, et seq) (d99aa58aaaef, et seq)
- Run each test in a separate subprocess, isolating them from each other - Run each test in a separate subprocess, isolating them from each other

View File

@ -3,19 +3,21 @@ zsh-syntax-highlighting / highlighters
Syntax highlighting is done by pluggable highlighters: Syntax highlighting is done by pluggable highlighters:
* `main` - the base highlighter, and the only one [active by default][1]. * `main` - the base highlighter, and the only one [active by default][main].
* `brackets` - [matches brackets][2] and parenthesis. * `brackets` - [matches brackets][brackets] and parenthesis.
* `pattern` - matches [user-defined patterns][3]. * `pattern` - matches [user-defined patterns][pattern].
* `cursor` - matches [the cursor position][4]. * `regexp` - matches [user-defined regular expressions][regexp].
* `root` - highlights the whole command line [if the current user is root][5]. * `cursor` - matches [the cursor position][cursor].
* `line` - applied to [the whole command line][6]. * `root` - highlights the whole command line [if the current user is root][root].
* `line` - applied to [the whole command line][line].
[1]: highlighters/main.md [main]: highlighters/main.md
[2]: highlighters/brackets.md [brackets]: highlighters/brackets.md
[3]: highlighters/pattern.md [pattern]: highlighters/pattern.md
[4]: highlighters/cursor.md [regexp]: highlighters/regexp.md
[5]: highlighters/root.md [cursor]: highlighters/cursor.md
[6]: highlighters/line.md [root]: highlighters/root.md
[line]: highlighters/line.md
Highlighter-independent settings Highlighter-independent settings
@ -25,10 +27,10 @@ By default, all command lines are highlighted. However, it is possible to
prevent command lines longer than a fixed number of characters from being prevent command lines longer than a fixed number of characters from being
highlighted by setting the variable `${ZSH_HIGHLIGHT_MAXLENGTH}` to the maximum highlighted by setting the variable `${ZSH_HIGHLIGHT_MAXLENGTH}` to the maximum
length (in characters) of command lines to be highlighter. This is useful when length (in characters) of command lines to be highlighter. This is useful when
editing very long comand lines (for example, with the [`fned`][fned] utility editing very long command lines (for example, with the [`fned`][fned] utility
function). Example: function). Example:
[fned]: http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#index-zed [fned]: https://zsh.sourceforge.io/Doc/Release/User-Contributions.html#index-zed
```zsh ```zsh
ZSH_HIGHLIGHT_MAXLENGTH=512 ZSH_HIGHLIGHT_MAXLENGTH=512
@ -38,16 +40,14 @@ ZSH_HIGHLIGHT_MAXLENGTH=512
How to activate highlighters How to activate highlighters
---------------------------- ----------------------------
To activate an highlighter, add it to the `ZSH_HIGHLIGHT_HIGHLIGHTERS` array in To activate an highlighter, add it to the `ZSH_HIGHLIGHT_HIGHLIGHTERS` array.
`~/.zshrc`, for example: By default `ZSH_HIGHLIGHT_HIGHLIGHTERS` is `(main)`. For example to activate
`brackets`, `pattern`, and `cursor` highlighters, in `~/.zshrc` do:
```zsh ```zsh
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor) ZSH_HIGHLIGHT_HIGHLIGHTERS+=(brackets pattern cursor)
``` ```
By default, `$ZSH_HIGHLIGHT_HIGHLIGHTERS` is unset and only the `main`
highlighter is active.
How to tweak highlighters How to tweak highlighters
------------------------- -------------------------
@ -59,7 +59,7 @@ same as the syntax of "types of highlighting" of the zsh builtin
`$zle_highlight` array, which is documented in [the `zshzle(1)` manual `$zle_highlight` array, which is documented in [the `zshzle(1)` manual
page][zshzle-Character-Highlighting]. page][zshzle-Character-Highlighting].
[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
Some highlighters support additional configuration parameters; see each Some highlighters support additional configuration parameters; see each
highlighter's documentation for details and examples. highlighter's documentation for details and examples.

View File

@ -28,4 +28,4 @@ The syntax for values is the same as the syntax of "types of highlighting" of
the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
manual page][zshzle-Character-Highlighting]. manual page][zshzle-Character-Highlighting].
[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting

View File

@ -21,4 +21,4 @@ The syntax for values is the same as the syntax of "types of highlighting" of
the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
manual page][zshzle-Character-Highlighting]. manual page][zshzle-Character-Highlighting].
[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting

View File

@ -21,4 +21,4 @@ The syntax for values is the same as the syntax of "types of highlighting" of
the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
manual page][zshzle-Character-Highlighting]. manual page][zshzle-Character-Highlighting].
[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting

View File

@ -116,6 +116,6 @@ of that (new) kind will be highlighted by the style `arg0_$kind`,
where `$kind` is the output of `type -w` on the new kind of command word. If that where `$kind` is the output of `type -w` on the new kind of command word. If that
style is not defined, then the style `arg0` will be used instead. style is not defined, then the style `arg0` will be used instead.
[zshmisc-Simple-Commands-And-Pipelines]: http://zsh.sourceforge.net/Doc/Release/Shell-Grammar.html#Simple-Commands-_0026-Pipelines [zshmisc-Simple-Commands-And-Pipelines]: https://zsh.sourceforge.io/Doc/Release/Shell-Grammar.html#Simple-Commands-_0026-Pipelines
[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting

View File

@ -21,4 +21,4 @@ The syntax for values is the same as the syntax of "types of highlighting" of
the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
manual page][zshzle-Character-Highlighting]. manual page][zshzle-Character-Highlighting].
[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting

View File

@ -12,11 +12,44 @@ To use this highlighter, associate regular expressions with styles in the
```zsh ```zsh
typeset -A ZSH_HIGHLIGHT_REGEXP typeset -A ZSH_HIGHLIGHT_REGEXP
ZSH_HIGHLIGHT_REGEXP+=('\bsudo\b' fg=123,bold) ZSH_HIGHLIGHT_REGEXP+=('^rm .*' fg=red,bold)
``` ```
This will highlight "sudo" only as a complete word, i.e., "sudo cmd", but not This will highlight lines that start with a call to the `rm` command.
"sudoedit"
The regular expressions flavour used is [PCRE][pcresyntax] when the
`RE_MATCH_PCRE` option is set and POSIX Extended Regular Expressions (ERE),
as implemented by the platform's C library, otherwise. For details on the
latter, see [the `zsh/regex` module's documentation][MAN_ZSH_REGEX] and the
`regcomp(3)` and `re_format(7)` manual pages on your system.
For instance, to highlight `sudo` only as a complete word, i.e., `sudo cmd`,
but not `sudoedit`, one might use:
* When the `RE_MATCH_PCRE` is set:
```zsh
typeset -A ZSH_HIGHLIGHT_REGEXP
ZSH_HIGHLIGHT_REGEXP+=('\bsudo\b' fg=123,bold)
```
* When the `RE_MATCH_PCRE` is unset, on platforms with GNU `libc` (e.g., many GNU/Linux distributions):
```zsh
typeset -A ZSH_HIGHLIGHT_REGEXP
ZSH_HIGHLIGHT_REGEXP+=('\<sudo\>' fg=123,bold)
```
* When the `RE_MATCH_PCRE` is unset, on BSD-based platforms (e.g., macOS):
```zsh
typeset -A ZSH_HIGHLIGHT_REGEXP
ZSH_HIGHLIGHT_REGEXP+=('[[:<:]]sudo[[:>:]]' fg=123,bold)
```
Note, however, that PCRE and POSIX ERE have a large common subset:
for instance, the regular expressions `[abc]`, `a*`, and `(a|b)` have the same
meaning in both flavours.
The syntax for values is the same as the syntax of "types of highlighting" of The syntax for values is the same as the syntax of "types of highlighting" of
the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
@ -25,6 +58,8 @@ manual page][zshzle-Character-Highlighting].
See also: [regular expressions tutorial][perlretut], zsh regexp operator `=~` See also: [regular expressions tutorial][perlretut], zsh regexp operator `=~`
in [the `zshmisc(1)` manual page][zshmisc-Conditional-Expressions] in [the `zshmisc(1)` manual page][zshmisc-Conditional-Expressions]
[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting
[perlretut]: http://perldoc.perl.org/perlretut.html [perlretut]: https://perldoc.perl.org/perlretut
[zshmisc-Conditional-Expressions]: http://zsh.sourceforge.net/Doc/Release/Conditional-Expressions.html#Conditional-Expressions [zshmisc-Conditional-Expressions]: https://zsh.sourceforge.io/Doc/Release/Conditional-Expressions.html#Conditional-Expressions
[MAN_ZSH_REGEX]: https://zsh.sourceforge.io/Doc/Release/Zsh-Modules.html#The-zsh_002fregex-Module
[pcresyntax]: https://www.pcre.org/original/doc/html/pcresyntax.html

View File

@ -22,4 +22,4 @@ The syntax for values is the same as the syntax of "types of highlighting" of
the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)` the zsh builtin `$zle_highlight` array, which is documented in [the `zshzle(1)`
manual page][zshzle-Character-Highlighting]. manual page][zshzle-Character-Highlighting].
[zshzle-Character-Highlighting]: http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting [zshzle-Character-Highlighting]: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Character-Highlighting

View File

@ -1,15 +0,0 @@
# Top-most editorconfig file
root = true
[*]
end_of_line = lf
tab_width = 2
indent_size = 2
indent_style = space
[Makefile]
tab_width = 8
indent_size = 8
indent_style = tab

View File

@ -1 +0,0 @@
ref: refs/heads/master

View File

@ -1,13 +0,0 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://github.com/zsh-users/zsh-syntax-highlighting.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master

View File

@ -1 +0,0 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@ -1,15 +0,0 @@
#!/bin/sh
#
# An example hook script to check the commit log message taken by
# applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit. The hook is
# allowed to edit the commit message file.
#
# To enable this hook, rename this file to "applypatch-msg".
. git-sh-setup
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
:

View File

@ -1,24 +0,0 @@
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
# This example catches duplicate Signed-off-by lines.
test "" = "$(grep '^Signed-off-by: ' "$1" |
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
echo >&2 Duplicate Signed-off-by lines.
exit 1
}

View File

@ -1,114 +0,0 @@
#!/usr/bin/perl
use strict;
use warnings;
use IPC::Open2;
# An example hook script to integrate Watchman
# (https://facebook.github.io/watchman/) with git to speed up detecting
# new and modified files.
#
# The hook is passed a version (currently 1) and a time in nanoseconds
# formatted as a string and outputs to stdout all files that have been
# modified since the given time. Paths must be relative to the root of
# the working tree and separated by a single NUL.
#
# To enable this hook, rename this file to "query-watchman" and set
# 'git config core.fsmonitor .git/hooks/query-watchman'
#
my ($version, $time) = @ARGV;
# Check the hook interface version
if ($version == 1) {
# convert nanoseconds to seconds
$time = int $time / 1000000000;
} else {
die "Unsupported query-fsmonitor hook version '$version'.\n" .
"Falling back to scanning...\n";
}
my $git_work_tree;
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
$git_work_tree = Win32::GetCwd();
$git_work_tree =~ tr/\\/\//;
} else {
require Cwd;
$git_work_tree = Cwd::cwd();
}
my $retry = 1;
launch_watchman();
sub launch_watchman {
my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
or die "open2() failed: $!\n" .
"Falling back to scanning...\n";
# In the query expression below we're asking for names of files that
# changed since $time but were not transient (ie created after
# $time but no longer exist).
#
# To accomplish this, we're using the "since" generator to use the
# recency index to select candidate nodes and "fields" to limit the
# output to file names only. Then we're using the "expression" term to
# further constrain the results.
#
# The category of transient files that we want to ignore will have a
# creation clock (cclock) newer than $time_t value and will also not
# currently exist.
my $query = <<" END";
["query", "$git_work_tree", {
"since": $time,
"fields": ["name"],
"expression": ["not", ["allof", ["since", $time, "cclock"], ["not", "exists"]]]
}]
END
print CHLD_IN $query;
close CHLD_IN;
my $response = do {local $/; <CHLD_OUT>};
die "Watchman: command returned no output.\n" .
"Falling back to scanning...\n" if $response eq "";
die "Watchman: command returned invalid output: $response\n" .
"Falling back to scanning...\n" unless $response =~ /^\{/;
my $json_pkg;
eval {
require JSON::XS;
$json_pkg = "JSON::XS";
1;
} or do {
require JSON::PP;
$json_pkg = "JSON::PP";
};
my $o = $json_pkg->new->utf8->decode($response);
if ($retry > 0 and $o->{error} and $o->{error} =~ m/unable to resolve root .* directory (.*) is not watched/) {
print STDERR "Adding '$git_work_tree' to watchman's watch list.\n";
$retry--;
qx/watchman watch "$git_work_tree"/;
die "Failed to make watchman watch '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
# Watchman will always return all files on the first query so
# return the fast "everything is dirty" flag to git and do the
# Watchman query just to get it over with now so we won't pay
# the cost in git to look up each individual file.
print "/\0";
eval { launch_watchman() };
exit 0;
}
die "Watchman: $o->{error}.\n" .
"Falling back to scanning...\n" if $o->{error};
binmode STDOUT, ":utf8";
local $, = "\0";
print @{$o->{files}};
}

View File

@ -1,8 +0,0 @@
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
exec git update-server-info

View File

@ -1,14 +0,0 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed
# by applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-applypatch".
. git-sh-setup
precommit="$(git rev-parse --git-path hooks/pre-commit)"
test -x "$precommit" && exec "$precommit" ${1+"$@"}
:

View File

@ -1,49 +0,0 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
git config hooks.allownonascii true
EOF
exit 1
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --

View File

@ -1,13 +0,0 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git merge" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message to
# stderr if it wants to stop the merge commit.
#
# To enable this hook, rename this file to "pre-merge-commit".
. git-sh-setup
test -x "$GIT_DIR/hooks/pre-commit" &&
exec "$GIT_DIR/hooks/pre-commit"
:

View File

@ -1,53 +0,0 @@
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
# <local ref> <local sha1> <remote ref> <remote sha1>
#
# This sample shows how to prevent push of commits where the log message starts
# with "WIP" (work in progress).
remote="$1"
url="$2"
z40=0000000000000000000000000000000000000000
while read local_ref local_sha remote_ref remote_sha
do
if [ "$local_sha" = $z40 ]
then
# Handle delete
:
else
if [ "$remote_sha" = $z40 ]
then
# New branch, examine all commits
range="$local_sha"
else
# Update to existing branch, examine new commits
range="$remote_sha..$local_sha"
fi
# Check for WIP commit
commit=`git rev-list -n 1 --grep '^WIP' "$range"`
if [ -n "$commit" ]
then
echo >&2 "Found WIP commit in $local_ref, not pushing"
exit 1
fi
fi
done
exit 0

View File

@ -1,169 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $2 -- the branch being rebased (or empty when rebasing the current branch).
#
# This sample shows how to prevent topic branches that are already
# merged to 'next' branch from getting rebased, because allowing it
# would result in rebasing already published history.
publish=next
basebranch="$1"
if test "$#" = 2
then
topic="refs/heads/$2"
else
topic=`git symbolic-ref HEAD` ||
exit 0 ;# we do not interrupt rebasing detached HEAD
fi
case "$topic" in
refs/heads/??/*)
;;
*)
exit 0 ;# we do not interrupt others.
;;
esac
# Now we are dealing with a topic branch being rebased
# on top of master. Is it OK to rebase it?
# Does the topic really exist?
git show-ref -q "$topic" || {
echo >&2 "No such branch $topic"
exit 1
}
# Is topic fully merged to master?
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
if test -z "$not_in_master"
then
echo >&2 "$topic is fully merged to master; better remove it."
exit 1 ;# we could allow it, but there is no point.
fi
# Is topic ever merged to next? If so you should not be rebasing it.
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
only_next_2=`git rev-list ^master ${publish} | sort`
if test "$only_next_1" = "$only_next_2"
then
not_in_topic=`git rev-list "^$topic" master`
if test -z "$not_in_topic"
then
echo >&2 "$topic is already up to date with master"
exit 1 ;# we could allow it, but there is no point.
else
exit 0
fi
else
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
/usr/bin/perl -e '
my $topic = $ARGV[0];
my $msg = "* $topic has commits already merged to public branch:\n";
my (%not_in_next) = map {
/^([0-9a-f]+) /;
($1 => 1);
} split(/\n/, $ARGV[1]);
for my $elem (map {
/^([0-9a-f]+) (.*)$/;
[$1 => $2];
} split(/\n/, $ARGV[2])) {
if (!exists $not_in_next{$elem->[0]}) {
if ($msg) {
print STDERR $msg;
undef $msg;
}
print STDERR " $elem->[1]\n";
}
}
' "$topic" "$not_in_next" "$not_in_master"
exit 1
fi
<<\DOC_END
This sample hook safeguards topic branches that have been
published from being rewound.
The workflow assumed here is:
* Once a topic branch forks from "master", "master" is never
merged into it again (either directly or indirectly).
* Once a topic branch is fully cooked and merged into "master",
it is deleted. If you need to build on top of it to correct
earlier mistakes, a new topic branch is created by forking at
the tip of the "master". This is not strictly necessary, but
it makes it easier to keep your history simple.
* Whenever you need to test or publish your changes to topic
branches, merge them into "next" branch.
The script, being an example, hardcodes the publish branch name
to be "next", but it is trivial to make it configurable via
$GIT_DIR/config mechanism.
With this workflow, you would want to know:
(1) ... if a topic branch has ever been merged to "next". Young
topic branches can have stupid mistakes you would rather
clean up before publishing, and things that have not been
merged into other branches can be easily rebased without
affecting other people. But once it is published, you would
not want to rewind it.
(2) ... if a topic branch has been fully merged to "master".
Then you can delete it. More importantly, you should not
build on top of it -- other people may already want to
change things related to the topic as patches against your
"master", so if you need further changes, it is better to
fork the topic (perhaps with the same name) afresh from the
tip of "master".
Let's look at this example:
o---o---o---o---o---o---o---o---o---o "next"
/ / / /
/ a---a---b A / /
/ / / /
/ / c---c---c---c B /
/ / / \ /
/ / / b---b C \ /
/ / / / \ /
---o---o---o---o---o---o---o---o---o---o---o "master"
A, B and C are topic branches.
* A has one fix since it was merged up to "next".
* B has finished. It has been fully merged up to "master" and "next",
and is ready to be deleted.
* C has not merged to "next" at all.
We would want to allow C to be rebased, refuse A, and encourage
B to be deleted.
To compute (1):
git rev-list ^master ^topic next
git rev-list ^master next
if these match, topic has not merged in next at all.
To compute (2):
git rev-list master..topic
if this is empty, it is fully merged to "master".
DOC_END

View File

@ -1,24 +0,0 @@
#!/bin/sh
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
if test -n "$GIT_PUSH_OPTION_COUNT"
then
i=0
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
do
eval "value=\$GIT_PUSH_OPTION_$i"
case "$value" in
echoback=*)
echo "echo from the pre-receive-hook: ${value#*=}" >&2
;;
reject)
exit 1
esac
i=$((i + 1))
done
fi

View File

@ -1,42 +0,0 @@
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg".
# This hook includes three examples. The first one removes the
# "# Please enter the commit message..." help message.
#
# The second includes the output of "git diff --name-status -r"
# into the message, just before the "git status" output. It is
# commented because it doesn't cope with --amend or with squashed
# commits.
#
# The third example adds a Signed-off-by line to the message, that can
# still be edited. This is rarely a good idea.
COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2
SHA1=$3
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
# case "$COMMIT_SOURCE,$SHA1" in
# ,|template,)
# /usr/bin/perl -i.bak -pe '
# print "\n" . `git diff --cached --name-status -r`
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
# *) ;;
# esac
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
# if test -z "$COMMIT_SOURCE"
# then
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
# fi

View File

@ -1,128 +0,0 @@
#!/bin/sh
#
# An example hook script to block unannotated tags from entering.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
# Config
# ------
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won't be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won't be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
# hooks.denycreatebranch
# This boolean sets whether remotely creating branches will be denied
# in the repository. By default this is allowed.
#
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
# --- Safety check
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
echo " (if you want, you could supply GIT_DIR then run" >&2
echo " $0 <ref> <oldrev> <newrev>)" >&2
exit 1
fi
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
exit 1
fi
# --- Config
allowunannotated=$(git config --bool hooks.allowunannotated)
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
denycreatebranch=$(git config --bool hooks.denycreatebranch)
allowdeletetag=$(git config --bool hooks.allowdeletetag)
allowmodifytag=$(git config --bool hooks.allowmodifytag)
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
case "$projectdesc" in
"Unnamed repository"* | "")
echo "*** Project description file hasn't been set" >&2
exit 1
;;
esac
# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a ref.
zero="0000000000000000000000000000000000000000"
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else
newrev_type=$(git cat-file -t $newrev)
fi
case "$refname","$newrev_type" in
refs/tags/*,commit)
# un-annotated tag
short_refname=${refname##refs/tags/}
if [ "$allowunannotated" != "true" ]; then
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1
fi
;;
refs/tags/*,delete)
# delete tag
if [ "$allowdeletetag" != "true" ]; then
echo "*** Deleting a tag is not allowed in this repository" >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
then
echo "*** Tag '$refname' already exists." >&2
echo "*** Modifying a tag is not allowed in this repository." >&2
exit 1
fi
;;
refs/heads/*,commit)
# branch
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
echo "*** Creating a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/heads/*,delete)
# delete branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/remotes/*,commit)
# tracking branch
;;
refs/remotes/*,delete)
# delete tracking branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
exit 1
fi
;;
*)
# Anything else (is there anything else?)
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
exit 1
;;
esac
# --- Finished
exit 0

View File

@ -1,6 +0,0 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

View File

@ -1 +0,0 @@
0000000000000000000000000000000000000000 5eb494852ebb99cf5c2c2bffee6b74e6f1bf38d0 Jan Eitzinger <jan.eitzinger@fau.de> 1610815503 +0100 clone: from https://github.com/zsh-users/zsh-syntax-highlighting.git

View File

@ -1 +0,0 @@
0000000000000000000000000000000000000000 5eb494852ebb99cf5c2c2bffee6b74e6f1bf38d0 Jan Eitzinger <jan.eitzinger@fau.de> 1610815503 +0100 clone: from https://github.com/zsh-users/zsh-syntax-highlighting.git

View File

@ -1 +0,0 @@
0000000000000000000000000000000000000000 5eb494852ebb99cf5c2c2bffee6b74e6f1bf38d0 Jan Eitzinger <jan.eitzinger@fau.de> 1610815503 +0100 clone: from https://github.com/zsh-users/zsh-syntax-highlighting.git

View File

@ -1,30 +0,0 @@
# pack-refs with: peeled fully-peeled sorted
7ac72a57bc7e5cc0ad84ef005d75c39d101b32a0 refs/remotes/origin/0.4.x
eb67c0b84f56f33cd34e3e40fa88c346d20211bc refs/remotes/origin/0.5.x
ffed6e16547596f554b69f33d16b228649dfc142 refs/remotes/origin/feature/redrawhook
023c994cdf00009c3fd7ba99e1900f0c450a6ebb refs/remotes/origin/i652-v1
5eb494852ebb99cf5c2c2bffee6b74e6f1bf38d0 refs/remotes/origin/master
1089e3a40886155c14bd9540e3de5f29a63776a2 refs/remotes/origin/themes
d2715e2cb3294880bbc6a75b91288243054218d0 refs/tags/0.1.0
bb0d575942760fe483790fe878ea43b1f781e2ca refs/tags/0.1.1
732b7d6e65c0349ee1d89b698bf9cd8a30c1015d refs/tags/0.1.2
a0862053f57e3d8d6e0dbc34e55be13d9e4fb668 refs/tags/0.1.3
dbd27cb30a710809dd070669c331574fdc15b397 refs/tags/0.2.0
3dc574190071ef59054f6d693132410b37aa3ae4 refs/tags/0.2.1
fee52920ae0b29e30bf5413151263faed20f5123 refs/tags/0.3.0
2d792b03bb715b1cd4c550aba48e2ca10be6a447 refs/tags/0.4.0
c19ee583138ebab416b0d2efafbad7dc9f3f7c4f refs/tags/0.4.1
c5523c757192c9d9fffde1219c0f8d60f9af9a22 refs/tags/0.5.0
^15d4587514a3beaa13972093e335bf685b6726a9
f7a963b078820de3be822c62333f68067efd9a29 refs/tags/0.6.0
^434af7b11dd33641231f1b48b8432e68eb472e46
0f26070068b25b97b47693adf87c438c40a0756e refs/tags/0.6.0-rc1
^dc2673155594f1de815802ca674bc7741ccda60f
3c828bf18302d7c4c2357b688e69f16c6c0dcb18 refs/tags/0.7.0
^36a3c0f82c23934fbfa924c79453266c4edda5fd
6a18eb874ae1b6d53b940f532eac24c6650918c6 refs/tags/0.7.0-beta1
^71dc090d02f891a65fee153041dd4332c76c21bc
956d0ebeecddb8c5ceabcb42b8c9be485e622c8d refs/tags/0.7.1
^932e29a0c75411cb618f02995b66c0a4a25699bc
6b76f34ffc520463084be36e61f04343547778b4 refs/tags/0.8.0-alpha1-pre-redrawhook
^00a5fd11eb9d1c163fb49da5310c8f4b09fb3022

View File

@ -1 +0,0 @@
5eb494852ebb99cf5c2c2bffee6b74e6f1bf38d0

View File

@ -1 +0,0 @@
ref: refs/remotes/origin/master

View File

@ -1 +0,0 @@
.revision-hash export-subst

View File

@ -1,73 +0,0 @@
---
name: Tests
on:
push:
paths-ignore:
- '**.md'
- '**.png'
pull_request:
paths-ignore:
- '**.md'
- '**.png'
schedule:
- cron: '29 7 * * 1'
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version:
- master
- 5.8
- 5.7.1
- 5.7
- 5.6.2
- 5.6.1
- 5.6
- 5.5.1
- 5.5
- 5.4.2
- 5.4.1
- 5.4
- 5.3.1
- 5.3
- 5.2
- 5.1.1
- 5.1
- 5.0.8
- 5.0.7
- 5.0.6
- 5.0.5
- 5.0.4
- 5.0.3
- 5.0.2
- 5.0.1
- 5.0.0
- 4.3.17
- 4.3.16
- 4.3.15
- 4.3.14
- 4.3.13
- 4.3.12
- 4.3.11
container:
image: zshusers/zsh:${{ matrix.version }}
steps:
- uses: actions/checkout@v2
- run: install_packages bsdmainutils make procps
- run: make test
notify:
runs-on: ubuntu-latest
needs: test
if: failure() && (github.repository_owner == 'zsh-users')
steps:
-
name: Notify IRC
uses: Gottox/irc-message-action@v1
with:
channel: '#zsh-syntax-highlighting'
nickname: zsyh-gh-bot
message: '${{ github.ref }} failed tests: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'

View File

@ -1,3 +0,0 @@
*.zwc*
.pc/
docs/all.md

View File

@ -1 +0,0 @@
0.8.0-alpha2-dev

View File

@ -0,0 +1 @@
../../docs/highlighters/brackets.md

View File

@ -1 +0,0 @@
../../docs/highlighters/brackets.md

Some files were not shown because too many files have changed in this diff Show More