This patch is currently floated from the NixOS side as part of
https://github.com/NixOS/nixpkgs/pull/12000, but prior versions of the
hook ignore anything but the first argument anyway, so this is
backwards-compatible.
This skips the weird dance where we'd define a simple handler and then
later overwrite with a fancier one, once the first event came in.
It turns out that isn't necessary, as it doesn't actually improve
startup speed because the checks needed to define fancier handlers are fast.
In case we are non-interactive, still define the simple handler, and
keep the default handler for users to switch to.
That's probably the part where commit hashes are most used, we can add
the other subcommands later.
This generates a _lot_ of options, so hooking it up everywhere would be
unwise, though our pager helps quite nicely with filtering - typing
"Branch" will filter out the commits, and typing other things will
filter the subjects, which is quite cool.
This turns '\040' into a space. /etc/mtab also supports other
escapes ("\\" for backslash, "\011" for tab), but I can't find
documentation for those in fstab.
This adds blockdevices (and directories) and fixes the regexes to no
longer include comments but include UUID= and LABEL=, which at least
util-linux mount understands.
It also shouldn't fail on systems without fstab any longer (like default OSX).
Fixes#2606.
* Add missing options to `git clone` in order to make the suggestions as
similar to the manual (https://git-scm.com/docs/git-clone) as
possible.
Signed-off-by: mr.Shu <mr@shu.io>
Unfortunately, there's no standard way to detect support (importantly,
terminfo doesn't encode it), but there's a variety of terminals that
support it that we can detect.
It's better than letting this functionality go to waste.
Check KONSOLE_PROFILE_NAME instead of DBUS_SESSION because Konsole can be compiled without dbus support.
Check ITERM_SESSION_ID's format for 24bit support
This has changed since the last release, just like 24bit support. So if
we check one, we get the other.
* Make sure that the `git remote` subcommands are not repeatedly
suggested (that is do not suggest a subcommand if there already is one).
* Add both long and short options to `git remote` subcommands where
appropriate.
Signed-off-by: mr.Shu <mr@shu.io>
This does a number of things:
- Removing trailing space from suggested repos for hg.
- Use the string builtin for hg completions.
- Add more internal merge tools to hg completion.
- Enable completions for abbreviated hg commands.
- Stop completing a deprecated hg branches option.
- Properly match the hg subcommand when preceeded by global switches.
- Stop completing deprecated hg glog.
- Complete hg config instead of showconfig.
- Properly complete when global switches are before the hg command.
- Properly handle the repository switch for hg completions.
- Properly handle the hg global switch cwd.
Currently if there is a conflict with two manpages having the same
name, one completion will override the other. But if one can be parsed
and the other can't the one with parsed results will always have a
higher priority.
It seems smart to only let files be parsed that are clearly
manpage files. Other files wouldn't be openend by man so
I think it is safe to guess that only these files are man
pages.
Allows the length of each shortened path component to be customized by setting the `fish_prompt_pwd_dir_length` variable to the number of characters to include (plus a leading dot because that's special). Maintains the default behavior of shortening path components to just one character. You can also set `fish_prompt_pwd_dir_length` to an empty or invalid value or 0 to disable shortening completely.
This reduces code duplication and adds some previously unavailable
bindings that don't quite _violate_ the vi-principle (like
prevd-or-backward-word on alt-left) and matches other "impure" bindings
like \cf for forward-word (a quite emacs-ish binding) we already have.
Fixes#2412Fixes#2472Fixes#2255
For cygwin, you can't `cd C:`, so a prompt of "C:/Something" is
misleading.
For OSX, we dereference symlinks elsewhere
This also simplifies prompt_pwd quite a bit.
Not for _everything_ because that causes too many options to be
generated (which is an issue for git as it is), but for modified, staged
and added files - which is where it is most useful.
Fixes#901 as far as I'm concerned.
git has options that can appear before commands, but not all of
them, and some of them need an argument. This means
`__fish_seen_subcommand_from` will give too many false-positives, while
`[ (count $cmd) -eq 2 ]` will give too many false-negatives.
Instead go through all arguments and check if they are in that list of
options that can be before a command and skip the argument for them, if
any.
This is to the benefit of systems with ancient GNU sed, which does not
recognize "-E", but only "-r".
Fixes#2305 - even if it doesn't replace all `sed -E` invocations in the
codebase, the others are unlikely to occur on CentOS and other similarly
crusty systems.
`__fish_apm_using_command` was incorrectly taking lists of commands, new function added to support multiple a command having synonyms.
Simplify switch statement
Also remove superfluous function.
Allow for multiple completions after a command
Useful for removing packages, will complete for more than one.
Code improvements
`sort -u | uniq` is completely redundant, calling grep for every
status-pair is unnecessary, `contains` doesn't take the word "in" as
special.
None of these are critical and there's basically no performance benefit
since this function is utterly dominated by hg calls.
This doesn't add anything except slowing the function down by about
33%. Checking for a branch is just as good and that is displayed in the
prompt anyway.
According to the newer code below:
xdg_data_home = os.getenv('XDG_DATA_HOME', '~/.local/share')
the actual default path is ~/.local/share/fish/generated_completions/
This is used in at least 4 places, all of which have a bug in that they
print "options" as a valid repo. It seems better to fix it once,
especially given that there are tons of AUR helpers and pacman wrappers,
all of which might need this info.
net_tools, which provides `ifconfig` and `netstat`, among other things,
has last been updated in 2013. This means `ifconfig` on linux is
basically dead.
Instead of ifconfig, use `ip` (from iproute2), which is much more powerful and
provides a much more annoying commandline syntax.
Instead of netstat, just look at /sys/class/net.
fish_user_key_bindings is the user's, and they should know if they want
vi-ish bindings or emacs-ish (or nano-ish). If they want to define
multiple, they can also do that (e.g. via checking what
$fish_key_bindings is set to).
Fixes#2254
CC @kballard
This doesn't work with fish_config.
For terlar and pythonista, remove unnecessary color setting.
For informative+git and pythonista, move variable setup into fish_prompt
Fixes#1141
See #1925: This allows users to disable the cnf-logic which can be quite
slow on small hardware (like a raspberry pi).
Squashed commit of the following:
commit 742a59e30d8db24b6bb5067d4204d4b5cc01c1c3
Author: Fabian Homborg <FHomborg@gmail.com>
Date: Sun Aug 30 18:23:41 2015 +0200
Erase startup cnf-handler early
Simplifies the code a bit - in particular it removes the special-casing
from the startup handler.
commit 638a97e7f31f302b65e044c93c638c03a69e31f5
Author: Fabian Homborg <FHomborg@gmail.com>
Date: Mon Aug 24 20:14:46 2015 +0200
Make overriding cnf-handler work
Do this by renaming the __fish_command_not_found_handler used during
startup to __fish_startup_command_not_found_handler. That allows us to
check if __fish_command_not_found_handler has been defined and skip the
setup of the normal one.
Now disabling cnf-handling can be done via defining an empty
__fish_command_not_found_handler in config.fish
This adds a special colorscheme and prompt function guaranteed to work
on a VT and activates them automatically if $TERM = "linux".
set_color is overridden to only allow the 8 colors VTs have (under the
assumption those are always the same) and the color variables are
shadowed with global ones so they don't pollute our nice capable terms.
This is already done by fish before calling the completion.
It breaks completion with combiners (#2025) and also with wrappers.
(This does not include git because that's better solved in #2145)
There are two main problems in the existing Fossil autocompletion that this
patch solves:
* Because Fossil lacks an alias system similar to those in Hg and Git,
wrapper scripts are common, and aliasing them to `fossil` is also fairly
common. The lack of the `command fossil` pattern in the completions script
meant that the actual fossil command might not be called, but rather the
alias. This problem has been fixed by introducing a __fish_fossil command,
similar to the __fish_hg and __fish_git commands in those completion shells,
that does this, and converting all explicit fossil calls in the completion
script to use __fish_fossil instead
* Because there's now a centralized location for calling Fossil, I also moved
all of the repetitive stderr redirects that function.
This results in more robust and cleaner code.
This was too simplistic, among other things it completed things that
looked like key ids but weren't, didn't turn "\x3a" back into
colons (which made the argument invalid)....
gpg is weird.
Might fix#2150
Bit one: Make all the fossil command invocations throw away stderr so we don't
get annoying messages when not in a repository.
Also:
- Move checkout into alphabetical order.
- Fix ls to complete against tags for -r option, not no option.
- Add missing option to delete command.
- Make commit complete against modified files.
- Make add only complete against extra files.
- Remove now ununused function to list extra & modified files.
- Add -f option in a number of places where it seemd appropriate.
__fish_complete_mime used in that way is a no-op on current fish anyway,
and emacs is by no means useful for just text files (it can also view
PDFs, images, ...).
Otherwise this completion currently only offers options, not arguments.
For most these are pretty much incompletable (lisp code, for example),
and for others it's just not all that useful.
Signed-off-by: David Adam <zanchey@ucc.gu.uwa.edu.au>
This used to be a function because we didn't have complete -w
Use that and it becomes a bit simpler.
This also simplifies the code in a few other ways (like removing a
useless-use-of-cat)
and adds comments about a few edgecases.
New sample prompt from Acidhub (github.com/acidhub)
This prompt show user|path (full), and a small symbol to
show last command status.
If in a git repository, it's show after the path several
symbols to indicate the branch status and the branch name.
Very handy to me so far.
Signed-off-by: Fernando Manfredi <contact@acidhub.click>
changed `function __trap_handler_EXIT --on-exit %self` to `function __trap_handler_EXIT --on-process-exit %self`
I'm guessing the on-exit syntax was from an older version? Trapping EXIT with that syntax caused errors.
The following behaviour is added:
- an empty pushd exchanges the top two directories in the stack;
- pushd +<n> rotates the stack so that the n-th directory (counting from the left of the list shown by dirs, starting with zero) is at the top;
- pushd -<n> rotates the stack so that the nth directory (counting from the right of the list shown by dirs, starting with zero) is at the top.