Commit Graph

3460 Commits

Author SHA1 Message Date
Cherichy
f32777a0cc check for both wsl1 and wsl2 2020-05-25 13:05:13 +08:00
Cherichy
b34d9bcc97 fix is_wsl() on wsl2
on wsl2 the /proc/version contains no Microsoft as wsl1 do.
2020-05-25 13:05:13 +08:00
Jason Nader
65dde5b55a Fallback to the slower --list-devices if device not immediately available 2020-05-24 20:19:19 +02:00
Jason Nader
68a1f2b20a completions: speed up kdeconnect-cli device discovery 2020-05-24 20:19:19 +02:00
Jason
7b9119cc9a fish_vcs_prompt: allow argv passthrough
fish_git_prompt encloses its output in brackets, however this can be changed by supplying a format string to it, i.e. `fish_git_prompt %s`.
However when using `fish_vcs_prompt` there's no way to pass on the arg to fish_git_prompt, so you need to manually remove it.
fish_hg_prompt doesn't have the same format string support as fish_git_prompt, but I suppose it could be added later if needed.
2020-05-24 20:18:06 +02:00
Fabian Homborg
18a4ae3fd1 fish_greeting: Add second line unconditionally
For some reason we checked __fish_initialized *after confirming* that
$fish_greeting was empty?

See #7016.
2020-05-23 18:54:43 +02:00
Fabian Homborg
a40a35cc52 Put all the ls logic into the function
Doing it when sourcing isn't necessary or all that great.

Just make it an actual normal function file.
2020-05-23 14:30:00 +02:00
Fabian Homborg
928e80ad6a Extract setting $LS_COLORS to its own function
Makes it easier to override ls while keeping $LS_COLORS.
2020-05-23 14:30:00 +02:00
Johannes Altmanninger
a9b60d2493 Call fish_prompt after background job finishes
We don't need to call it if a job was stopped, because in that case
read_i() will fire fish_prompt already, because the newly stopped job
was probably a foreground job.

Fixes #1018
2020-05-22 21:24:59 +02:00
Johannes Altmanninger
6746060c14 Run fish_indent on all fish files in share/ 2020-05-19 21:15:39 +02:00
Johannes Altmanninger
c54ee22c46 Refactor: remove unnecessary exports 2020-05-19 21:15:11 +02:00
Johannes Altmanninger
3819696091 Fix Kakoune completions 2020-05-19 21:15:11 +02:00
Charles Gould
b673f32b93 Add fish debugging examples 2020-05-19 21:07:33 +02:00
Shun Sakai
cc039e29ce Add completions for Docutils 2020-05-19 21:02:55 +02:00
Soumya
518170b299 Also call fish_job_summary for foreground sigint
The default implementation will not print any output in that case, but this provides users with additional flexibility when it comes to customising the shell's behaviour.
2020-05-19 20:39:10 +02:00
Soumya
324fa64114 Add fish_job_summary, called whenever a job ends, stops, or is signalled
This allows users to customise the behaviour of the shell by redefining the function. This is similar to how fish_title or fish_greeting behave, where the default implementation can be easily overridden.

The function receives as arguments the job id, command line, signal name and signal description.
2020-05-19 20:39:10 +02:00
Fabian Homborg
43df5ba828 completions: Stop checking for command existence
Since 4414d5c888 (in fish 3.0.0) we
don't autoload completions if the command doesn't exist.

So there is no need to check inside the scripts anymore.

Whats more, a few (like pip and cabal) checked `command -q` instead of
`type -q`, meaning they'd fail if someone used a function instead of a
command of that name.

If the *command* actually needs to exist, checks like that are still
warranted, like in `npm` where aliasing it to `nvm` is popular.

A teensy additional bit: Make `sysctl -w` the same as `sysctl
--write`. That description was bogus.
2020-05-18 20:48:36 +02:00
Jason Nader
3cfcbe0975 completions: shotern atom descriptions 2020-05-18 18:54:21 +02:00
Enrico Borba
f10de5f653
__fish_prepend_sudo: Toggle "sudo" on multiple presses (#7012)
At the moment calling __fish_prepend_sudo multiple times does not toggle
sudo, and also unnecessarily uses the `-c` flag to `commandline` to see if
the first token on the commandline is "sudo".

This change removes the `-c` switch and also toggles "sudo" on multiple
calls to __fish_prepend_sudo, while maintaining the cursor position and
while maintaining any spaces between "sudo" and the next token on the
commandline.
2020-05-17 11:15:15 +02:00
Fabian Homborg
495cbb185f completions/zpool: Use --inherit-variable
The local-exported variable will have disappeared by the time the
function is called.

"-V"/"--inherit-variable" is meant for something like this.

Fixes #7011
2020-05-16 23:02:47 +02:00
Johannes Altmanninger
e03c375ee3 Purge remnants of process expansion, document {fish,last}_pid 2020-05-16 11:58:12 +02:00
Johannes Altmanninger
f9447dc72f help.fish: fix help for the separate completion page 2020-05-16 11:58:12 +02:00
Johannes Altmanninger
8e18f683a7 help.fish: fix not using anchors for some help topics
The completions for help know many more help topics, it makes no sense
to whitelist them here.

Fix anchor links for tutorial sections.

Remove some dead code: the "man" branch was unreachable because of the
earlier (__fish_print_commands) case.
2020-05-16 10:34:32 +02:00
Johannes Altmanninger
ec2371fb79 Some more precautionary uses of set --local 2020-05-15 21:35:48 +02:00
Fabian Homborg
62f1ed0b5e completions/git: More files for git commit
Fixes #7009.
2020-05-15 20:26:07 +02:00
Johannes Altmanninger
49c5f96470 Use set -l to force use of a local variable
Bare set overwrites a global/universal variable if it exists.
2020-05-15 08:25:07 +02:00
Johannes Altmanninger
fe6c76d058 Read into local variables in some completions
Otherwise these might modify global or universal vars.
2020-05-15 07:14:54 +02:00
Atanas Yankov
bb458c7186
Add some missing journalctl completions (#6989) 2020-05-15 06:58:11 +02:00
Uy Ha
76bbcb9804 Add check to let Windows Terminal pass 2020-05-14 18:02:50 -07:00
exploide
1ccec532f0 __fish_print_hostnames: skip ssh host definitions containing wildcards 2020-05-14 22:34:47 +02:00
LawAbidingCactus
f71737e58a Add $fish_force_vi_cursor variable to allow cursor setting on unsupported terminals 2020-05-14 22:25:20 +02:00
Johannes Altmanninger
a8e9f560e4 fish_clipboard_copy: also copy newlines from mult-line commands 2020-05-14 21:07:37 +02:00
Shun Sakai
3ee4c139b3 Add completions for Sphinx 2020-05-13 20:31:01 -07:00
Shun Sakai
230dbae0b9 Add completions for cmark 2020-05-13 20:31:01 -07:00
Shun Sakai
ed4dd1dd4d Add completions for Asciidoctor 2020-05-13 20:31:01 -07:00
Akatsuki
46c253b9d6 completions/set: add --path and --unpath
Add missing options:
--path causes the specified variable to be treated as a path variable, meaning it will automatically be split on colons, and joined using colons when quoted (echo "$PATH") or exported.
--unpath causes the specified variable to not be treated as a path variable. Variables with a name ending in "PATH" are automatically path variables, so this can be used to treat such a variable normally.

[ci skip]
2020-05-13 20:28:35 -07:00
Fabian Homborg
ea0a0991a1 anypython: Try supported numbered python3 versions
In case someone doesn't even have a `python3` symlink.
2020-05-10 22:49:25 +02:00
David Adam
30a8345a11 create_manpage_completions: use the first tool found
Noted in https://github.com/fish-shell/fish-shell/pull/6879#discussion_r421731269
2020-05-10 21:56:12 +08:00
Jason Nader
90c89c877f Use short flag for --description for consistency in code base 2020-05-08 22:58:52 +02:00
Jason Nader
bb65f81e64 edit_command_buffer: Add line:col support for micro 2020-05-08 20:00:07 +02:00
Eamon Caton
b665604475 Add newline to history clear message for consistency 2020-05-08 22:36:57 +08:00
Ron Gebauer
54f3fbbf8c
Fix issue if md5sum is used instead of md5 (#6958)
* Fix issue if md5sum is used instead of md5

Both have a different output which results in different array sized

Signed-off-by: Ron Gebauer <ron.gebauer@raytion.com>

* Add feedback

Signed-off-by: Ron Gebauer <ron.gebauer@raytion.com>
2020-05-07 21:02:22 +02:00
Bjorn Neergaard
02e9486559
Fix manpath handling in create_manpage_completions.py (#6879)
* Fix manpath handling in create_manpage_completions.py

...as well as do some (very!) light cleanup.

Currently, `create_manpage_completions.py` does not properly
understand/respect the `$MANPATH` variable. One important feature of
`$MANPATH` is that an empty component (i.e. the trailing : in
`foo:bar:`) expands to the 'default' or 'system' path -- that is to say,
the path that would be used if `$MANPATH` was unset. This allows the
user to extend the manpath without clobbering it, and has been a feature
many Unices have included for years.

The current implementation blindly uses the `$MANPATH` variable if it
exists, which does not allow for this behaviour -- to expand the
variable correctly, an external program must be invoked. Therefore, we
first shell out to the 'proper' (read: best guess) external program. If
that fails, we can then try to use `$MANPATH` directly/literally.
Finally, if both of those are impossible, we can fall back to some
common paths from widely used operating systems.

Note that the `man.conf` parsing has been removed: this is because while
many 'traditional' Unices (BSDs, Solaris, macOS) support this file, only
macOS actually ships a file -- most other Unices use a `conf.d`-style
layout and supporting that from our Python is impractical and silly at
best. On GNU (read: Linux) systems, `mandb` uses `/etc/man_db.conf` with
slightly different syntax and sematics. As this code-path has bitrotted
(and likely never worked, anyway), just remove it.

`create_manpage_completions.py` looks like it has suffered a lot of
confusion and bitrot in general over the last few years -- and is
overdue for a major refactoring. I am quite interested in tackling this,
but I plan to wait until the go-ahead to drop support for Python 2 is
given, as a major refactor/rewrite that still supports Python 2 (and
thus ignores the ergonomic/API/syntax improvements of Python 3) does not
make sense to me.

Related: #5657

It would probably be good to revisit `man.fish` once again when a
comprehensive refactor happens: hopefully every permutation of
`man`/`$MANPATH` could be documented as part of that effort.

* Restore /etc/man.conf parsing

I was not aware that this codepath was used -- since it appeared that it
would throw an error when it was reached. Redo it, using regex, and
support parsing NetBSD man.conf as well (untested).

* Fix create_manpage_completions.py under Python 2
2020-05-07 21:01:02 +02:00
Fabian Homborg
3c6c8d5424 fish_vi_cursor: Add alacritty to the whitelist 2020-05-07 18:04:39 +02:00
David Adam
ec74c739c8 bindings: expand abbreviations with all end-of-command characters
Closes #6970.
2020-05-07 09:13:33 +08:00
Charles Gould
bd472ececc Add fish_trace to special variable completions 2020-05-03 21:20:24 +08:00
Fabian Homborg
3e29b0d916 fish_vi_cursor: Allow new Konsole
It removed $KONSOLE_PROFILE_NAME and added $KONSOLE_VERSION.

Let's assume if $KONSOLE_PROFILE_NAME is set we use the old sequences,
if not we use the new ones.
2020-05-02 17:42:42 +02:00
David Adam
f36c82ce86 Reenable command descriptions on macOS 10.15.4+
Further work on #6270, as recommended in 611a6589ea.

[ci skip]
2020-05-01 21:28:43 +08:00
ridiculousfish
a1494c9c22 Revert "__fish_describe_command: print only exact match and exit"
This reverts commit 535845861a.

That commit introduced a bug where tab-completing commands no longer
prints their descriptions, unless there is an exact match.
2020-04-30 11:09:46 -07:00
hyperfekt
31cb615671 __fish_config_interactive: use __fish_anypython 2020-04-29 14:17:16 +08:00
George Christou
2bc4228d42 edit_command_buffer: Add line:col support for Sublime Text 2020-04-28 08:48:31 +02:00
LawAbidingCactus
ad677d388c fix pushd 2020-04-26 14:39:15 +02:00
Fabian Homborg
1988bd2579 completions/git: Only use first line of alias as the description
This was a weird one. We split the aliases correctly even with
multiple lines, but then broke it all again when we just printed the
description.

Note that it would be possible to use `string split0` here, but since
anything longer than a line is likely too long for a description
anyway we don't bother.

Fixes #6946.
2020-04-26 08:49:01 +02:00
Fabian Homborg
713ceddf0b Add another test for Konsole
For some reason my current version doesn't have $KONSOLE_PROFILE_NAME
anymore, it has $KONSOLE_VERSION.

Urgh
2020-04-25 18:01:43 +02:00
Fabian Homborg
fd90482c19 create_manpage_completions: Output "-d", not "--description"
We typically use "-d" because it's shorter.
2020-04-25 11:34:52 +02:00
Fabian Homborg
5ca527b2fe create_manpage_completions: Remove trailing period
Turns out this was on purpose, but we've been telling people to do
away with them for quite a while.
2020-04-25 11:34:40 +02:00
exploide
c0542727c4 added completions for metasploit commands
- msfconsole
- msfdb
- msfvenom
2020-04-25 09:30:09 +02:00
Jason
bd44c3a5cb Shorten descriptions 2020-04-25 09:29:42 +02:00
Fabian Homborg
47677dfe95
Merge #6788
Completions update
2020-04-25 09:29:01 +02:00
Ron Gebauer
d256ff84f7
Improve gradle completion (#6864)
* Improve gradle completion a lot

Signed-off-by: Ron Gebauer <ron.gebauer@raytion.com>
2020-04-25 09:22:07 +02:00
Kid
6022d216cb
Update Yarn completions (#6821)
* Update `yarn global` command

* Add descriptions
2020-04-25 09:21:05 +02:00
239
4d596a8f1d
Merge branch 'master' into completions-update 2020-04-23 14:01:42 +02:00
Fabian Homborg
c7c10c8b10 __fish_ps: Use builtin realpath
We might want to find a better home for that builtin.
2020-04-21 21:11:26 +02:00
Fabian Homborg
18b2a65fdc Remove unused --inherit-variable 2020-04-21 21:11:26 +02:00
Fabian Homborg
6ebbe5a450 fish_clipboard_copy: Stop adding newlines
When this switched over from directly piping commandline to storing
its output and using printf, I inadvertently always added a trailing
newline. That's probably annoying.

Note that this will now always *remove* a trailing newline (because
the command substitution does). That will barely make a
difference (because trailing newlines are quite unusual in the
commandline) and will probably feel better than keeping it - we could
even make a point of removing trailing whitespace in general.

Fixes #6927
2020-04-21 07:26:27 +02:00
Jason Nader
f66285d7a1 dogfood string split -f 2020-04-20 22:39:48 +02:00
Fabian Homborg
3f95440f26 completions: Use commandline -opc, not just -o
`commandline -o` tokenizes *the entire commandline buffer*.

See #6922.
2020-04-20 19:43:01 +02:00
Charles Gould
2421eb6180 docs: Add completions for fish_key_reader 2020-04-19 07:06:31 +02:00
Johannes Altmanninger
9c6e81a838 Support busybox ps in process completions
Fixes #6918
2020-04-19 05:51:25 +02:00
Alan Somers
3d0581d195 fish_hg_prompt should return 1 when not in a mercurial directory 2020-04-19 04:24:28 +02:00
Joel Kuhn
a3dfa21737 Change vi-mode tilde to toggle character case
This updates the behavior of tilde to match the behavior found in vim.
In vim, tilde toggles the case of the character under the cursor and
advances one character. In visual mode, the case of each selected
character is toggled, the cursor position moves to the beginning of
the selection, and the mode is changed to normal. In fish, tilde
capitalizes the current letter and advances one word. There is no
current tilde command for visual mode in fish.

This patch adds the readline commands `togglecase-letter` and
`togglecase-selection` to match the behavior of vim more closely. The
only difference is that in visual mode, the cursor is not modified.
Modifying the cursor in visual mode would require either moving it in
`togglecase-selection`, which seems outside its scope or adding
something like a `move-to-selection-start` readline command.
2020-04-18 14:59:37 +02:00
Jouke Witteveen
93b86bbe63 systemctl completions: Use --plain where appropriate
The --plain flag drops the '●'-glyph and generally makes the output more
suitable for automated processing.
2020-04-18 11:11:27 +02:00
exploide
8e418f5205 updated su completions 2020-04-18 10:54:06 +02:00
Jason Nader
85a8deabe9 Run fish_indent on all files 2020-04-18 10:53:11 +02:00
Fabian Homborg
157469038f completions/duply: Stringify
This used a hardcoded "/bin/ls" for unknown reasons.

For one that's unnecessary, for another we don't want to parse string.

Use globs instead.
2020-04-18 10:29:18 +02:00
Fabian Homborg
6004d04da6 completions/rmmod: Stop hardcoding lsmod location
No idea what that was supposed to accomplish to begin with.

Fixes #6912
2020-04-18 10:26:55 +02:00
Johannes Altmanninger
be36c96028 alias.fish: unbreak listing aliases without backslashes
The description for an alias which already has escape sequences will
use backslash escapes for quoting; usually `string escape` can simply
quote it.  Use a regex that accepts either escaping style.
2020-04-18 09:35:33 +02:00
Johannes Altmanninger
9eb2b69a51 alias.fish: list aliases that are escaped, not quoted
Fixes #6910
2020-04-17 23:16:43 +02:00
jeanprey
052d8d3a10 Activate untracked status in hg prompt
Correction of a typo that prevented the display of untracked status on the detailed prompt.
2020-04-16 19:18:22 +02:00
David Adam
021679b17c completions/nc.traditional: add missing fish suffix to file
Noted in
https://github.com/fish-shell/fish-shell/pull/6873#issuecomment-614290625
2020-04-16 23:17:02 +08:00
Benjamin Kellermann
de9f4cb252 add completion for netcat
- implement the most common netcat variants on Linux
  - nc.openbsd
  - nc.traditional
  - nc/netcat tries to guess which netcat is currently used
2020-04-13 23:45:40 +02:00
Benjamin Kellermann
0a40a6d551 add completion for nmap 2020-04-13 23:45:40 +02:00
Johannes Altmanninger
671b941b52 Fix ninja target completions without the -C flag 2020-04-13 22:56:22 +02:00
exploide
82b811281d added completions for groups (coreutils) 2020-04-13 22:56:22 +02:00
Jason Nader
d278ff4e45 Use the new string split --fields feature 2020-04-12 14:01:21 -07:00
exploide
ee180988d1 sftp completions 2020-04-11 13:24:35 +02:00
Shun Sakai
4f60693037 Add completions for Zopfli 2020-04-11 13:13:56 +02:00
Charles Gould
8029f15f1f git prompt: better check for git stashes
When you run "git gc":

 - .git/refs/stash is deleted
 - .git/logs/refs/stash is kept intact
2020-04-10 00:22:16 +02:00
xnumad
af5a9cf88e It's wget --bind-address
Fixes typo
2020-04-09 23:49:27 +08:00
Artur Juraszek
33bc2bc312 Allow unzip versions not patched by Debian to enjoy .{jar,aar} completions
A minor follow-up to #6866 (e658a88ab0).
These file types should be properly handled by other unzip flavors too,
regardless of Debian's/non-Linux Unixes' idiosyncrasies.
2020-04-07 22:47:38 +02:00
exploide
8025e80fdb new function __fish_preview_current_file to open file at the cursor in pager
bound to Alt+O by shared key bindings
created with help from @krobelus
fixes #6838
2020-04-07 22:30:05 +02:00
Thom Chiovoloni
39e0fd14eb Allow man completions on catalina if apropos is overridden
It's pretty easy to fix catalina's apropos with a small tweak, so it
would be nice if man completions worked if this is done.
2020-04-06 19:13:12 +02:00
Thom Chiovoloni
e658a88ab0 Support .jar and .aar files in unzip completions
I've been dealing with these a lot recently (android dev...), and it's
pretty annoying that unzip completions don't recognize them (They're
just zip files with a weird file extension).
2020-04-06 19:12:03 +02:00
Fabian Homborg
ff68bdceba Allow file completions for more builtins
- contains
- count (for `count *`)
- echo
- printf
- random (for `random choice`)

Fixes #6520
2020-04-06 18:59:10 +02:00
Fabian Homborg
6a721fab63 Let . and : be completed with files
For `.` it's *correct* and for `:` it literally accepts everything
2020-04-06 18:56:10 +02:00
Fabian Homborg
5dfaff4281 Make "." a builtin as well
Yeah, it's not going anywhere. This is one line in builtin.cpp vs 9
lines of script, most of which used to print an error that is never triggered.
2020-04-06 18:55:59 +02:00
Fabian Homborg
be0de5e2de Just define a ":" builtin
It's *less code* to define this as a builtin, and it's not going
anywhere. Plus it makes fish just a little more usable without share/config.fish.
2020-04-06 18:55:59 +02:00
Ron Gebauer
77fb54fa99 In Fish MD5 on BSD now use given String and not -s
Signed-off-by: Ron Gebauer <ron.gebauer@raytion.com>
2020-04-05 17:25:02 -07:00
Fabian Homborg
b42445e675 Restyle create_manpage_completions 2020-04-05 10:13:02 +02:00
Johannes Altmanninger
89c4ff9eae Fix some inconsistencies in docs 2020-04-04 19:19:50 +02:00