Commit Graph

1985 Commits

Author SHA1 Message Date
EmilySeville7cfg
909cade1f5 Add __fish_list_windows_drives 2022-01-26 21:37:39 -08:00
EmilySeville7cfg
0281017c5a Add __fish_list_windows_users function 2022-01-26 21:37:39 -08:00
EmilySeville7cfg
71f43c5fda Completion for rd command 2022-01-26 21:37:39 -08:00
EmilySeville7cfg
ae95c072c9 Generate shorter passwords 2022-01-26 21:37:39 -08:00
EmilySeville7cfg
16380074a5 --bytes instead of -c in __fish_generate_password 2022-01-26 21:37:39 -08:00
EmilySeville7cfg
e08125c85a Format __fish_generate_password 2022-01-26 21:37:39 -08:00
EmilySeville7cfg
832c0a3be2 Helper function __fish_generate_password add 2022-01-26 21:37:39 -08:00
EmilySeville7cfg
5aac064b2c Fix second for loop in __fish_seen_argument 2022-01-26 21:37:39 -08:00
EmilySeville7cfg
7f1ea27008 Windows options support in __fish_seen_argument 2022-01-26 21:37:38 -08:00
Aaron Gyes
b1deb8af89 down-or-search: shorten description 2022-01-22 21:12:01 -08:00
Aaron Gyes
1262469aea Shorten two more command's descriptions
Two columns at 119 width.
2022-01-22 21:04:26 -08:00
Aaron Gyes
4a6dbe0922 prompt_* functions: shorten their descriptions 2022-01-22 20:06:37 -08:00
Fabian Homborg
24f9fdd0a7 themes/default: Set pager selection to reverse
This makes it look okay on both light and dark backgrounds.
2022-01-19 17:23:42 +01:00
Fabian Homborg
698b818935 Shorten default title
This now skips the "fish" bit and uses prompt_pwd to print a shorter title.

See #8641.
2022-01-16 11:17:31 +01:00
Kid
aa6e0cc157
Skip more leading commands in __fish_man_page (#8612)
* Skip leading `xargs` in `__fish_man_page`

* Complete the list

* `git` does not qualify either
2022-01-08 13:50:31 +01:00
David Adam
b4e8e5abff __fish_print_apt_packages: stringify
GNU tr is not Unicode-aware, and was corrupting descriptions that had
non-ASCII characters.

Additionally, rather than using the Unicode private use characters, use
the ASCII/UTF-8 record separator character as it was intended.

The sed command could probably be rewritten to do all the heavy lifting
here, but would be even less readable.

Closes #8575.
2022-01-06 23:55:18 +08:00
ridiculousfish
37625053d4 fish_git_prompt: be careful about git config
fish_git_prompt may run certain git commands which may invoke certain
external programs as specified `.git/config`. Prevent this by suppressing
certain git config options.
2021-12-30 13:11:04 -08:00
Nils K
1877253f47
Pass all of $argv to pk-command-not-found (#8591)
Fixes #8579.
2021-12-28 12:56:31 +08:00
Fabian Homborg
086d388932 Also read /etc/default/locale for the locale
Apparently a thing on Debian systems (whyyyyy)

Fixes #8557
2021-12-18 08:57:22 +01:00
Emily Grace Seville
077f1f2576 Redirect stderr of xclip to /dev/null
xclip will display an error when pasting if the clipboard contains
something that isn't text:
  Error: target STRING not available

Swallow this error.
2021-12-15 22:30:12 +08:00
Emily Grace Seville
e25b719b26
__fish_tokenizer_state: replace "str" with "state" (#8550)
Bug introduced 4c1173f
2021-12-13 02:42:16 -08:00
Ilan Cosman
521eebef7b
Speed up, fix fish_status_to_signal (#8530)
* Speed up fish_status_to_signal

* Use generated kill signals, not hardcoded
2021-12-11 13:54:11 -08:00
Andrey Mishchenko
bb1955ccf9 Remove delete-or-exit function, which has a C++ implementation 2021-12-11 10:19:18 +01:00
Andrey Mishchenko
fb73a4b2e2 Implement nextd-or-forward-word and prevd-or-backward-word in C++ 2021-12-11 10:19:18 +01:00
Andrey Mishchenko
e79617f4b7 Add documentation for prompt_hostname 2021-12-04 10:37:49 +01:00
Kid
75d16c13ea Use --almost-all in la function 2021-12-02 02:22:40 -08:00
Ilan Cosman
30400f3ced Use test command instead of bracket command 2021-11-26 16:55:50 -08:00
Fabian Homborg
5ecdcebf8d Fix help thinking some docs are commands
This looked at __fish_print_commands, which goes via our man pages to
find the commands (it shouldn't, buuut), and exludes a hard-coded list
of pages.

So we do two thigns:

1. We add the other doc pages to the list
2. We check commands *later* - if we listed something explicitly it
should be used
2021-11-25 21:25:46 +01:00
Fabian Homborg
c71a2e573f Fix __fish_seen_argument
Fixes #8478
2021-11-23 18:12:51 +01:00
Ilan Cosman
566a673e4f Run fish_indent on all non-test .fish files 2021-11-23 09:49:45 +01:00
EmilySeville7cfg
7f86794881 __fish_seen_argument update:
- -p option use
- quoting simplify
- description add
2021-11-22 19:00:44 +01:00
Kid
1e84164e4e Skip leading command in __fish_man_page 2021-11-17 12:50:57 -08:00
Fabian Homborg
c16e30931b Fix abbr return status
This was supposed to act like `type -q` or `command -q`, in that it
returns 0 if at least 1 exists.

But because it used the wrong variable it didn't.

Fixes #8431.
2021-11-11 16:46:23 +01:00
Daniel Eklöf
20a1bf289f Recognize all foot terminfo variants when sending OSC-7 (PWD) 2021-11-08 21:14:12 +01:00
Daniel Eklöf
bfedb3608f fish_vi_cursor: add support for alternative foot terminfos
Foot has several terminfos:

* foot - the default one
* foot-direct - 24-bit color terminfo, similar to xterm-direct (used by e.g. emacs)
* foot-extra - alternative to the ncurses provided terminfo, with a couple of extra, non-standard
capabilities
* foot-extra-direct - 24-bit color version of the above

There may also be other distro-custom terminfo names (serving the same purpose as foot-extra*)
2021-11-08 21:14:12 +01:00
Fabian Homborg
b96c92a7f7 fish_config: Erase global theme variables if saving 2021-11-08 17:47:49 +01:00
Fabian Homborg
12117cfe3d fish_vi_cursor: Support foot
Fixes #8391
2021-11-08 17:23:35 +01:00
Fabian Homborg
9e86ffe3bc __fish_print_help: Fix unicode characters
This is nroff/groff being broken. It turns "→" into "â". This is even if we select `-Tutf8` and friends.

So, if mandoc exists, we prefer that, and otherwise, run preconv on
the file first (if it exists).

Really, what we would need to to is tell nroff to pass `-KUTF-8` to
groff, but that doesn't appear to be possible.
2021-11-04 15:15:20 +01:00
Aaron Gyes
d3678c46f2 Revert "Add a function for getting a quick hash/checksum"
This reverts commit 6858abac04.

This was unintentional
2021-11-03 22:55:23 -07:00
Aaron Gyes
fefb913857 Update tests for changed error output 2021-11-03 22:54:55 -07:00
Aaron Gyes
710639f5d6 builtins: work on error messages
- Introduce BUILTIN_ERR_COMBO2_EXCLUSIVE
- Distill generally more terse, unambiguous error descriptions.
  Remember English is not everyone's language.
- Do not capitalize sentence fragments
- Use the modality where problem input is in a %s: prefix, then
  is explained.
- Do not address the user (the "You cannot do ..." kraderism)
- Spell out 'arguments' rather than 'args' for consistency
- Mention 'function' as a scope
2021-11-03 22:54:55 -07:00
Aaron Gyes
6858abac04 Add a function for getting a quick hash/checksum
16 bits ought to be enough for anything
2021-11-03 22:54:55 -07:00
Fabian Homborg
4b46717a91 docs: Move configuration section to language
Instead leave a simple "use config.fish" bit in-place.

Also some minor rewording.
2021-10-23 17:13:36 +02:00
Fabian Homborg
763c5deb39 Teach help about commands.html 2021-10-23 13:47:01 +02:00
LetMeByte
af7704ef06
Fix st issue with shift+tab (#8354) 2021-10-22 23:21:25 +02:00
Aaron Gyes
f817dc7a76 fixup or/and typo 2021-10-22 12:55:43 -07:00
Aaron Gyes
374d580474 Combine 3 git config forks into one
fish_git_prompt duration improved from 76ms to 45ms here.
2021-10-22 12:45:39 -07:00
Aaron Gyes
46278d7137 remove for loops from git prompt event handlers 2021-10-22 09:05:18 -07:00
Erik Serrander
049104e8df Adds sub-command clear-session to history command.
Issue #5791
This clears all history for the current session. Documentation and
autocompletion for the new subcommand is added.
2021-10-17 19:27:46 -07:00
LetMeByte
6606dfbeb5 Fix issue with delete-key in st
In 'simple terminal' the delete key prints \e[P by default, which is
related to the different approach the authors of st are taking on the
matter of shell configuration. The main problem is the malfunction of
the delete key, so we have to use a workaround like this.
2021-10-14 22:14:39 +08:00
Aaron Gyes
7122209f25 Remove old OS X stuff from keybindings
We don't support older than 10.10 anymore.

fish_key_reader reports the hardcoded bind we had for Mavericks
is just -k sdc.
2021-10-06 19:29:13 -07:00
Anselm Schüler
475a2afc40
fish_prompt: clarify comment about carried-over status (#8335) 2021-10-05 21:01:13 +02:00
Aaron Gyes
35bd06a13e fish_config: adjust output
Do not show an error on `fish_config prompt save` after removing a
`fish_right_prompt`
2021-09-29 03:15:37 -07:00
Aaron Gyes
f3b950157d Remove special case for fish_right_prompt in config.fish 2021-09-29 03:12:39 -07:00
Aaron Gyes
ed8c78c0ea Update docs, completions for funcsave
Remove long opt for -q, funcsave does not have so many options that
it's any help.
2021-09-29 03:08:10 -07:00
Aaron Gyes
a5978eade4 funcsave: add missing newlines 2021-09-28 22:22:21 -07:00
Aaron Gyes
3a402b19b3 funcsave: delete files for non-existant functions, output actions unless -q
This allows for:

$ functions -e somefunc
$ funcsave somefunc

to work.
2021-09-28 22:01:07 -07:00
Fabian Homborg
69074c1591 fish_config: Remove right prompt in choose and save
If the new theme no longer has any.

Fixes #8314.
2021-09-26 15:34:04 +02:00
Fabian Homborg
6c8b0a1245 Reapply -F
This was forgotten in a40a35cc52.

Sorry!
2021-09-24 18:25:27 +02:00
Fabian Homborg
113e91ab9a Use a local variable
Otherwise this is annoying on upgrade
2021-09-24 18:17:49 +02:00
Fabian Homborg
5f5bd03911 functions/ls: Work around Terminal.app not setting $COLORTERM
Fixes #8309
2021-09-24 18:15:48 +02:00
Max Nordlund
85ea9bf781
Hide whatis database building from the user (#8310)
* Hide whatis database building from the user

It's really an internal detail, but shows up in prompts that display how many
background jobs are running.

By disowning it keeps running but won't show up in `jobs` or get killed if the user
exits the shell.

* Update __fish_apropos.fish
2021-09-23 10:59:44 +02:00
Pascal Huber
3099d7bdeb Fix man completion for BSD's mandoc 2021-09-21 12:34:21 +02:00
Kid
0d8ffa8f87 Make less version check compatible with older Fish 2021-09-17 17:32:03 +02:00
ridiculousfish
05fdee1be7 Continue passing -X / --no-init for less < v530
The less -F / --quit-if-one-screen option is buggy before v530. To work
around this, pass --no-init less versions older than 530.

The --no-init option was previously passed; it was removed in d15a51897d
for mouse support. Unfortunately it looks like we can't have mouse
support and --quit-if-one-screen on macOS shipped less (version 487).

It's worth fixing this because otherwise history and help is just not
printed on stock macOS.

Relevant is https://unix.stackexchange.com/questions/107315/less-quit-if-one-screen-without-no-init

Fixes #8157.
2021-09-16 18:03:03 -07:00
Johannes Altmanninger
51a3885d8c funced: avoid interpreting special characters in function name
Commit c3374ffd0 ("Use read --tokenize instead of eval for $BROWSER &
$EDITOR") converted uses of "eval" for environment variables to use the
safer "read -at", which performs word splitting but no other expansion.

funced contained a leftover instance of "eval". Remove it in favor
of using the editor command that was already word-split.
This means that we don't accidentally evaluate the file name.

(Also "set -gx EDITOR=~/my-editor" won't work anymore because the ~
is not expanded anymore but no one has complained about that behavior
in edit_command_buffer.)

Fixes #8289
2021-09-13 19:16:41 +02:00
Victor Diaz
8c09fc7a3a Prepend command to cat
*Problem:*
edit_command_buffer uses `cat` to return the modified content.
If a person has an alias for `cat` to a different command such `bat`** the editing will not be useful anymore since bat decorates the text with frames, line counts, etc

*Solution*
Appending command to cat, fish will ignore the alias and execute the real command according to this https://fishshell.com/docs/current/cmds/command.html

** https://github.com/sharkdp/bat
2021-09-12 22:11:01 +08:00
Kid
139b74d8eb Fix fish_key_reader wrapper check 2021-09-05 21:42:35 +02:00
Fabian Homborg
4194977569 Prompt demo: Only the unmatched quote is an error
The text after is normal quoted text since
822b53c67a.

We might want to find nicer error text.

Fixes #8260.
2021-08-30 17:32:55 +02:00
Fabian Homborg
0e06a53dff help: Add sections directly via the <span id>
This should add all the sections that aren't linked internally,
including "identifiers".

(also give up on the line breaking because it makes it annoying to do
automatically)

Fixes #8245.
2021-08-22 13:14:59 +02:00
Fabian Homborg
fe71e62a68 help: Update sections
This was semi-automated with

```fish
for file in $argv
    set -l varname (string replace -r '.*/(.*).html' '$1' -- $file | string escape --style=var)pages
    set -l sections (string replace -rf '.*class="headerlink" href="#([^"]*)".*' '$1' <$file)

    echo set -l $varname $sections
end
```

(where $argv contains the path to faq, fish_for_bash_users,
interactive, language and tutorial.html)

Building help.fish at compile time would work, but only for users who
build the docs.
2021-08-20 17:40:57 +02:00
aca
321fd74de0 edit_command_buffer: use "command" to ignore any functions with the same name 2021-08-17 06:24:09 +02:00
David Adam
ff8f26e65a funced: suggest saving functions when an editor is used 2021-08-16 21:45:23 +08:00
David Adam
8dd4c67db1 funcsave: edit the whole file containing a function
Many functions ship in files with helper functions, and it is useful to
edit those too.

Closes #391.
2021-08-16 21:45:22 +08:00
David Adam
52eff27239 funced: don't source or save unmodified files
If funced is just used to inspect a function, there's no need to write
it to storage or to reload it.
2021-08-16 21:44:43 +08:00
David Adam
911269c4a9 funcsave: avoid the edited function's path being a temporary file
As functions know where they are loaded from now, there is no point in
them being marked as loaded from a temporary file that has been removed.
Source the function via a redirect instead.
2021-08-16 21:44:43 +08:00
ridiculousfish
b0b6a585a8 Support Apple_Terminal in fish_vi_cursor
This enables it unconditionally, as tests show that the cursor escapes
are ignored before 10.12.

Fixes #8167
2021-08-10 13:23:08 -07:00
Johannes Altmanninger
96e665f9ec __fish_complete_subcommand: (re)move confusing comment 2021-08-10 21:01:39 +02:00
Fabian Homborg
6c1ec98e92 prompt_pwd: full-dirs set to 0 means not even last component is safe
Alternative is to print an error.
2021-08-09 17:42:00 +02:00
Fabian Homborg
af2952dd2f Allow passing directories to prompt_pwd
This allows us to test it without cd-ing about the place.
2021-08-09 17:42:00 +02:00
Fabian Homborg
7a8feb4656 prompt_pwd: Allow keeping components full length
And allow passing the parameters as options.
2021-08-09 17:42:00 +02:00
Andrew Schulman
afef67b4e8 Fix dirs returns false when $dirstack is empty 2021-08-09 12:43:03 +02:00
Fabian Homborg
fcbf303e05 Only do the macOS apropos thing if makewhatis is available
This won't work without it, and happens to be broken on jailbroken
iOS.

Fixes #8205.
2021-08-04 18:55:01 +02:00
Johannes Altmanninger
1b20e75f19 Run fish_indent on share/**.fish 2021-08-01 18:59:45 +02:00
Kevin Konrad
413fd2fc03 extract argcomplete completion mechanism into its own function 2021-07-28 18:10:59 +02:00
Johannes Altmanninger
72fd328ad2 fish_clipboard_{copy,paste}: only use xsel/xclip if $DISPLAY is set
Ubuntu's fish package on WSL 1 has xsel as recommended dependency,
even though there is no X server available.  This change makes us
use Windows' native clipboard even when xsel is installed.
2021-07-23 20:55:07 +02:00
Fabian Homborg
7167ba6e08 Work around Terminal.app's awkward alt-left/right sequences
Just do the more involved thing.

Blergh.

Fixes #2330.
2021-07-23 19:38:43 +02:00
Aniruddh Agarwal
0445126c2e Undunder __fish_is_nth_token
We keep __fish_is_nth_token for compatibility and edit the
implementations of __fish_is_nth_token, __fish_is_first_token and
__fish_is_token_n to use fish_is_nth_token
2021-07-23 17:25:50 +02:00
Fabian Homborg
11da6db009 Cleanup of a comment 2021-07-22 19:19:49 +02:00
Fabian Homborg
405a03bfae fish_config: Pass filenames as arguments
This injected filenames into fish script, which could inject things
that looked like fish script.

E.g. create a file called `~/.config/fish/themes/"; rm -rf ~/*"`.

Note that the prompts are all shipped by us, but the themes can
technically be added by the user, and they might not be dilligent in
what filenames they allow.
2021-07-16 17:30:35 +02:00
Fabian Homborg
900e4a232e fish_config: Error for choose/save with too many/few args 2021-07-14 19:48:33 +02:00
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
ee3a1f24c3 completions/gpg: Don't require an email address
Fixes #8079
2021-07-14 17:30:51 +02:00
Fabian Homborg
04af336843 vi-mode: Repaint mode after cancelling
Fixes #8103
2021-07-03 21:37:33 +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