Commit Graph

3978 Commits

Author SHA1 Message Date
Fabian Homborg
8223e6f23e fish_config: Add CLI-based theme selector
`fish_config theme`:

- `list` to list all available themes (files in the two theme
directories - either the web_config/themes one or
~/.config/fish/themes!)
- `show` to show select (or all) themes right in the terminal - this
starts another fish that reads the theme file and prints the sample
text, manually colored
- `choose` to load a theme *now*, setting the variables globally
- `save` to load a theme and save the variables universally
- `dump` to write the current theme in .theme format (to stdout)
- `demo` to display the current theme
2021-07-14 18:56:19 +02:00
Fabian Homborg
fd35dc2aa1 completions/git: Describe more "log" options
And do this by reusing other entries - mostly range-diff's.
2021-07-14 18:24:08 +02:00
Fabian Homborg
ee3a1f24c3 completions/gpg: Don't require an email address
Fixes #8079
2021-07-14 17:30:51 +02:00
Fabian Homborg
e013422143 Deduplicate $fish_user_paths automatically
In the variable handler, we just go through the entire thing and keep
every element once.

If there's a duplicate, we set it again, which calls the handler
again.

This takes a bit of time, to be paid on each startup. On my system,
with 100 already deduplicated elements, that's about 4ms (compared to
~17ms for adding them to $PATH).

It's also semantically more complicated - now this variable
specifically is deduplicated? Do we just want "unique" variables that
can't have duplicates?

However: This entirely removes the pathological case of appending to
$fish_user_paths in config.fish (which should be an FAQ entry!), and the implementation is quite simple.
2021-07-14 16:37:30 +02:00
Johannes Altmanninger
6c22c0e30d completions/git: do not attempt to complete rev:file in option words
Fixes #8139
2021-07-14 00:01:20 +02:00
Johannes Altmanninger
e50805646e completions/git: define function before use 2021-07-12 23:42:01 +02:00
Siavash Askari Nasr
ab201f7590 Add completion for Rakudo
[Rakudo](https://rakudo.org/) is an implementation of the
[Raku](https://raku.org/) programming language.
2021-07-12 21:33:36 +02:00
Raman Gupta
ed7a64ea77 Replicate upstream git logic for alias commands 2021-07-12 16:39:44 +02:00
Fabian Homborg
c5d4f26b09
Merge PR #8127: fish_config: Read colorschemes from .theme files
fish_config: Read colorschemes from .theme files
2021-07-11 22:18:46 +02:00
radiantly
55e60eeae2 Add completions for black (#8123) 2021-07-11 14:35:39 +02:00
Fabian Homborg
e021773288 Address review feedback 2021-07-11 11:23:16 +02:00
Fabian Homborg
4ec06f025c Fix fish_config prompt completions
Oops
2021-07-11 10:13:34 +02:00
Siavash Askari Nasr
8d17f81d66 Add zef completion
[zef](https://github.com/ugexe/zef) is a module manager for
[Raku](https://raku.org/) programming language.
2021-07-11 09:26:21 +02:00
YAKSH BARIYA
46ae46b54e
Add initial completion for Angular CLI (#8111)
* Add initial completion for Angular CLI

* Remove completion for `ng completion`

The `ng completion` doesn't exist. The completiond were autogenerated
using a script. See angular/angular-cli#21085

* Use shorter wording

* Fix typos
2021-07-11 09:25:04 +02:00
Fabian Homborg
072d735853 Webconfig: Remove colorschemes from js
This still keeps the Nord and Solarized palettes because we use the
backgrounds in the sample background list.
2021-07-09 20:36:59 +02:00
Fabian Homborg
51a55b25dc Webconfig: Read metadata from themes
This readds the preferred background and url, all read from "# url:"
and "# preferred_background:" comments in the .theme file.
2021-07-09 20:36:59 +02:00
Fabian Homborg
f301639d07 Add metadata to .theme files
Following a "#" comment. Also empty lines, so we have to deal with them.
2021-07-09 20:36:55 +02:00
Fabian Homborg
0e3d7de889 Webconfig: Read colorschemes from .theme files 2021-07-09 19:45:03 +02:00
Fabian Homborg
8091303659 Webconfig: Add colorschemes as ".theme" files
These are simple

var val [val val]

files. Basically the bit in `set -g fish_color_escape 86c1b9` after
the `set -g `. Since we're not going to `source` them, however,
arbitrary code and expansions are unsupported.

Also comments and such don't currently work.

This allows them to be easily readable both from webconfig (next
commit) and the shell (later).
2021-07-09 19:38:59 +02:00
Fabian Homborg
2aec6e5814 Webconfig: Pass colorscheme in one json request
This used to pass each color in a separate url-encoded request, which is
just wasteful.

Also it passed separate parameters for modifiers like bold and
underlined, but never gave them actual values. Instead the color is
passed as one string.

So we just use json, and then iterate over it server-side.
2021-07-09 18:26:51 +02:00
Avindra Goolcharan
32826d3596 Node completion: add sparkplug option
Feature: https://v8.dev/blog/sparkplug
Tested: Node.js v16.4.0
2021-07-08 16:10:34 +02:00
Kid
727934c6b6 Fix duplicate -p flag in fish completion 2021-07-05 19:04:23 +02:00
Kid
1361a5f68c Add missing options for bind 2021-07-03 22:06:48 +02:00
Fabian Homborg
04af336843 vi-mode: Repaint mode after cancelling
Fixes #8103
2021-07-03 21:37:33 +02:00
Johannes Altmanninger
c18f293ae2 completions/git: offer arbitrary commits to "git switch -d"
Fixes #8101
2021-07-03 08:54:12 +02:00
Johannes Altmanninger
9f54c8d88b completions/git: don't offer deleted files to "git diff" unless we have a "--"
Fixes #8090
2021-06-29 23:31:05 +02:00
Johannes Altmanninger
6c460f643c completions/git: don't comlete commits after "git difftool -- " 2021-06-29 23:31:05 +02:00
Luca Weiss
b8e7b6bcb0 completions/git: suggest modified-staged-deleted files
Add those files to the completion of 'add', 'checkout', 'diff', 'difftool', 'restore' and 'stash
push'.
2021-06-29 23:12:06 +02:00
Kid
85a900055d Split history commands in __fish_toggle_comment_commandline 2021-06-23 22:46:09 +02:00
Johannes Altmanninger
7c2dd694e0 Provide functions to toggle commandline prefix/suffix
This introduces two functions to
- toggle a process prefix, used for adding "sudo"
- add a job suffix, used for adding "&| less"

Not sure if they are very useful; we'll see.

Closes #7905
2021-06-23 20:51:20 +02:00
Johannes Altmanninger
caf1bbfc97 __fish_paginate: do not append a semicolon
I almost always use this on the last/only job in a commandline, so
the semicolon is usually not needed.  We have always added it but I
prefer not dropping it: this feels cleaner because it's what you'd
type without the shortcut.
2021-06-23 20:51:20 +02:00
Fabian Homborg
cc54917efa fish_add_path: Explicitly set $PATH as global
Fixes #8082
2021-06-23 20:01:58 +02:00
Wolfgang Müller
4a3df618f2 __fish_list_current_token: Do not use eval
Similarly to b0e3cc4b5 (__fish_complete_suffix: Remove `eval`,
2019-12-28), this use of eval is unsafe and can spew errors if
invoked on an incomplete brace expansion.
2021-06-22 17:44:32 +02:00
Johannes Altmanninger
6c88c7d200 __fish_print_help: remove spurious bold/underline control characters
Commit d15a51897 ("Rationalize $LESS uses") switched a "less" flag
from -r (interpret all control characters)
  to -R (interpret only color codes)

Somehow this changed the output of "fish -c 'command -h'" to include
weird characters:

	DESCRIPTION^O
	command^O forces the shell to execute the program COMMANDNAME^O and ignore any functions or builtins with the same name.

Probably this was the reason why I originally used -r over -R.  Anyway,
-R is safer and it looks like we can just remove the "ul" preprocessing
since "less" will interpret bold/underline just fine.
2021-06-20 20:58:15 +02:00
Johannes Altmanninger
73b13315de completions/dd: re-use built-in file completion for "dd if=the-file"
This allows to complete file arguments even if they contain variables.

Add similar logic for arguments to Maven's -D option.

See https://github.com/fish-shell/fish-shell/issues/5248#issuecomment-857614957
2021-06-19 20:31:46 +02:00
Johannes Altmanninger
48426d6285 Tweak git completion wording (review for #8062) 2021-06-19 10:10:59 +02:00
lelgenio
b8767cc803 completions/sv.fish: create completion for sv, a part of runit. 2021-06-19 08:17:53 +02:00
Collin Styles
a5e665cd81 Add completions for "empty" options to git-commit 2021-06-18 20:49:34 +02:00
Collin Styles
feec10f389 Add completions for different types of git resets 2021-06-18 20:49:34 +02:00
Collin Styles
0abbd2bc2f Add completions for git-revert sequencer subcommands 2021-06-18 20:49:34 +02:00
Collin Styles
15fdfb5afe Add completion for --abbrev-ref option to git-rev-parse 2021-06-18 20:49:34 +02:00
Collin Styles
c9f397b968 Remove invalid completion for git-describe
The `__fish_git_unique_remote_branches` function isn't applicable here
since `git describe` won't know what to do with a remote branch without
the remote prefix. For example, if there is a branch called
`origin/my-branch`, you can't execute `git describe my-branch` until the
branch is checked out locally. In other words:

Good: `git describe origin/my-branch`
Bad:  `git describe my-branch`
Good: `git switch my-branch; git describe my-branch`
2021-06-18 20:49:34 +02:00
Collin Styles
7d5c64a731 Fix completions to cargo's --example option on macOS
The completions for the `--example` option are generated using `find`.
The `find` utility on macOS will produce the following output when the
path argument has a trailing slash:

```
~/bat $ find ./examples/
./examples/
./examples//cat.rs
./examples//advanced.rs
./examples//simple.rs
./examples//list_syntaxes_and_themes.rs
./examples//yaml.rs
```

And will produce this output if the path does NOT have a trailing slash:

```
~/bat $ find ./examples
./examples
./examples/cat.rs
./examples/advanced.rs
./examples/simple.rs
./examples/list_syntaxes_and_themes.rs
./examples/yaml.rs
```

The extra slash after `examples` ends up in the completion suggestions
which is incorrect:

```
~/bat $ cargo run --example <TAB>
/advanced  /cat  /list_syntaxes_and_themes  /simple  /yaml
```

Unlike on my Linux box where `find` doesn't output the trailing slash:

```
~/bat $ cargo run --example <TAB>
advanced  cat  inputs  list_syntaxes_and_themes  simple  yaml
```

Importantly, I get the same (correct) output on Linux even without the
trailing slash in the path argument to `find`.
2021-06-15 21:22:44 +08:00
Johannes Altmanninger
701b7450df __fish_is_first_arg: only look at current process
This fixes the completions in

	btrfs command | btrfs <TAB>

See #8060
2021-06-15 03:38:52 +02:00
Johannes Altmanninger
f0de75ddd9 completions/git: complete normal files on "git restore -sHEAD "
A full "git ls-files" is slow on larger repositories; this makes the
common case (desired path exists on file system) faster.
2021-06-15 03:27:55 +02:00
Johannes Altmanninger
585dc16a66 completions/git: complete normal files on "git checkout -- "
This can give false positives but only if used on directories that
mix tracked and untracked files. The performance is better than
listing all tracked files, and in any case we're pretty far from a
correct solution that knows the target Git commit, so this seems like
good compromise.
2021-06-15 03:27:55 +02:00
Fabian Homborg
9e46d49dd9 webconfig: Remove tab top border in dark mode 2021-06-10 21:26:03 +02:00
Fabian Homborg
e571902a85 webconfig: Hover more things
The buttons were already supposed to highlight on hover, but the color
difference was barely visible. Crank that up.

Also add a hover color to the tabs, colorschemes, prompts, functions.

The big clickable things.
2021-06-10 21:25:40 +02:00
Fabian Homborg
f6a6537f7b css: Some minor adjustments
Make borders less bright in dark version, add some padding to the body.
2021-06-10 21:00:18 +02:00
Fabian Homborg
695027234b completions/git: Complete untracked files immediately
Fixes #8049
2021-06-08 08:53:49 +02:00
Fabian Homborg
e57c998d4c webconfig: Make a bit nicer on smaller screens
Actually remove the margins, distribute the color choices evenly and
switch to small mode a bit earlier.
2021-06-05 11:46:23 +02:00
Fabian Homborg
7a5e192607 Make background a bit more blue, brighter 2021-06-05 11:17:53 +02:00
Fabian Homborg
c2b35d3171 Adjust colors a teensy bit
Make a bit less ultra-dark blue
2021-06-05 11:17:53 +02:00
Fabian Homborg
64bbc8b304 webconfig: Dark mode 2021-06-05 11:17:53 +02:00
Fabian Homborg
155160e49b Msys also has a weird kill
Like Cygwin, it doesn't feature an option to list the signals, so we
simply hardcode them.

Fixes #8046.
2021-06-05 11:15:53 +02:00
Fabian Homborg
5f4dfd9951 webconfig: Remove weird position: absolute
This made the current prompt appear directly under the tab,
disregarding the padding.

That means it looked inconsistent with the colors. (note there's still
less padding on the side, but at least that allows more actual content
- prompts are often fairly wide)
2021-06-03 20:55:36 +02:00
Fabian Homborg
4e718506e3 Vi-bindings: Use fish_clipboard_copy
This has one slight behavioral change: Even with xsel, it now copies
to the clipboard, not the primary. I would imagine anyone who cares
about the primary selection has customized fish_clipboard_copy and
because we never got a bug about this not supporting anything but
xsel (and errorring out if it's not available!) this is probably
unused.

So now we support all the clipboard integration things, and we use the clipboard.
2021-06-03 10:04:30 +02:00
mtoohey31
6ca9f9ee38 fish_vi_key_bindings: bind s to follow vim visual behaviour
This change adds a binding that sets the s key's behaviour to match
the c key's in visual mode. This mirrors vim's behaviour (see `:h v_s`
in vim or neovim).
2021-06-03 09:57:22 +02:00
Fabian Homborg
a633889244 ls: Ignore ruby colorls
Apart from OpenBSD's "colorls" that is basically an ls that can do
color, there's also a ruby tool called "colorls" that's closer to exa.

Ignore that one since the options it understands are quite different
and I'm betting it's slower (given my experience with ruby tools).

See #8042.
2021-06-03 09:54:20 +02:00
Fabian Homborg
344bd63e0b webconfig: Remove unneeded inline style
This makes changing it harder and is unnecessary
2021-06-02 17:57:48 +02:00
Scott Bonds
ad38730792 ignore __fish_ls_color_opt when using colorls 2021-06-01 20:10:04 +02:00
Scott Bonds
3ddb5a2bdc
Add color to ls output on OpenBSD when colorls is installed (#8035)
* add support for colorized ls on openbsd

* add changelog line for colorls support

* add readme line for colorls support

* determine ls command at runtime, don't cache it

* eliminate __fish_ls_command function
2021-06-01 19:46:13 +02:00
gurudarshan266
b5d48acd7c
Condensed descriptions for various commands (#8034)
* Shorten descriptions for tmux.fish

* Shorten descriptions for bundle.fish

* Fix description in dhclient.fish
2021-05-28 18:50:01 +02:00
exploide
34ededa644 updated hashcat completions to version 6.2.1 2021-05-26 13:04:36 +02:00
Jyry Hjelt
08a455d4f1 Fixed a typo in rc-update autocompletion 2021-05-18 13:55:27 +02:00
Johannes Altmanninger
e10cab8104 Tweak documentation wording to include non-option arguments 2021-05-16 20:48:53 +02:00
Kid
e714ce238e Add missing options for complete 2021-05-16 17:33:49 +08:00
Fabian Homborg
d15a51897d Rationalize $LESS uses
Stop using "--no-init"/"-X" because we have no actual reason to and it
may break mouse initialization on my best friend macOS.

Use --RAW-CONTROL-CHARS, the capital version that only lets through
specific escape sequences, not *everything* - we shouldn't have
anything weird here, but less heavily discourages the other version.

Allow a user's $LESS to override.

Fixes #7997.
2021-05-14 22:18:59 +02:00
Fabian Homborg
2cfb4343ed man: Remove useless dirname call
This removed "/fish" just to add it back.
2021-05-14 21:49:53 +02:00
Érico Nogueira
3ac2242c68 completions: fix pacmd completions when using pipewire-pulse.
In such cases, `pacmd help` prints

  No PulseAudio daemon running, or not running as session daemon.

to stderr, which ends up printed to the user terminal.
2021-05-14 21:19:06 +02:00
Fabian Homborg
dbc6bffe3c __fish_set_locale: Ignore $LANGUAGE
This isn't really a "locale" variable as such. It has no effect on
encoding and stuff, it's just the output language.

What we really want here is get something better than the awkward "C"
or "POSIX" for LC_CTYPE specifically - everything else doesn't really
matter.
2021-05-11 21:53:58 +02:00
ridiculousfish
3f35012afb Fix openssl completions for LibreSSL
Fixes #7966
2021-05-05 14:42:36 -07:00
ridiculousfish
f25b9f9831 Make the webconfig HTTP server threaded, fixing a Safari hang
Recently Safari seems to hang with fish webconfig. This is apparently
because Safari is opening a socket and not writing to it, causing
webconfig to hang until the timeout (30 seconds). It's not clear why.

Use ThreadingMixIn so that FishConfigTCPServer can handle more
than one connection at a time. This fixes the hang under Safari.
2021-05-05 13:29:55 -07:00
Johannes Altmanninger
fa74dc977b fish_greeting: show private mode message if $fish_greeting is empty list
This was droped because of Cartesian product expansion.
Also fix the spurious dot in case the greeting is "".

Fixes #7974
2021-05-05 18:53:51 +02:00
Cycatz
889ff25c75 Remove extra chars after -p and --load options 2021-05-05 21:45:16 +08:00
ridiculousfish
b823b91bcd Remove an errant newline from the dirs function
The dirs function prints an extra newline; it is not obvious why this is
needed but it has been this way forever. Let's remove it.
2021-05-04 13:32:21 -07:00
Fabian Homborg
c55aa48308 Default colorscheme: Change pager prefix color for light terminals
From my checks (gnome-terminal with the "gnome light" colorscheme)
this seems to be the only color that's barely visible in a light
terminal, and it's the only color mentioned in both bug reports.

I'm leaving the artistic decisions to others, this is now *acceptable*
in both.

Note that, because we use universal variables here (hint #7317), this
will only be changed for preexisting installations when the user
reloads the colorscheme.

Fixes #3412
Fixes #3893
2021-05-01 20:16:23 +02:00
Fabian Homborg
1908cf95de Double default cnf-handler
This was defined in config.fish.

Just define it here again, it's trivial.
2021-05-01 18:59:25 +02:00
Fabian Homborg
0420901cb2 default prompt: Set fish_color_status if unset
Otherwise this'll error with --no-config
2021-05-01 18:59:25 +02:00
Fabian Homborg
2b74affaf0 Add prompt selector
It's a bit weird to *have* to fire up a browser to get fish_config to
choose a prompt.

So this adds a `prompt` subcommand to `fish_config`:

- `fish_config prompt list` shows all the available prompt names
- `fish_config prompt show` demos the available sample prompts
- `fish_config prompt choose` sources a prompt
- `fish_config prompt save` makes the choice permanent

A bare `fish_config` or `fish_config browse` opens the web UI.

Part of #3625.

TODO: This shows the right prompt on a new line. Showing it in-line is awkward
to do because we'd have to move it to the right.
2021-05-01 18:50:05 +02:00
Fabian Homborg
e548dca686 Webconfig: Fix initial tab
For some reason the url is now

http://localhost:$PORT/$RANDOM/#!/$TAB

while this created

http://localhost:$PORT/$RANDOM/#$TAB

which redirected to

http://localhost:$PORT/$RANDOM/#!/colors#$TAB

i.e. the "colors" tab with a useless unmatched anchor.
2021-05-01 18:47:49 +02:00
Johannes Altmanninger
daa3ae4be1 fish_config: use background color for some themes search matches
See https://github.com/fish-shell/fish-shell/issues/2442#issuecomment-829636721
2021-04-30 22:13:23 +02:00
Fabian Homborg
2e9dab71a3 __fish_apropos: Don't overwrite $dir 2021-04-30 20:09:56 +02:00
Fabian Homborg
c25efeed7a __fish_apropos: Fix broken variable name 2021-04-30 20:07:20 +02:00
Fabian Homborg
f485169391 __fish_apropos: Fix on macOS
Because MacOS' apropos is bad and doesn't support the `--` option
separator, this apparently spews errors.

Because the argument _can't_ start with a `-` (because we add a `^`),
we can just remove it.

Fixes #7965.
2021-04-30 19:16:57 +02:00
Fabian Homborg
2cea5b8eb1 Add a "prompt_login" helper function
This prints a description of the "host". Currently that's

`(chroot:debianchroot) $USER@$hostname`

with the chroot part when needed.

This also switches the default and terlar prompts to use it, the other
prompts have slightly different coloring or logic here.
2021-04-30 17:07:54 +02:00
tomKPZ
7735d13d79 Fix prompt reflow in kitty terminal 2021-04-28 08:14:08 +02:00
Fabian Homborg
8cd5f6cfde funcsave: Don't save details
The "# defined in /path/to/file" comment here is, almost by
definition, wrong.
2021-04-27 16:33:41 +02:00
Fabian Homborg
6aade380c1 Sample prompts: Handle print_pipestatus if TERM=dumb
This is the simple solution of just quoting it. The real solution
would probably handle `set_color` with no color better - #5443.

Fixes #7904.
2021-04-25 09:49:18 +02:00
Fabian Homborg
f21e015f1b webconfig: Make blue, green, red a bit brighter
These were hard to read in the browser, but not in the terminal.

The palette in color.cpp lists #000080 for blue, which is *even darker*. I'm not sure if that's actually a thing - I was under the impression that table was taken from xterm.

Either way, listing it in this color doesn't do anyone any favors. It's just a rough approximation anyway.
2021-04-21 17:26:52 +02:00
Fabian Homborg
152b0ef018 Webconfig: Sort the prompt list
Otherwise this has filesystem order, which on my system is quite
chaotic.

An alternative would be to randomize the order so people see different
prompts each time.
2021-04-21 17:13:03 +02:00
Fabian Homborg
f2364103b4 Sample prompts: Add a simplified version of my own prompt
Some features:

- A nice `►` prompt char with a fallback for non-utf8 systems
- The $PWD is colored depending on its sha, so different directories
  are colored differently, but each directory stays the same
- User@Host is only shown if not on the local machine (ssh or
  virtualization)
- A right prompt with a nice git display, date, duration of the last
  command (if it took over 100ms), and virtualenv
2021-04-21 17:01:05 +02:00
Fabian Homborg
4355636386 webconfig: Handle right prompt
This gets fish to print the right prompt of any sample if it has any,
and then shows it separately.

If there is a right prompt, it will also save it. If not, it will *not* overwrite an existing right prompt.
2021-04-21 17:01:05 +02:00
Fabian Homborg
9c413b039d Also fix tokenizer_state in bracketed paste path
Also removes our remaining use of
`__fish_commandline_is_singlequoted`.

See #7782.
2021-04-20 15:29:28 +02:00
Fabian Homborg
dc57ba01a2 __fish_pwd: Just always define the cygwin version
This called `uname` just to check if we *should* shorten "cygdrive"
directories.

That's more annoying than just doing it by default - on my system `pwd
| string replace` takes about 100 *micro*seconds, and this is done
once per prompt. Anyway, using $PWD further speeds it up to ~30
microseconds (compared to 10-20 for just `pwd`). This is hard to
measure because it's heavily impacted by system hitter.

The alternative is to ask cygwin to ship this feature as a patch.
2021-04-19 18:58:00 +02:00
Johannes Altmanninger
6b41227ff4 completions/dnf: minor addition to always show RPM files
See #7928
2021-04-18 13:09:36 +02:00
Johannes Altmanninger
db0fe92aaa completions/dnf: cautiously complete RPM files
Complete RPM files instead of pacakges if there is either
1. a slash in the token, which precludes package names
2. no matching package

To enable 2, pass the commandline token to the dnf query, instead of
an undefined variable. This allows SQL injection; not sure if we care.

We could always complete RPM files but maybe that's too noisy.
Also, isn't that what the "rpm" command is for?

Closes #7928
2021-04-17 22:53:34 +02:00
Collin Styles
42c11f1b6c Remove completion files for ls aliases; just use function --wraps 2021-04-16 17:40:55 +02:00
239
5e66722452 Update completions for resolvectl 2021-04-15 17:38:26 +02:00
239
4688a84398 Update completions for loginctl 2021-04-15 17:38:26 +02:00