Commit Graph

1976 Commits

Author SHA1 Message Date
Andrew Cassidy
d22f22c3b3
Print message in fish_add_path -v when a path doesnt exist (#8884)
* Print message in set_fish_path -v when a path doesnt exist

* Update changelog

* Remove "; or continue"

* use printf instead of echo, avoid localizing the path
2022-04-18 09:58:05 +02:00
Fabian Homborg
2fa51f1843 Add $EUID and use it in fish_is_root_user
Fixes #8866
2022-04-15 15:58:39 +02:00
Johannes Altmanninger
32ed0b80da Don't erase job status message when using multiline prompt
As explained in the parent commit, if we print things to the command line,
we move the cursor down before redrawing a multi-line prompt.  This is a
workaround to avoid erasing what we printed.

We forgot to do add this workaround to fish_job_summary. When running
`sleep 1 &` with a multiline prompt, the job exit notification is immediately
overwritten (most of the time).  This can be observed consistently on Linux
by waiting before redrawing:

    diff --git a/share/functions/fish_job_summary.fish b/share/functions/fish_job_summary.fish
    index a552fabbc..f457ee8e8 100644
    --- a/share/functions/fish_job_summary.fish
    +++ b/share/functions/fish_job_summary.fish
    @@ -52,6 +52,7 @@ function fish_job_summary -a job_id is_foreground cmd_line signal_or_end_name si
         string repeat \n --count=(math (count (fish_prompt)) - 1) >&2

         if test $is_foreground -eq 0; and test $signal_or_end_name != STOPPED
    +        sleep 1
             commandline -f repaint
         end
     end

Move the cursor down to work around this. In future, we could avoid calling
fish_prompt.  Also, this solution add an extra blank lines before the next
prompt.  With a real fix, we could get rid of that. Even worse, sometimes
there are two blank lines instead of one (for a two-line prompt).

Fixes #8817
2022-04-09 22:33:23 +02:00
Johannes Altmanninger
b28a18be73 Simplify cursor movement for multi-line prompts before repainting
We have some key bindings that print directly to the terminal while the user
is still typing the command line. Thereafter, we redraw the command line,
so the user can resume typing. To redraw a multiline command line, we first
erase several lines above the cursor. To not erase the key bindings' output,
we move the cursor down that many lines.

Simplify the logic; no functional change.
2022-04-09 22:33:23 +02:00
Fabian Homborg
789b2010f5 Don't use a function variable in alias
This conditionally set a function variable in an unsafe way.

If you do something like

```fish
if condition
   set -f foo bar
end
```

then, if the condition was false, $foo could still use a global variable.

In this case, alias would now fail if a variable $wraps was defined globally.

This reverts most of commit 14458682d9.

The message rewording can stay, it's *fine* (tho it'll break the
translations but then we'd need a real string freeze with a
translation team for those to be worth anything anyway, soo)
2022-04-08 16:33:27 +02:00
Aaron Gyes
14458682d9 alias: little cleanup 2022-04-07 09:25:16 -07:00
Thom Chiovoloni
a770ff144e Make more of the functions in share/functions print error messages to stderr 2022-04-04 18:26:14 +02:00
Fabian Homborg
84bd1715d8 history: Add missing "--" for delete
Fixes #8853
2022-04-03 21:02:15 +02:00
Fabian Homborg
f13979bfbb Move executable-check to C++
This was already apparently supposed to work, but didn't because we
just overrode errno again.

This now means that, if a correctly named candidate exists, we don't
start the command-not-found handler.

See #8804
2022-03-31 15:16:01 +02:00
David Adam
fa2450db30 vared: avoid using local variables
The tmp and prompt variables collide with variables used as arguments.
Just avoid them entirely, at the cost of making the internals of the
functions somewhat more complicated.

Closes #8836.
2022-03-27 23:52:49 +08:00
Fabian Homborg
2c702de52c Put funcsave long option back
This reverts ed8c78c0ea, emphatically.

Fixes #8830
2022-03-24 20:11:39 +01:00
Fabian Homborg
edbd3baa59 fish_config: Set colors that aren't set in the theme to empty
This allows keeping it to the fallback value, making us independent
from the theme that was set before.
2022-03-20 17:04:28 +01:00
Fabian Homborg
751c7cbf9c fish_config CLI: Use color fallbacks 2022-03-20 17:04:28 +01:00
Fabian Homborg
666032abbd Translate command-not-found message
I have no idea why this function is defined twice.
2022-03-17 18:19:03 +01:00
pagedown
47294f4d29 Add kitty to __update_cwd_osc 2022-03-17 18:17:42 +01:00
Fabian Homborg
fb283cfe4a Move $__fish_initialized to config_interactive
This is no longer used in share/config.fish, and it's quite cheesy.

The only thing we use it for is defaulting the colorscheme.
2022-03-17 18:15:11 +01:00
Fabian Homborg
49c16cc9a6 Stop migrating old abbrs
This tried migrating old abbreviations *twice* - once from the 2.3
scheme to the 2.4 one, and once from that to the 3.0 scheme.

Since this is purely for upgrading from fishes < 3.0, and basically
untested, let's remove it.

If anyone does that upgrade, they'll simply have to reexecute the abbrs.
2022-03-17 18:15:11 +01:00
Fabian Homborg
71cfd25c1d Command-not-found: Warn if a file exists but isn't executable
This simply adds a nice error so you can better see if your command
isn't available because it's not executable.

Fixes #8804.
2022-03-17 18:06:36 +01:00
Fabian Homborg
c5a8764db1 Use old-school "()" command substitution in fish_title
Because we reload changed function files, a common issue on upgrading
to 3.4.0 is that fish_title causes errors.

So we simply use the oldschool syntax.
2022-03-14 18:15:06 +01:00
Fabian Homborg
2d545c651d fish_title: Make directory shortening consistent
I have no idea why this kept one component in the one case and none in
the other.

Because we already aggressively shorten the command, we can keep the directory.
2022-03-06 13:15:03 +01:00
Fabian Homborg
7b01b4d308 fish_title: Show hostname if connected via ssh
See #8641
2022-03-06 13:14:22 +01:00
Spenser Black
63d7386a36 completions/gpg: list only secret for gpg options that manage secret keys
Some GPG options work only with private keys but our completions suggest all
keys.  Modify `__fish_complete_gpg_user_id and __fish_complete_gpg_key_id`
to take an optional argument for the "key type" to override `--list-keys`
with like `--list-secret-keys` for the appropriate options.

Closes #8712
2022-02-19 13:48:20 +01:00
Johannes Altmanninger
47b0d0c293 Make __fish_is_nth_token and __fish_nth_token private again
Their names are not perfect, so let's keep them as internal functions,
until we figure out how/if we want to expose this.

This reverts 0445126c2 (Undunder __fish_is_nth_token, 2021-06-29) (but I
did it without "git revert").

Closes #8008
2022-02-13 10:45:38 +01:00
Mahmoud Al-Qudsi
b06a8a2e0c Add public function fish_nth_token to mirror fish_is_nth_token
Completions may benefit from using these in tandem to dynamically generate
completions predicated on the value of an earlier token in a cleaner fashion.
(Currently, most of called completion helper functions introspect the command
line to get the value of an earlier argument, making them less reusable for
different expressions that need completions of the same type. This way, the
completion can provide the function with the argument value explicitly.)
2022-02-08 14:17:00 -06:00
Mahmoud Al-Qudsi
99e0aa3c64 Clarify fish_is_nth_token description
Yes, this does make it longer but it's a very important point.
2022-02-08 14:17:00 -06:00
Johannes Altmanninger
13edce3671 share/**.fish: reformat with fish_indent 2022-02-07 20:53:55 +01:00
Johannes Altmanninger
0e6313b98b help: error out on unknown help topic
Probably too minor for a changelog?

Fixes #8698
2022-02-05 20:32:58 +01:00
Johannes Altmanninger
348a5b6baf Restyle detection of terminals that support OSC 7
We detect one terminal (foot) with a "string match" command, and all others in a long "test"
command.  Let's put the detection of each terminal on a new line. This should be easier to read
and change. It also allows to lose one level of indentation.
2022-02-05 20:08:06 +01:00
Fabian Homborg
0afb9b5709 fish_title: Shorten command to 20 characters
Otherwise this makes massive terminal tabs
2022-02-03 13:52:59 +01:00
Fabian Homborg
4c9e31afe9 Move color initialization back
This was an undocumented undunderscored function that wouldn't be
super useful to actually use manually (because it still checked if the
variable was set!). It also relied on `__init_uvar`, which was only
set in `__fish_config_interactive`.

Additionally it didn't remove any complexity because this was all very
simple "do thing a, do thing b, do thing c" stuff. It added a layer of
indirection instead, and made fish startup dependent on another
function.

If you want to reset your colorscheme to the default, use fish_config.
2022-02-03 13:09:52 +01:00
Jason Nader
cd3658d457 Ensure short option description is not overridden
Without this the description for `-o` was being set to "Set the page margins when printing text files"
2022-02-02 18:19:15 -08:00
Aaron Gyes
e05844a3cd default colors: use reverse for pager selection.
I accidentally set some arbitrary grey in my previous commit,
causing a low contrast situation OOB.
2022-01-28 04:39:36 -08:00
Aaron Gyes
03b23dd1b6 Update default colors
- Use named colors instead of hex values - not sure how this
   happened in the first place, these all map to basic named colors.

 - Reinitialize if these were last set on fish <3.4, new variables
   have been added.

 - Break this into a separate function for the sake of
   __fish_config_interactive complexity, and allow for running
  manually.
2022-01-27 16:46:41 -08:00
Aaron Gyes
c6166f8ced Shorten more.
More vain attempts to get a bare <TAB> showing as 2 columns in the
pager. This now happens in a 101 column terminal.
2022-01-27 16:21:22 -08:00
Aaron Gyes
34753cf0f6 up-or-search: shorten description 2022-01-27 15:54:41 -08:00
ridiculousfish
b8fd6b5f31 Run fish_indent over new Windows completions 2022-01-26 22:02:23 -08:00
EmilySeville7cfg
78bd0f9cdb Prettify all commands:
- rename *list* functions to *print*
- use short options everywhere
- delegate less work to functions
2022-01-26 21:37:39 -08:00
EmilySeville7cfg
7ae194cb03 Rename __fish_list_windows_drives function:
- new name is __fish_print_windows_drives
2022-01-26 21:37:39 -08:00
EmilySeville7cfg
f047ef4ea2 Remove __fish_generate_password function 2022-01-26 21:37:39 -08:00
EmilySeville7cfg
d3ad5fe398 Remove complete for internal cmd commands 2022-01-26 21:37:39 -08:00
EmilySeville7cfg
1cd0726913 Clean-up md/rd completions:
- use __fish_list_windows_drives
- hide dependent options
2022-01-26 21:37:39 -08:00
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