Commit Graph

2639 Commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
fb679ac9c3 Add completions for pkg [info|show|list] 2018-12-23 20:06:25 -06:00
Fabian Homborg
50fbc36b73 sample_prompts/sorin: Correct git_action function name
We renamed this, and apparently missed it.

[ci skip]
2018-12-19 09:35:26 +01:00
Leonard Hecker
082450b1e7 Severely extended the sorin theme (#5411)
* Severely extended the sorin theme

This theme should now mostly match the original.

* Removed superfluous whitespace

* Inlined external links as ASCII art

* Made myself the author of the sorin theme

* Removed superfluous read delemiter

* Renamed __fish_git_action to fish_print_git_action

* Adde a minor comment
2018-12-18 15:01:38 +01:00
Fabian Homborg
e07b45f447 Revert "completions/git: Allow aliases with whitespace in the command"
This reverts commit 081e14fd21, which was bogus.
2018-12-15 11:13:38 +01:00
Mahmoud Al-Qudsi
3855c2217f Remove scripted XDG_CONFIG_HOME uses
Cleaned up the code to no longer replicate in fishscript what fish
already does (and caches to boot) in C++ in setting up the paths to the
user configuration directory.

Also introduced a `$__fish_user_data_dir` instead of the sporadic
definitions of `$userdatadir` that may or may not go through
`XDG_DATA_HOME`.
2018-12-14 22:09:29 -06:00
Aaron Gyes
c1be3284c1 __fish_config_interactive: inline combinational logic
Boost readability of this long, logic-heavy script with the new
&& and || syntax added to fish 3.
2018-12-14 05:49:08 -08:00
Aaron Gyes
ba9c387590 __fish_config_interactive: tighten up checks for OSC 7 feature
I spent some time figuring out $TERM_PROGRAM_VERSION and Terminal.app's
capabilities over time. [1]

Only use OSC 7 if running on the version of Terminal.app that added it
or newer. In the past this would have been harder because `test` couldn't
do float comparisons.

cleanup:
Don't bother setting a local $TERM_PROGRAM if it's unset: quoting
is enough to keep test happy. For the version numbers, 0"$var" is safe
against unset variables for numerical comparisons.

[1]: https://github.com/fish-shell/fish-shell/wiki/Terminal.app-characteristics
2018-12-14 05:00:55 -08:00
Fabian Homborg
081e14fd21 completions/git: Allow aliases with whitespace in the command
Fixes #5412.
2018-12-13 22:49:12 +01:00
Fabian Homborg
99ba07354a fish_vi_key_bindings: Remove weird argv handling
Instead of maybe adding "-s" and "-M" if "-s" hasn't already been
given, just add "-s" to _every_ bind invocation, and "-M" to those who
need it.

Fixes #5028.
2018-12-13 17:33:48 +01:00
David Adam
79d53a32dc history: drop use of fish_indent
Largely reverts 007d794b6e.

fish_indent is extremely resource-intensive on large inputs and can crash; it also does not handle
invalid characters gracefully.

Work on #5402.
2018-12-13 21:57:24 +08:00
Fabian Homborg
6d4eb96509 completions/git: Don't use status --ignored=something
Fixes it for git < 2.16.

Fixes #5396.

[ci skip]
2018-12-08 20:51:49 +01:00
Phuurl
46db332be5 Basic umask completion, and minor change to ulimit completion 2018-12-07 17:50:48 +01:00
Fabian Homborg
9cfb1394bf sample_prompts/sorin: Add a safe way to determine merge status
Based on what __fish_git_prompt is doing.

See #5388.

[ci skip]
2018-12-06 16:15:11 +01:00
Leonard Hecker
0b63c1f46d Don't run git merge quietly
This can and will mess up git rebases and force pushes.
2018-12-06 15:53:34 +01:00
Aaron Gyes
04795eb8ea webconfig: should know about italics, reverse, dim. 2018-12-05 01:05:33 -08:00
Fabian Homborg
03bca5f7dd webconfig: Fall back onto the default colorscheme
The solarized themes now define pager colors, while other schemes
don't.

So if a user picks one of them, and then another, they'd keep the
pager colors.

Instead, since the default theme is now complete, any theme that does
not define its own pager colors will always get the default ones.

[ci skip]
2018-12-05 09:54:31 +01:00
Fabian Homborg
fa5f3fe9a0 webconfig: Update default colorscheme
This was missing a bunch of variables from __fish_config_interactive.

Ideally we wouldn't have to duplicate this info, but I don't have a
great solution either.
2018-12-05 09:54:31 +01:00
ridiculousfish
6f33c0ccb5 Clean up some language and fix bogus escape in complete.fish 2018-12-03 23:14:01 -08:00
ridiculousfish
8521ce4cd2 Clean up complete completions
Closes #5381

Squashed commit of the following:

commit d70e3451ac
Author: TJ Rana <tj.rana@icloud.com>
Date:   Mon Dec 3 14:31:51 2018 -0500

    Update heading

commit ec44e8ed35
Author: TJ Rana <tj.rana@icloud.com>
Date:   Mon Dec 3 14:29:16 2018 -0500

    Update complete.fish

commit a7178ab163
Author: TJ Rana <tj.rana@icloud.com>
Date:   Mon Dec 3 00:46:42 2018 -0500

    Clean up completion descriptions

commit e6134ceeaa
Author: TJ Rana <tj.rana@icloud.com>
Date:   Mon Dec 3 00:26:42 2018 -0500

    Fix grammar

commit 0a805b1016
Author: TJ Rana <tj.rana@icloud.com>
Date:   Mon Dec 3 00:25:34 2018 -0500

    Add option descriptors

commit 608bb02e41
Author: TJ Rana <tj.rana@icloud.com>
Date:   Sun Dec 2 22:47:17 2018 -0500

    Fix spelling

commit 375593fef4
Author: TJ Rana <tj.rana@icloud.com>
Date:   Sun Dec 2 22:46:19 2018 -0500

    Add heading
2018-12-03 23:12:54 -08:00
Fabian Homborg
d20b3c688b Remove unused portage_print_*_categories functions
These weren't used anywhere, and were only added in
44e2c28255, which isn't in a release yet.

[ci skip]
2018-11-30 21:35:20 +01:00
Fabian Homborg
c242d923c9 sample_prompts/robbyrussell: Use fish_print_hg_root
This removes ~140ms from every single prompt.

When not in a git repo, this prompt now takes ~9ms, as opposed to
~150ms before.

Fixes #5266 harder.

[ci skip]
2018-11-30 20:59:53 +01:00
Fabian Homborg
176c84fb9f Extract code to print hg root from the prompt
This is useful in other prompts, and potentially also to users.

Don't use a dunderscore because we do way too many of them.
2018-11-30 20:57:59 +01:00
Fabian Homborg
60f8eda5c4 webconfig: Hack tmux's reset sequence
This is quite ugly, but in lieu of putting in a proper ansi
parser (i.e. the output part of a terminal), since this is the only
such sequence we have seen until now, let's just match it.

Fixes #5312.

[ci skip]
2018-11-30 20:21:36 +01:00
Fabian Homborg
91a664b9fa webconfig: Use html.escape if available
Just try to import it, on error import the old thing.

Tested with python 3.7.1 and 2.7.15.

Fixes #5125.

[ci skip]
2018-11-30 19:46:00 +01:00
crocket
35db0fb5df Improve the contrast of the pager for solarized dark theme.
By setting fish_pager_color_completion to B3A06D,
the pager gets more visual contrast.
2018-11-30 19:39:45 +01:00
Fabian Homborg
42ec4aa2dd completions/configure: Use first token ending in "configure"
Fixes #5376.

[ci skip]
2018-11-30 11:27:24 +01:00
Fabian Homborg
f0aa63cc11 man: Use new data_dir variable name 2018-11-29 20:28:29 +01:00
Fabian Homborg
eb0dd1ea78 sample_prompts/robbyrussell: Clean
- Remove use of `eval`
- Use `git rev-parse` instead of `git status` as its faster,
- especially in large repos. (in qt5: 600ms vs 1ms)

- Use return status instead of test -n

This should change nothing about the output.
2018-11-29 19:35:13 +01:00
Fabian Homborg
8ee2e54c9b sample_prompts/acidhub: Improve git parsing
Same as the sorin changes - don't parse "git branch" output.
2018-11-29 19:21:07 +01:00
Fabian Homborg
b18693f3c1 sample_prompts/sorin: Improve git parsing
This uses some more string, but the main improvement is using "git
rev-list" instead of parsing "git branch" output that happens to be localized.

[ci skip]
2018-11-29 17:38:18 +01:00
Fabian Homborg
bd1ceefb17 sample_prompts/user_host_path: Remove
I can't see the value in this, given that we have a bunch of minimalist ones.
The "escaping" here is gnarly enough that I don't want to attempt to clean it up.
2018-11-29 16:35:52 +01:00
Fabian Homborg
b794a5e476 sample_prompts/debian_chroot: Clean
- Remove begin/end in if-conditions - this used to be necessary in
  fish < 2.3.0

- Quote a `test`
2018-11-29 16:35:52 +01:00
Fabian Homborg
bcfef9268d sample_prompts/classic_status: Clean
- Remove unused variable
- Use `test` instead of `[ ]`
2018-11-29 16:35:52 +01:00
Fabian Homborg
19bcf9fc36 sample_prompts/acidhub: Clean
- Remove useless helper functions
- Remove `sed` call
- Cut down on `git` calls

The status display still needs a bit of work.
2018-11-29 16:35:52 +01:00
Fabian Homborg
ad5d400319 fixup! Fix variable names
Missed an underscore, sorry!
2018-11-29 15:36:13 +01:00
Bjorn Neergaard
958e46882f Slightly restructure man.fish for clarity
man.fish can be clarified a bit, by removing a superfluous early return. Additionally, performance can be
(ever so slightly) improved, by using the empty string to suffix an extra colon when `$MANPATH` is empty, as
described in `manpath(1)`. As `man` will internally call `manpath` as it starts, this eliminates a redundancy.
2018-11-29 15:29:18 +01:00
Fabian Homborg
2713265b01 webconfig: Improve Solarized schemes
Fixes #5315.
2018-11-29 15:18:13 +01:00
Fabian Homborg
be1c022861 webconfig: Allow setting pager colors 2018-11-29 15:18:00 +01:00
Fabian Homborg
a02eac5a7a webconfig: Update color lists
This adds the color variables from the docs to both the python script
and the js controller.

Among others, this includes "search_match", i.e.
"fish_color_search_match".

It still does not include the pager colors because the variable names
wouldn't match.
2018-11-29 15:17:44 +01:00
Fabian Homborg
20099774a0 fish_clipboard_copy: Use selection, if any
See #5368.
2018-11-25 17:33:14 +01:00
Aaron Gyes
d065ff840d Fix switch statement 2018-11-25 07:50:10 -08:00
Aaron Gyes
4ceb21cf09 rm completions: update BSD options
lined up with {Open|Net|Free}BSD & Solaris manuals.
2018-11-25 06:08:24 -08:00
Aaron Gyes
a2212876a9 add a simple 'math' completion 2018-11-25 05:13:14 -08:00
Aaron Gyes
62c6a09f1c ls.fish: simplify the logic a little. 2018-11-25 03:43:53 -08:00
Aaron Gyes
c2ae163bfe ls completions: fix mistake. 2018-11-25 03:12:44 -08:00
Aaron Gyes
e89035d76c ls completions: Solaris too. BSD vs POSIX -o conflict fixes
- Solaris is super annoying
- Also, use ls not command ls:
  if I wrapped `gls` in a `ls` function, I'd want this.
2018-11-25 03:07:16 -08:00
Aaron Gyes
c1af29f641 __fish_config_interactive: tell complete that [ wraps test
We want to show our completions for the `[` (`test`) builtin, but
we don't want to create a [.fish.
2018-11-25 02:04:56 -08:00
Aaron Gyes
a4f27bea36 cp completions: Give not-GNU cp the floam treatment 2018-11-25 01:45:45 -08:00
Aaron Gyes
7d79d326b5 test completions: we accept floats now 2018-11-25 00:15:11 -08:00
Aaron Gyes
8d0e1f3bcc test completions: don't complete files for string tests, wrap [
also removed --help - test doesn't do that.
2018-11-25 00:08:59 -08:00
Aaron Gyes
cc3fd9cf8f mv completions: Correctness improvements and updates for GNU, BSD, Solaris mv
Reflect GNU mv from this decade,  and the options handled
by specific non-GNU OSes.
2018-11-24 23:32:44 -08:00
Aaron Gyes
ca46c556c3 ls completions: BSD fixes
`ls` was suggesting options that are are not valid for my system,
omitting options that are on my system. Different BSD OSes have
different option extensions, and some of them do conflict with eachother.

I carefully checked the manuals of netbsd, macos, freebsd, and openbsd
`ls` and made the completions show the right completions in full for them.

Some verbiage tweaks as well.
2018-11-23 10:31:51 -08:00
Fabian Homborg
60fa9da3a7 Rewrite __fish_complete_proc
- No longer uses sed, sort, uniq, uname
- Stop doing too-clever filtering (e.g. the kernel thread stuff never
- really worked)
- Don't truncate for all OSen, instead just use the (correctly
- truncated) comm field.
2018-11-22 15:23:05 +01:00
Fabian Homborg
3a835ebd61 Make --help work
See #5361.
2018-11-22 12:43:35 +01:00
Fabian Homborg
b383e29a24 type: Make "--help" work
This tripped over argparse --min-args=1, but we already return 1 above
if there really is no argument.

Fixes #5361.
2018-11-22 12:27:25 +01:00
Aaron Gyes
007d794b6e history: improve interactive pager experience
- Colorize history search output when interactive, using
  fish_indent. This is the same way we colorize `type` output.

- Ask less to act like `cat` if the output will fit in the
  terminal window, so it's less jaring with short output.

- history is viewed in a pager when interactive, but pagers
  typically strip escape codes. We accomplish the above by
  doing exactly what `git` does[1] when it has colored output
  for a pager:
        if $LESS is unset, set it to enable -R, -F, and -X options.
	if $LV is unset, set it to -c.

[1]: 398dd4bd03/pager.c (L87)
2018-11-20 05:01:12 -08:00
Mahmoud Al-Qudsi
59197d12e0 Better handling of cases where man is not installed
Thanks to @floam, adapted to reduce nesting.

Works around override of command-not-found handler in previous solution
(c.f. 13e025bdb0).
2018-11-17 22:05:48 -06:00
Fabian Homborg
7b21f1c3cb Revert "mount completions: don't truncate mounts with spaces in them"
This does not work with util-linux mount, because that prints a "type" in between.

This reverts commit 1c364722a7.
2018-11-17 14:06:15 +01:00
Aaron Gyes
1c364722a7 mount completions: don't truncate mounts with spaces in them 2018-11-17 04:46:25 -08:00
Mahmoud Al-Qudsi
31d17f4559 Rename string escape --style=pcre2 to string escape --style=regex 2018-11-16 20:22:06 -06:00
Mahmoud Al-Qudsi
13e025bdb0 Clean up error message for man wrapper when man isn't installed
Closes #5329
2018-11-16 20:04:43 -06:00
Mahmoud Al-Qudsi
ab0f1d33fe Make use of the new PCRE2 escaping feature
Fixes some potentially unsafe uses of direct substitution into regex
expressions and also switches some completions to regex-based now that
there is a safe way of using it.
2018-11-15 12:37:29 -06:00
Aaron Gyes
7437f82d92 obnam completions: use $hostname instead of (hostname) 2018-11-13 15:49:03 -08:00
Aaron Gyes
920be02fe9 __update_cwd_osc: Use $hostname var instead of hostname command
Changing directories should be a few ms faster.
2018-11-13 15:40:19 -08:00
David Adam
5bd0472682 abbr: tidy description 2018-11-13 21:42:49 +08:00
Fabian Homborg
7257c69979 completions/string: Add escaping styles 2018-11-12 18:56:11 +01:00
Fabian Homborg
7a20e8d64d completions/busctl: Port to argparse
This is much faster!
2018-11-12 18:53:30 +01:00
Fabian Homborg
2d2f7c8fb1 completions/ip: Restyle
Just run `fish_indent` on the entire thing.
2018-11-12 16:28:24 +01:00
Fabian Homborg
15f089897d completions/ip: Add basic ip link set completions 2018-11-12 16:22:43 +01:00
David Adam
4b28e9d2e4 read: update completions to include --lines and --null
Does not include --all-lines pending discussion in #5332.
2018-11-12 23:13:41 +08:00
Mahmoud Al-Qudsi
d6ab3db159 fixup! Extend __fish_complete_suffix to support a virtual $PWD 2018-11-08 16:17:56 -06:00
Mahmoud Al-Qudsi
34440165aa Add completions for openocd 2018-11-07 20:08:16 -06:00
Mahmoud Al-Qudsi
da6937e0cf Extend __fish_complete_suffix to support a virtual $PWD
In writing the completion script for openocd I found the need to
complete paths at the command-line as if they were relative to a
path other than the current $PWD. Given that `$PWD` is currently
global in fish (i.e. no side-effect free `cd` within a subshell)
this is probably good to have for other completions too.

This also fixes a bug in support for explicitly supplying the
description for completions via a `$argv` parameter, which prefixed
the description with `\t` (which is correct) except it did so in
the local scope within an `if` statement, meaning the changes never
had any effect and in the output the description was directly
concatenated to the completions, instead of separated by a tab.
2018-11-07 20:08:16 -06:00
Mahmoud Al-Qudsi
6b7501d715 Correct pandoc data directory path in completions
Incorrectly assumed that pandoc uses XDG_CONFIG_HOME, it turns out the
path is hard-coded as $HOME/.pandoc unless explicitly otherwise
specified in the command-line.
2018-11-07 18:34:50 +00:00
Fabian Homborg
4d4227e57f completions/git: Match files inside directories again
Fixes #5317.
2018-11-05 15:53:06 +01:00
Mahmoud Al-Qudsi
8ebf2b8f70 Improve pandoc completions
* Only suggest PDF engines that are currently installed
* Use XDG_CONFIG_HOME (after a fashion)
* Initialize lists as arrays instead of blind strings
2018-11-04 20:49:57 -06:00
Mahmoud Al-Qudsi
ffb4ab5ca8 Prevent pandoc completions from polluting global namespace 2018-11-04 20:38:59 -06:00
Mahmoud Al-Qudsi
11b0b23587 Add git remote remove completions 2018-11-04 14:36:51 -06:00
Moritz Wilhelmy
9afc4b419e Allow cd . to re-enter the current directory
Closes #4543.
2018-11-04 21:46:24 +08:00
David Sanson
7926b69d15 Add completions for pandoc
Taken from https://github.com/dsanson/fish-completion-pandoc under the
GNU GPL as at 7195da6fc4bcbdd49ea63d47c27e4bfec2135660.

Closes #2937.
2018-11-04 21:22:58 +08:00
Mahmoud Al-Qudsi
b23bda8ed6 Only offer local branches for deletion in git completions 2018-10-30 05:14:20 +00:00
Mahmoud Al-Qudsi
1288877033 Update yarn completions
Don't attempt to complete against package names if the user is trying to
enter a switch to speed things up.

Also work around #5267 by not wrapping unfiltered `all-the-package-name`
calls in a function.
2018-10-29 13:56:40 -05:00
Clément Martinez
13c2b4cdc3 Improve virsh completions 2018-10-29 18:01:52 +01:00
ridiculousfish
e09e1e8e41 Fix funced when using the built-in editor 2018-10-27 17:19:43 -07:00
Fabian Homborg
121d61cf31 Revert "help: Use variable-as-command instead of eval"
We do a bunch of escaping before to make `eval` work, and that needs to be removed as well or fragment-urls don't work.

This reverts commit e9568069a7.
2018-10-26 10:52:02 +02:00
Fabian Homborg
c78e6a3ccf edit_command_buffer: repaint
Thanks @amosbird on gitter.
2018-10-25 17:34:01 +02:00
Fabian Homborg
fb0c1460a9 __fish_complete_pgrep: Truncate to 15 characters
Fixes #4132.
2018-10-25 12:10:17 +02:00
Mahmoud Al-Qudsi
5ad292328a Add dynamic clang completions via clang --autocomplete
Use clang/clang++'s own autocompletion support to complete arguments. It
is rather convoluted as clang generates autocompletions for a portion of
the current token rather than the entire token, e.g. while `--st` will
autocomplete to `--std=` (which is fine by fish), `--std=g` will
autocomplete to `gnu...` without the leading `--std=` which breaks fish'
support for the completion.

Additionally, on systems where clang/clang++ is the system compiler
(such as FreeBSD), it is very often for users to invoke a newer version
of clang/clang++ installed as clang[++]-NN instead of clang. Using a
monkey-patched version of `complete -p` to support that without breaking
(future) completions for commands like `clang-format`.

Closes #4174.
2018-10-24 23:14:55 -05:00
Mahmoud Al-Qudsi
ebb3a3a16e Set $fish_private_mode and show a message on private mode startup
The message can be localized and is set as a global variable shadowing
the universally-defined $fish_greeting.
2018-10-24 19:33:48 +02:00
Fabian Homborg
b427cd1823 ls.fish: Use gdircolors if available
See #5278.
2018-10-24 19:27:51 +02:00
Fabian Homborg
809998a9a5 completions/git: Use argparse
This is a tiny bit faster, but mostly it's more concise and extendable.
2018-10-24 12:26:01 +02:00
Fabian Homborg
381215ef07 completions/git: Let git glob files
Fixes #5229.
2018-10-24 12:22:31 +02:00
Fabian Homborg
d727e32934 __fish_print_help: Just use $COLUMNS
This had an undocumented internal feature that would pass the tty
width along. Instead, just have it read $COLUMNS, which we always
define anyway.
2018-10-23 15:05:15 +02:00
Fabian Homborg
5efa18da15 fixup! Add /fish to $__fish_config_dir 2018-10-21 17:20:21 +02:00
Fabian Homborg
6c988abe28 Add $__fish_config_dir variable
Contains the path to the user config.fish (e.g. ~/.config/fish)
without having to do the `set -q XDG_CONFIG_HOME` dance.

See #5270.
2018-10-21 15:42:25 +02:00
Fabian Homborg
162af88c9a __fish_parse_configure: Move some comments
This contained a commented-out `eval`, which drew my attention.
2018-10-21 15:38:31 +02:00
Fabian Homborg
3c6844d4f4 edit_command_buffer: Use variable-as-command 2018-10-21 15:34:42 +02:00
Fabian Homborg
3253893923 funced: Use variable-as-command 2018-10-21 15:34:19 +02:00
Fabian Homborg
e9568069a7 help: Use variable-as-command instead of eval 2018-10-21 15:33:29 +02:00
Fabian Homborg
fc51c156cb __fish_config_interactive: Use variable-as-command
This removes a use of eval, and some duplication.
2018-10-21 15:31:49 +02:00