Commit Graph

4376 Commits

Author SHA1 Message Date
Johannes Altmanninger
1dc5268847 Bind Shift+Space CSI u sequence to Space
Some terminals can be configured to send variuos escape sequences for keys
that could historically not be detected. Turns out some usage pattern rely
on those quirks.

Shift+Space is easy to mistype when wanting to insert a space (especially
when typing ALL CAPS). Map it to Space, to match user expectations.

Similarly for Control+Return, for which xterm can be configured to send
something other than \cr:

    echo 'XTerm.vt100.modifyOtherKeys: 1' | xrdb && xterm

I'm working on a change to builtin bind that allows to bind CSI sequences via
human-readable key names (#3018) but for now let's just map the raw sequences.

Closes #8874
2022-04-24 21:37:20 +02:00
Johannes Altmanninger
c34e694126 Share some key bindings with Vi's insert mode 2022-04-24 21:31:51 +02:00
Chloe Kudryavtsev
8c7ba5efea fix: edit_command_buffer with micro without parsecursor
micro only parses the [FILE]:LINE:COL syntax
if the parsecursor option is enabed

in the meanwhile, the +LINE:COL syntax is unambiguous and always valid
2022-04-24 15:15:06 +02:00
ridiculousfish
1bba97984b Fix vared of indexed value
You can use an index with vared, like `vared PATH[4]`. However this was
inadverently broken in fa2450db30, because you cannot use `read` to
modify an element of a variable, only the whole variable. Fix this.

Unfortunately this means using another local variable, so we name it
__fish_vared_temp_value instead of just temp so that collisions are
unlikely.
2022-04-23 16:35:52 -07:00
ridiculousfish
b94600d181 Correct depth/deepen completions for git fetch 2022-04-23 16:13:50 -07:00
NextAlone
a6277f0c72 feat: complete git fetch options 2022-04-23 16:10:01 -07:00
Fabian Homborg
8060ab27b3 Webconfig: Fix quote color also in the theme list
In fixing #8260 we only fixed it for the selected colorscheme at the
top, not the color scheme list below.

Oops. Maybe check the DOM next time.
2022-04-22 19:52:04 +02:00
ridiculousfish
939ce10616 Fix test error in localectl completion
localectl may emit an error for whatever reason. The localectl
completion runs localectl in a command substitution so our stderr
redirect doesn't apply. Just redirect to null. Hopefully this fixes the
tests.
2022-04-21 20:53:59 -07:00
ridiculousfish
4e1b5e733f Supress stderr on kubectl completions
This suppresses 'Unsupported shell type "fish"' on presumably older
kubectls.
2022-04-21 14:26:30 -07:00
Fabian Homborg
10785ba814 completions/rustc: SILENCE
Otherwise this might print

> error: no override and no default toolchain set
2022-04-21 17:35:00 +02:00
Fabian Homborg
e358ec0ce2 Silence debconf error
I *think* this is printing

> debconf: DbDriver "passwords" warning: could not open /var/cache/debconf/passwords.dat: Permission denied

On Github Actions?

Might need to adjust the test to store the output.
2022-04-21 17:25:17 +02:00
Fabian Homborg
c0fc80cb59 completions/timeout: Stop spewing
GNU timeout prints the version to stdout. Just silence both.
2022-04-21 17:15:20 +02:00
Fabian Boehm
be828b50e3
completions/adduser: Fix quoting
This used single-quotes inside single-quotes, so it ended up running a glob.

Fixes #8896.
2022-04-21 12:57:35 +02:00
Jason Nader
2a22a91544
completions: add wg-quick (#8687)
* completions: add wg-quick

* fixup
2022-04-18 11:41:14 +02:00
Peter Stolz
4116a9cc11 Improove completions for ip netns 2022-04-18 11:40:23 +02:00
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
eb468ea744 Fix env completions
Our old friend, local variable inside a block.

Also account for the fact that the current token is often empty.

Fixes #8881
2022-04-16 08:36:58 +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
Matti Viljanen
8945b7ac08 fish_config: use xdg-open [URL] on Sailfish OS
This is a follow-up to #8811, which fixed fish_config on newer versions of
Sailfish OS.

Using the previous method to open the fish_config URL on Sailfish OS worked
only on 4.4 (and 4.3 IIRC), but not on older OS versions. Opening the URL
using xdg-open works well with new and old OS version, and has been tested on

- Sony Xperia 10 II running SFOS 4.4 aarch64
- Sony Xperia XA2 Ultra running SFOS 4.4 armv7hl
- Sony Xperia X running SFOS 4.1 armv7hl
- Jolla Phone running SFOS 3.4 armv7hl

Closes #8872
2022-04-14 19:26:11 +02:00
Tom Rijnbeek
2bf9b97ab7 Address review comments
* Add workspace completions
* Fix missing file completions
2022-04-13 11:10:50 +02:00
Tom Rijnbeek
3b2fb23bca Update terraform completions 2022-04-13 11:10:50 +02:00
Tom Rijnbeek
26c982ac8f Extract common completions for apply, destroy, and plan 2022-04-13 11:10:50 +02:00
Tom Rijnbeek
a56fc622ae Replace single quotes with double quotes in terraform completions to allow for interpolation 2022-04-13 11:10:50 +02:00
Budiman Jojo
b475878df6
feat(completions): add sops completions (#8821)
* feat(completions): add sops completions

* fix: start descriptions with uppercase letter

* fix: shorten descriptions

* fix: use spaces instead of ;

* fix: typo

* feat: better option than __fish_is_first_token

* feat: improve __fish_sops_commands function

* fix: remove useless code

* fix: fix the second argument is not called
2022-04-13 10:44:58 +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
Johannes Altmanninger
446f4efa65 completions/mpv: speed up loading
Goes from 200 ms to 100 ms. Probably there is some overhead when calling
complete in a loop; we might be able to fix that.
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
Paul Kasemir
380c555842
completions/lxc: parse container names with numbers and other commands (#8860)
* completions/lxc: parse container names with numbers and other commands

* Revert CHANGELOG.rst

* Code Review: use multiple subcommands ability of __fish_seen_subcommand_from
2022-04-06 22:16:37 +02: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
Johannes Altmanninger
d87bbf9433 completions/status: fix wrong completion for test-feature
Reported in
5f94dfd094/.config/fish/README/bug.md (wrong-tab-completion-for-status-test-feature)
2022-04-03 15:54:08 +02:00
Johannes Altmanninger
ff72e3f154 completions/git: speed up loading git.fish when "git-foo" completions already exists
git.fish loads git-foo.fish completions.
As reported in #8831, this can be slow when the user has run something like

    complete git-foo -w 'git diff'

because git.fish runs 'complete -C "git-autofixup "' at load time.
Commit 09161761c (Complete custom "git-foo" commands from "git foo",
2021-01-24) did that to avoid adding filename completions for "git foo".
Drop that check.

This means that users who don't want filename completion for "git foo",
need to define at least one custom completion for "git-foo", like

    complete git-foo -f
2022-04-02 12:52:57 +02:00
Aaron Gyes
cd23fdac2e killall completions: fix '-procname' procs, -help, -t description 2022-03-31 20:28:25 -07:00
Johannes Altmanninger
bb055c7c81 completions/code: also complete paths for --install--extension
The docs state:
code --install-extension <ext-id | path> Installs or updates an extension. The
argument is either an extension id or a path to a VSIX.
2022-03-31 17:25: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
Kid
90d52ee669
Complete /dev/fd in isatty (#8840)
* Complete `/dev/fd` in `isatty`

* Check `/dev/fd` existence first
2022-03-30 18:29:59 +02:00
Kid
820f8bc1af Update a few git completions 2022-03-30 18:29:21 +02:00
Fabian Homborg
f9f0ad1ef7 completions/git: Check alias definitions for an option
This allows e.g. defining

    	re = restore --staged

and then getting completions for `restore --staged`, not just `restore`.

Fixes #8843
2022-03-30 18:25:00 +02:00
Fabian Homborg
51b663787f completions/git: Complete git restore -S
This used `contains`. Let's just use `__fish_contains_opt` and pass
the short option as well.

See #8843.
2022-03-30 16:42:19 +02:00
Aaron Gyes
de03322073 Update date completions for newer BSDs
-d has been removed in FreeBSD 13 & monterey
-t has also been removed from date(1)
-n has been "Obsolete flag, accepted and ignored for compatibility",
   for a while, leave it out.
-R added for RFC 2822
-I added for ISO 8601

Some description changes
2022-03-28 09:26:00 -07: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
Aaron Gyes
b83d8dc8c0 angular: remove sourceMappingURL comments
We don't ship source maps, so just remove these
comments to prevent the annoying 404s the server
will print out when using `fish_config`.
2022-03-26 17:14:09 -07:00
Fabian Homborg
62807c2788 fish_config: Let tabs wrap
Otherwise they would scroll off-screen for narrow windows. This was intentional.
2022-03-26 22:54:17 +01:00
Aaron Gyes
be4fa1dc1a fish_config: improve tab display
Use a heavier weight slightly larger font, remove the borders, and
prevent wrapping like:

    Binding
       s
2022-03-26 14:46:46 -07:00
Fabian Homborg
25e02ea07f fish_config: Use the same body fonts as the doc theme
Otherwise this was 100% monospace.

But since we have a specific list of fonts that we have checked, let's
use the same list instead of just adding "Helvetica" again.
2022-03-26 21:57:11 +01:00
Fabian Homborg
ff6a12e9c6 Revert "fish_config: use system-ui/sans serif for non-shell/code text"
Like the comment says: List explained in pydoctheme.css.

This also removed a number of other fonts.

This reverts commit f3cf32a085.
2022-03-26 21:53:23 +01:00
Aaron Gyes
f3cf32a085 fish_config: use system-ui/sans serif for non-shell/code text
This is nicer. It was actually using monospace fonts across
the board before.

Tweak tab rendering.
2022-03-26 13:48:23 -07:00
Aaron Gyes
776fc0b7f3 fish_config: HTML5 doctype 2022-03-26 13:27:22 -07:00