Commit graph

4463 commits

Author SHA1 Message Date
Alexander M
8d57bc6a9a Fix long descriptions in gdb.fish
Work on #6981
2022-07-09 12:28:22 +02:00
Johannes Altmanninger
1527edd542 Stop printing extra newline when Alt-W or Alt-L is used with a multiline prompt
When we want to print something while the prompt is still active, we move the
cursor by printing a newline for each line in the prompt beyond the first
one. As established by 80fe0a7fc (fish_job_summary: Format message better
for multiline prompts, 2022-06-28), our use of "string repeat" actually
prints an extra newline. Let's remove it here as well.
2022-07-06 16:31:17 +02:00
Guy Bolton King
1f130fbfe1 Remove invalid trailing period in CSI u shift-space binding 2022-07-04 19:43:03 +02:00
Fabian Boehm
8082f8c056 completions/git: Use __fish_git
That's the one that silences stderr!
2022-07-03 09:42:37 +02:00
Kid
e6505d1c30 file completion nuances on macOS 2022-07-02 11:33:03 +02:00
Fabian Boehm
80fe0a7fcb fish_job_summary: Format message better for multiline prompts
This was supposed to be number of lines in the prompt minus 1, but
string repeat added one.

Also it triggered even in case of the stopped job message, which is
already repainted differently.

So we add it when we need to repaint ourselves.

As a bonus add a newline before in that case so the message isn't
awkwardly printed into the commandline.

Fixes #9044.
2022-06-28 18:03:09 +02:00
Fabian Boehm
842af06c5d completions/git: Cache subcommand v2
This is sort of slow because it's called hundreds of times.

We used to have a cache, introduced in ad9b4290e, but it was removed
in fee5a9125a because it had
false-positives.

So what we do, because the issue is that this is called hundreds of
times per-commandline, we cache it keyed on the commandline.

This speeds up `complete -C'git sta'` by a factor of 2.3x.
2022-06-27 17:15:30 +02:00
Johannes Altmanninger
fee5a9125a Revert "completions/git: cache subcommand computation"
Commit ad9b4290e optimized git completions by adding a completion that would
run on every completion request, which allows to precompute data used by
other completion entries. Unfortunately, the completion entry is not run
when the commandline contains a flag like `git -C`. If we didn't
already load git.fish, we'd error. Additionally, we got false positive
completions for `git diff -c`.

So this hack was a very bad idea. We should optimize in another way.
2022-06-26 23:02:26 +02:00
Rocka
c588bd5c5c completions: add qdbus completion 2022-06-25 21:59:57 +02:00
NextAlone
5642499dc2
feat: completion for reflector (#9027)
* feat: completion for reflector

* fix
2022-06-25 21:59:18 +02:00
mhmdanas
9f19ab1fba Prioritize APKs for adb install 2022-06-25 12:03:22 -07:00
exploide
459bbe208d scp completions: added new options 2022-06-25 12:02:19 -07:00
Fabian Boehm
a004a10a80 fish_git_prompt: Remove variables we don't care from event handler
This was called e.g. when showdirtystate was changed, but then checked
if it was called for the informative statusses only. Simply remove
them.
2022-06-21 20:22:27 +02:00
Fabian Boehm
b4a3b9982c Activate fish_vi_cursor for tmux
Discussions with the tmux maintainer show that:

1. We no longer need the passthrough sequence at all (and it's
deactivated by default)
2. Tmux can check if the outer terminal supports cursor shaping

Fixes #8981
2022-06-20 17:42:29 +02:00
Evan Lloyd New-Schmidt
a605bcb830 Show manpage for command under cursor
This commit lets you check the manpage for a leading command by moving
the cursor over it, matching the behavior of tab complete.

It also lets you select the man page for the base of a two-part command
like `string match`.

The additional regex case is added because
`commandline -t` returns an empty string when the cursor is after a
space, e.g. at the end of 'sudo ', which the later checks don't handle.

This diagram shows the manpage picked for different cursor positions:

    > sudo -Es time git commit -m foo
      +-------++---++--++------------+
      |       ||   ||  ||            |
      |       ||   ||  |+------------+
      |       ||   ||  |  git-commit
      |       ||   |+--+
      |       ||   | git
      |       |+---+
      |       | time
      +-------+
         sudo
2022-06-17 07:21:25 +02:00
Fabian Boehm
8f08fe80fd Restyle codebase
Not a lot of changes, tbh
2022-06-16 18:43:28 +02:00
Fabian Boehm
0bc524340c Fix rsync
Sorry!
2022-06-16 10:59:54 +02:00
Fabian Boehm
3e0bd0b7e1 Make rsync escaping version-dependent 2022-06-16 09:50:59 +02:00
Farid
f2b16a822e Fixed escaping in rsync completion 2022-06-16 09:50:38 +02:00
pl3w5y
b4ec84d8a1
updated function __fish_print_portage_repository_paths.fish (#9012)
* updated function __fish_print_portage_repository_paths.fish to support file, dir and modified defaults

* Revised version of share/functions/__fish_print_portage_repository_paths.fish

* improved syntax and regex as suggested
2022-06-16 00:27:42 +02:00
MidAutumnMoon
93eb8e9928 completions: zfs: fix for set subcmd 2022-06-15 20:48:08 +02:00
Fabian Boehm
6ab0a3d81f webconfig: Print url
This makes it easier to get it if e.g. the browser can't open files in
/tmp (... Ubuntu...)

See #9014
2022-06-14 21:43:57 +02:00
Fabian Boehm
b004635bc9 completions/git: Add some more options 2022-06-13 18:24:24 +02:00
ridiculousfish
b41c086984 Bravely allow setting the cursor shape in iTerm2 by default
The recent improvements to multiline prompts and vi-mode in #3481 appear
to be sufficient to make iTerm2 well behaved, so remove our hack which
disabled it by default.

Fixes #3696
2022-06-12 13:19:26 -07:00
David Adam
68f67ff46c git completions: make :/:-prefixed paths work everywhere on old git
git versions that only support porcelain v1 output (like on CentOS 7,
which has 1.8.3) weren't completing files prefixed with : correctly iff
the name after the colon was also a valid relative path.

Fixes the tests on CentOS 7.
2022-06-12 22:10:36 +08:00
Akatsuki Rui
bb158880d5 Add efibootmgr completion 2022-06-09 18:51:59 +02:00
Fabian Homborg
56b3b27206 Fix format string
The terlar prompt uses `|branch`, this is visually quite important.
2022-06-08 21:23:43 +02:00
Fabian Homborg
8af2f96b4f Rebuild terlar git prompt as a configuration for fish_git_prompt
This removes the awkward secondary logic.

Note that we still ship a function called `__terlar_git_prompt`
because people who picked the prompt will still be calling it - we
don't update the prompt.
2022-06-08 21:23:43 +02:00
Fabian Homborg
3552a11afa fish_git_prompt: Print cleanstate character whenever it's defined
And then only define it in informative mode.
2022-06-08 21:23:43 +02:00
Fabian Homborg
ca9910edb7 fish_git_prompt: Add colors for dirty/staged branches
This is a neat feature of the terlar git prompt
2022-06-08 21:23:43 +02:00
Fabian Boehm
fc82840132 terlar prompt: Also ignore untracked files unless explicitly asked 2022-06-08 21:11:30 +02:00
Arash Mousavi
88502ca49f Add uninstall command to rbenv.fish completion
`uninstall` is part of the ruby-build.
2022-06-08 17:34:25 +02:00
David Adam
219a15d1db ip completions: fix case statements for show/save/flush
An errant end prevented the relevant section of the switch statement from being evaluated.

Fixes #9008.

Thanks to caoczy@github for the diagnosis.
2022-06-08 21:44:39 +08:00
Fabian Boehm
0ea6703661 completions/git: Terminate pathspec magic
Git's pathspec system is kind of annoying:

>  A pathspec that begins with a colon : has special meaning. In the short form, the leading colon : is followed by zero or more "magic signature" letters (which optionally is terminated by another colon :), and the remainder is the pattern to match against the path. The "magic signature" consists of ASCII symbols that are neither alphanumeric, glob, regex special characters nor colon. The optional colon that terminates the "magic signature" can be omitted if the pattern begins with a character that does not belong to "magic signature" symbol set and is not a colon.

So if we complete `:/foo`, that "works" because "f" is alphanumeric
and so the "/" is the only magic character here.

If, however the filename starts with a magic character, that's used as
a magic signature.

So we do what the docs say and terminate the magic signature after the
"/" (which means "from the repo root").

Fixes #9004
2022-06-07 20:10:13 +02:00
Kid
9238bbde65 Update kitty completion 2022-06-07 16:26:09 +02:00
Fabian Homborg
9361325137 help: Let help path go to the builtin, not the tutorial section 2022-06-07 14:32:27 +02:00
Fabian Homborg
d2ed51bcad fish_vi_cursor: Don't blink by default
Blinking is awkward and can result in wasted battery.
2022-06-07 14:32:27 +02:00
exploide
44205b188b completions 7z: allow to complete file names 2022-06-07 14:30:23 +02:00
Mike Lei
9d7e0b281b completions: include nologin in useradd/adduser shell options 2022-06-07 14:29:50 +02:00
Fabian Homborg
f9a170e5f2 git_prompt: Only show untracked files in informative mode if asked
This makes it so

1. The informative status can work without showing untracked
files (previously it was disabled if bash.showUntrackedFiles was
false)
2. If untrackedfiles isn't explicitly enabled, we use -uno, so git
doesn't have to scan all the files.

In a large repository (like the FreeBSD ports repo), this can improve
performance by a factor of 5 or up.
2022-06-07 13:30:03 +02:00
SeekingBlues
cf620c829b Improve newline behavior of kill-whole-line
Previously, `kill-whole-line` kills the line and its following
newline. This is insufficient when we are on the last line, because
it would not actually clear the line. The cursor would stay on the
line, which is not the correct behavior for bindings like `dd`.

Also, `cc` in vi-mode used `kill-whole-line`, which is not correct
because it should not remove any newlines. We have to introduce
another special input function (`kill-inner-line`) to fix this.
2022-06-04 13:45:25 -07:00
SeekingBlues
025acfe45a Add -k completion for gzip and gunzip 2022-06-04 13:05:50 -07:00
David Adam
a4749356ae fish_git_prompt: drop --ignored flag in git status
Arguments to --ignored were introduced in Git 2.16, from January 2018.

The git completions specifically work around this, allowing older
versions to be used; match this in the git prompt.

Fixes the tests on CentOS 7.
2022-06-02 15:50:43 +08:00
Fabian Homborg
540aea5999 completions/dnf: Try to stop dnf reading from the terminal
Fixes #8984.
2022-06-01 21:45:50 +02:00
Fabian Homborg
661ea41861 fish_git_prompt: Use "dirty"/"staged" regex like informative
When switching this to use `git status`, I neglected to use the
correct definition of what a "dirty" and a "staged" change is.

So this now showed already staged files still as "dirty".

Fixes #8986
2022-06-01 17:24:08 +02:00
Fabian Homborg
905db80c28 Convert git completions to multi-condition 2022-05-30 20:47:14 +02:00
Fabian Homborg
f10deb124b completions/string: Use multiple conditions 2022-05-30 20:47:14 +02:00
Fabian Homborg
542a78a4c3 fish_git_prompt: Use git status when showDirtystate is enabled
It's faster
2022-05-30 17:22:35 +02:00
Fabian Homborg
e6136f08fb completions/path: Add --reverse 2022-05-29 20:36:11 +02:00
Fabian Boehm
4612343d6e
Merge pull request #8958 from faho/builtin-path
This adds a path builtin to deal with paths.

It offers the following subcommands:

    filter to go through a list of paths and only print the ones that pass some filter - exist, are a directory, have read permission, ...
    is as a shortcut for filter -q to only return true if one of the paths passed the filter
    basename, dirname and extension to print certain parts of the path
    change-extension to change the extension to a different one (as a string operation)
    normalize and resolve to canonicalize the paths in various flavors
    sort to sort paths, also only using the basename or dirname as a key

The definition of "extension" here was carefully considered and should line up with how extensions are actually used - ~/.bashrc doesn't have an extension, but ~/.conf.d does (".d").

These subcommands all compose well - they can read from arguments or stdin (like string), they can use null-delimited input or output (input is autodetected - if a NULL happens in the first PATH_MAX bytes it switches automatically).

It is both a failglob exception (so like set if a glob passed to it fails it just doesn't get any arguments for it instead of triggering an error), and passes output to command substitution buffers explicitly split (like string split0) so newlines are easy to handle.
2022-05-29 20:15:03 +02:00