Commit Graph

1842 Commits

Author SHA1 Message Date
Fabian Homborg
0064279905 Don't show greetings in read in scripts
This reverts commit 1b0ec21773.

"Interactive" has multiple meanings here, one of them being "the whole shell" is interactive, which `status is-interactive` tests, and one "this interaction is interactive", which happens when `read`ing in a script.

Fixes #7080.
2020-06-04 17:00:09 +02:00
Fabian Homborg
1f434cfde8 fish_config: Don't mention python 2
See #6537.

[ci skip]
2020-05-30 12:10:24 +02:00
Jason Nader
b4ca4245c6 gpg completions: add export SSH command 2020-05-30 10:10:07 +02:00
Fabian Homborg
4785440f65
Add an "_" builtin to call into gettext (#7036)
* Add an "_" builtin to call into gettext

We already have gettext in C++ (if available), so it seems weird to
fork off a command to start it from script.

This is only for fish's own translations. There's no way to call into
other catalogs, it just translates all arguments separately.

This is faster by a factor of ~1000, which allows us to call
translations much more, especially from scripts.

E.g. making fish_greeting global by default would hurt cost-wise,
given that my fish starts up in 8ms and just calling the current `_`
function takes 2ms, and that would have two calls.

Incidentally, this also makes us rely on a weirdly defined function
less, so it:
Fixes #6804.

* docs: Add `_` docs

Let's see if that filename works out.

* Reword _ docs
2020-05-29 20:53:44 +02:00
Fabian Homborg
9354dd6971 Add fish_add_path, a simple way to add to $PATH
This is a function you can either execute once, interactively, or
stick in config.fish, and it will do the right thing.

Some options are included to choose some slightly different behavior,
like setting $PATH directly instead of $fish_user_paths, or moving
already existing components to the front/back instead of ignoring
them, or appending new components instead of prepending them.

The defaults were chosen because they are the most safe, and
especially because they allow it to be idempotent - running it again
and again and again won't change anything, it won't even run the
actual `set` because it skips that if all components are already in.

Fixes #6960.
2020-05-29 20:51:05 +02:00
Fabian Homborg
ba116f1d3b fish_git_prompt: Count untracked files from the repository root
We already do this for the non-informative (non-counting) version.

Fixes #6086.
2020-05-28 20:49:48 +02:00
Jason
4e5220a4e1 gpg completions: add new option 2020-05-28 17:43:49 +02:00
Jason
bb7eb33b22 Fix typo 2020-05-28 17:41:01 +02:00
Jason
dc4ca005f8 gpg completions: complete key id for --edit-key
More useful than just user id since can have multiple keys per user.
2020-05-28 17:40:24 +02:00
Donovan
bc2eb383d4
Funcsave with --directory option (#7041)
* funcsave: add option --directory

Signed-off-by: Donovan Jean <commit@dkrm.dev>

* funcsave: fix synopsis

Signed-off-by: Donovan Jean <commit@dkrm.dev>

* funcsave: fix completion

Signed-off-by: Donovan Jean <commit@dkrm.dev>

* funcsave: fix error message

Signed-off-by: Donovan Jean <commit@dkrm.dev>

* funcsave: fix parameter expansion

Signed-off-by: Donovan Jean <commit@dkrm.dev>
2020-05-27 20:13:44 +02:00
Mahmoud Al-Qudsi
2d52335fed Don't fire fish_prompt when read is used
Apart from being semantically incorrect, this was causing `fish_prompt`
to fire twice after commands that used `read` (e.g. `cdh`).

Closes #7039.
2020-05-26 15:24:31 -05:00
Johannes Altmanninger
e885a65754 fish_greeting: highlight "help" in in green, like it used to be
This was changed in b9d2e4d with no obvious motivation, and the
translation strings still have the old version.
2020-05-25 23:50:30 +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
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
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
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
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
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
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
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
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
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
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
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
Jason Nader
85a8deabe9 Run fish_indent on all files 2020-04-18 10:53:11 +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
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
Jason Nader
d278ff4e45 Use the new string split --fields feature 2020-04-12 14:01:21 -07: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
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
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
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
Jason Nader
eaf313f755 Dogfooding to show off use case 2020-04-04 15:30:09 +02:00
Fabian Homborg
1b0ec21773 __fish_config_interactive: Remove a "is-interactive" check
This looks like a copy-paste error. If we're in
__fish_config_interactive, we're *interactive*.
2020-03-28 09:50:37 +01:00
Johannes Altmanninger
aa304cbd3d Restore directory completions for subcommands
Fixes #6798

This re-adds some false positives: functions, builtins and abbreviations
are suggested after commands like sudo but I don't think anyone had
complained about that.
2020-03-24 20:18:07 +01:00
Johannes Altmanninger
d0bedf3bbd help.fish: only use cmd.exe on WSL
Fixes #6797
2020-03-23 21:02:15 +01:00
Jason Nader
979d3a18aa help function: special case string xxx 2020-03-22 09:33:07 +01:00
Fabian Homborg
8ddd512fba Refine when we expand abbreviations
- ctrl-space will insert a space without expanding abbrs
- ")" or alt-enter will expand abbrs

Fixes #6658
2020-03-21 13:55:15 +01:00
Jon Cinque
23a21eb318 Add vi 'y' bindings and some i / a support
Many people have mentioned wanting support for changing / yanking /
deleting between "" and '', meaning the commands `ci' ci" yi' yi" di' di"`,
so this adds that support in a generic, and thus potentially confusing way.
The concept is that we check for the character backwards and forwards
before making the selection.  Unfortunately, this will also work for *any*
character that isn't `w` or `W`, so `cia` could change everything between
two `a` characters.
Looking through the [bind documentation](https://fishshell.com/docs/current/cmds/bind.html)
and input handler at `src/input.cpp`,
this is the best possible solution I could come up with until
`forward-jump` and `backward-jump` can accept input in the call to `bind`,
and not just from stdin, meaning we can write a binding as:
```
bind di\" backward-jump-till \" and repeat-jump-reverse ...`
```
If that were done, then other commands such as `di)` to go between `()` would
be possible.
There are also some added `y` bindings not part of #6648.
Let me know if you need anything else.
2020-03-21 13:52:12 +01:00
Mahmoud Al-Qudsi
1d7643751b Revert "Make funcsave update the function <-> file mapping"
This reverts commit 7f402cdae7.

There are fundamental issues with `funced` and `funcsave` that prevent
this from working. A file and a function are not interchangeable.
2020-03-20 10:18:52 -05:00
Mahmoud Al-Qudsi
7f402cdae7 Make funcsave update the function <-> file mapping
This makes `funced` after `funcsave` behave as expected rather than a
potential source of data loss.

Closes #6113.
2020-03-20 10:03:05 -05:00
Fabian Homborg
1e2e511570 fish_default_key_bindings: Remove outdated stderr silencing
We *always* silence `bind` here, so we don't need to specifically
silence for these keys.
2020-03-15 21:01:11 +01:00
Fabian Homborg
aa629c5aca Reformat fish scripts with escaped newline changes to fish_indent 2020-03-15 21:01:11 +01:00
Fabian Homborg
463b9b99c6 Move ctrl-left/right forward-word to shared bindings
These also work in vim.

Fixes #6755.
2020-03-15 13:24:45 +01:00
Jason Nader
266ce7c940 Improve Arch Linux package completions
Add completions for `downgrade` tool
Add new `--installed` option for printing Arch packages
Change Arch Linux package related completions to use `--installed`

add newline
2020-03-15 13:19:25 +01:00
Johannes Altmanninger
651f3cf863 Fix VSCode not blocking in edit_command_buffer 2020-03-14 14:15:10 +01:00
Fabian Homborg
db7dfddc3b completions/systemctl: Remove annoying marker
The output of

systemctl list-units

seems to include a marker of '●' or '*' for some units, even if the
output is not going to a terminal and "--no-legend" and "--no-pager"
are given. This appears
to be a recent development, and there does not appear to be a flag to
disable it.

So we simply filter it out in the completions to once again hopefully
offer the actual units.

Fixes #6740
2020-03-12 18:37:32 +01:00
Fabian Homborg
5ab1e2dc0f help: Always use xdg-open if available
Even if $DISPLAY is unset, xdg-open can be useful, and on systems that
have xdg-open, "open" is most likely some god awful outdated thing
called "openvt" elsewhere.

Fixes #6739

[ci skip]
2020-03-12 17:27:37 +01:00
Johannes Altmanninger
c5e4419097 Add "--" safeguards at string length [ci skip] 2020-03-10 21:01:00 +01:00
Johannes Altmanninger
208b0f9dd5 Interactive config: remove useless argument and correct redirection 2020-03-10 20:56:45 +01:00
Johannes Altmanninger
685b668958 Complete IDs for unix users and groups that start with _ 2020-03-10 20:56:45 +01:00
Fabian Homborg
9367d4ff71 Reindent functions to remove useless quotes
This does not include checks/function.fish because that currently
includes a "; end" in a message that indent would remove, breaking the test.
2020-03-09 19:46:43 +01:00
exploide
f39cba1d9f added functions to complete user and group IDs 2020-03-08 17:24:14 +01:00
ridiculousfish
29c2bce704 Use self-insert-notfirst on spaces during paste
This changes a5a643f854 to use the new self-insert-notfirst binding.
It also adds a test.
2020-03-07 13:31:55 -08:00
Jason Nader
926c1f1016 Privatise completion-only funtions 2020-03-07 13:26:27 -08:00
Johannes Altmanninger
87728c4d0d Pass cursor position to edit_command_buffer for some editors
Fixes #6138

Naturally this does not work for many other editors/aliases,
but it's still nice that we can make it work for some common
editors without requiring any configuration.

Of course this approach is not terribly flexible; but it's
alwyas possible to just wrap edit_command_buffer and set an
EDITOR that knows about the cursor position. It doesn't
feel important enough to add a configuration option.
2020-03-07 21:24:14 +01:00
Johannes Altmanninger
917f759a1a prompt: don't consider SIGPIPE a failure
Reproduce by running git log and press "q".
This regressed in master in 5d135d5.

[ci skip]
2020-03-07 14:13:58 +01:00
Johannes Altmanninger
da7b762f4a Make default hg prompt leaner
The default hg prompt is slow on large repositories (hg status takes
2-3 seconds on mozilla-central) which is unacceptable as a default.

Mimick our git prompt: by default, only show the current branch.
If the new variable $fish_prompt_hg_show_informative_status is set,
then use the old behavior.

[ci skip]
2020-03-07 13:02:58 +01:00
Jason Nader
b4626468ec completion helper functions: do not use gettext
remove package
2020-03-06 22:23:50 +01:00
Jason Nader
97d5f68cdf completions: update ftp 2020-03-04 10:26:54 -08:00
Fabian Homborg
4f47636838 fish_print_hostnames: Fix multiple host aliases
Fixes #6698.

[ci skip]
2020-03-03 18:30:06 +01:00
Jason Nader
86b7c1034c Prevent prompt from spewing errors if cwd has disappeared 2020-03-03 18:06:20 +01:00
Jason Nader
9c8fff08c1 fish_npm_helper: fix typo in comments 2020-03-02 21:36:11 +08:00
Fabian Homborg
0f34459fce Disable svn prompt by default
This is apparently quite slow on large svn repos (like 40 seconds
slow), and we don't have a good thing to display other than the full
file information.

So we'll have to disable it for now.

Fixes #6681.

[ci skip]
2020-03-01 17:04:02 +01:00
Jason Nader
45b1ca25a5 Speed up python startup time 2020-02-28 11:23:58 +01:00
Jan Verbeek
d02736c0ce
Improve psql completions and add some related commands (#6620) 2020-02-28 11:16:41 +01:00
Simon Rainer
e1a08e3f58 Add additional vi bindings
Adds dh, dl, c0, cf, ct, cF, cT, ch, cl, and y0 bindings.
2020-02-24 00:05:14 -08:00
Mahmoud Al-Qudsi
535845861a __fish_describe_command: print only exact match and exit
Mimic the behavior of Linux's `apropos -e` and ~BSD's `apropos -f` with
the awk script by disallowing trailing characters in the name of the
manpage as compared to the original input string. Apart from being
faster (by aborting earlier and stopping `apropos` by breaking the pipe
after the first match), it's also more correct.
2020-02-17 20:22:39 -06:00
Mahmoud Al-Qudsi
3c7019b335 __fish_describe_command: check for apropos only at startup 2020-02-17 20:13:39 -06:00
Mahmoud Al-Qudsi
5510443f48 __fish_describe_command: Remove regex escape hack 2020-02-17 20:13:30 -06:00
Fabian Homborg
65883e0e40 Restyle
Mostly line breaks, one instance of tabs!

For some reason clang-format insists on two spaces before a same-line comment?

(I continue to be unimpressed with super-strict line length limits,
but I continue to believe in automatic styling, so it is what it is)

[ci skip]
2020-02-17 14:14:05 +01:00
Jason Nader
a619f69b15 Rename functions to match others 2020-02-17 09:55:05 +01:00
Johannes Altmanninger
8a033b9f3d Add undo
Add the input function undo which is bound to `\c_` (control + / on
some terminals). Redoing the most recent chain of undos is supported,
redo is bound to `\e/` for now.

Closes #1367.
This approach should not have the issues discussed in #5897.

Every single modification to the commandline can be undone individually,
except for adjacent single-character inserts, which are coalesced,
so they can be reverted with a single undo. Coalescing is not done for
space characters, so each word can be undone separately.

When moving between history search entries, only the current history
search entry is reachable via the undo history. This allows to go back
to the original search string with a single undo, or by pressing the
escape key.
Similarly, when moving between pager entries, only the most recent
selection in the pager can be undone.
2020-02-07 17:15:17 +01:00
Geoff Nixon
f7edfba5d7 Avoid apropos on macOS 10.15 with man completion
Same issue occurs here, as in #6270 (and fixed in 611a658 for `__fish_describe_command.fish`). Same reason. I've just copied the same workaround and changed the function name to match.
2020-02-07 20:52:39 +08:00
Johannes Altmanninger
5d135d5556 prompts: fix pipestatus for jobs prefixed with "not"
6902459566 was an attempt to not print
$status twice in the prompt. As a result we print $pipestatus but
not $status, which /usually/ is the same as $pipestatus[-1] --- unless
the builtin "not" is used, which inverts the $status of a job (it does
not alter $pipestatus).

As a result, the default prompt prints unexpected status codes:

	~ > not false
	~ [1]> not true
	~ > not true | true
	~ > not false | false
	~ [1|1]>

This commit reintroduces printing of $status after $pipestatus, but only
if it is different from $pipestatus[-1].
Additionally, we only print anything at all if the $status is nonzero,
to avoid confusing output on `not false | false`

	~ > not false
	~ > not true
	~ [0] 1> not true | true
	~ [0|0] 1> not false | false
	~ >

I think this is closer to users' expectations for those cases; they should
not have to think about this implementation detail of the not-statement.
2020-02-06 01:43:17 +01:00
Johannes Altmanninger
50e08dc3a0 add completions for wireshark/tshark/dumpcap 2020-01-30 16:45:02 +01:00
Johannes Sasongko
8e8a3846fb __fish_prepend_sudo: Don't move the relative position of the cursor
At the moment the "prepend sudo" functionality always sets the cursor to
the end of the line. This changes it to restore the relative position of
the cursor.
2020-01-29 09:21:23 +01:00
Jason
bcf2e2cdbd Remove unused variable 2020-01-26 12:28:01 +01:00
Jason Nader
5bfb6fef76 Stringify __fish_pwd.fish 2020-01-24 19:05:08 +01:00
Fabian Homborg
d61c188c3c Fix xdg mimetype completion
This hung when no file existed, and failed to properly find the
directories if they didn't end in a "/".

Fixes #6525

[good for 3.1.0]
2020-01-22 16:33:56 +01:00
Jason Nader
6fb545cf9b Stringify gpg completions 2020-01-21 17:57:57 +01:00
Jason Nader
103a26ffb1 Fix function output on FreeBSD/Cygwin systems 2020-01-21 16:55:37 +01:00
Fabian Homborg
1480865d52 Stringify make_completion_signals 2020-01-20 17:51:59 +01:00
Fabian Homborg
acefa61e8b Hardcode signal names/numbers on cygwin
Work around weirdness in Cygwin's kill implementation.

Fixes #6469.
2020-01-20 17:51:59 +01:00
Fabian Homborg
69b464bc37 Run fish_indent on all our fish scripts
It's now good enough to do so.

We don't allow grid-alignment:

```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z              -a '(something)'
```

becomes

```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z -a '(something)'
```

It's just more trouble than it is worth.

The one part I'd change:

We align and/or'd parts of an if-condition with the in-block code:

```fish
if true
   and false
    dosomething
end
```

becomes

```fish
if true
    and false
    dosomething
end
```

but it's not used terribly much and if we ever fix it we can just
reindent.
2020-01-13 20:34:22 +01:00
Fabian Homborg
611a6589ea Disable command descriptions on macOS 10.15.X
We just do a cheesy version check and hope it works out.

If this is fixed in 10.15.4, we have to reenable it. If it still isn't
fixed in 10.16, we need to adjust it.

Fixes #6270
2020-01-05 18:35:59 +01:00
Fabian Homborg
4a47e212f8 Color the default prompt host if running via SSH
This is part of our (well, my) quest to spice up the default prompt.

In this case we color the host if $SSH_TTY is set, which is easy to
detect and helps draw attention to the host.

See #6398.
See #6375.
2019-12-30 14:03:36 +01:00
Johannes Altmanninger
0afc5258cf Unify detection of fish version upgrade with $__fish_initialized
This variable holds an integer that resembles the fish version up to
that initializations were performed. It should be incremented whenever
some new initialization is required after upgrading fish.  This should
not change the behavior for existing fish installations, except for a
minor message on installations that upgrade from fish<2.3.0.

[ci skip]
2019-12-30 14:00:22 +01:00
Fabian Homborg
b0e3cc4b5c __fish_complete_suffix: Remove eval
This use of eval is unsafe, not really all that useful and can spew
errors that can't be suppressed. So let's remove it, and in future add
a thing that can do expansions in a safe manner

Fixes #6456.
2019-12-28 17:10:23 +01:00
Johannes Altmanninger
feb87bbda8 __fish_man_page: ignore prefixing variable assignments 2019-12-19 23:44:58 +01:00
Fabian Homborg
22b2dbd97d functions/history: X is incompatible with SDMV, not C
"-C" is short for "--case-sensitive", which is entirely okay with "--delete".

The one that isn't okay is "-X", which is short for "--Clear".

Seen on gitter.im
2019-12-19 20:59:17 +01:00
Mahmoud Al-Qudsi
364929e46e Disown first-run python completions generation
Closes #6269.
2019-12-18 14:12:49 -06:00
Jason
48bf3a4907 Delete __fish_sgrep.fish 2019-12-18 13:17:54 -06:00
Mahmoud Al-Qudsi
6dc8a1d3a7 Partially address #6340 (escape files starting with -)
This prefixes files beginning with `-` with a `./` when generating
completions *in fish code*. Standard completions for directory listings
generated by the C++ directory traversal code are not afected by this
patch.

Most fish completions defer to `__fish_complete_suffix` to generate the
file/directory completions, these *will* be corrected.
2019-12-18 13:13:23 -06:00
Dan Martinez
4e52feb51a Have type deal with both flavors of fileless function (#6421)
* Deal with *both* types of dynamic function

* Use a guard (`--`) when `-` is an argument
2019-12-12 20:42:11 +01:00
Dan Martinez
9a3886dc2b Make type -p and type -P behave as documented (#6412)
* Make `type -p` and `type -P` behave as documented

* Recognize `-` as an additional sign of no path

Functions created via `source` (like by `alias`) cause `functions --details` to return `-`
rather than `stdin` when invoked upon them.
2019-12-12 17:09:52 +01:00
Dan Martinez
16dc606001 Add the --short flag to type (#6403)
* Add the `--succinct` flag to `type`

* Use `echo` rather than `printf`

* Change `succinct` to `short`; print path if known

* Clean up the printing logic ever so slightly
2019-12-11 22:24:29 +01:00
Johannes Altmanninger
cc7ae03070 prompt: don't consider SIGPIPE a failure
[ci skip]
2019-12-11 11:32:58 +01:00
Johannes Altmanninger
94b5720343 prompt: remove fallback for $fish_color_host
This was mostly dead, since $fish_color_host is set to normal in
__fish_config_interactive. The assignment was only used if the user
explicitly unsets fish_color_host (which they shouldn't, really).
Anyway it's weird to use cyan, use normal instead.
[ci skip]
2019-12-11 11:32:58 +01:00
Johannes Altmanninger
2f1a5e65d8 prompt: don't set default colors twice
The colors are set in __fish_config_interactive before the prompt is
painted for the first time.

Also initialize the $fish_color_status for the (pipe) status, bump the
version for that.
[ci skip]
2019-12-11 11:32:58 +01:00
Johannes Altmanninger
6902459566 prompt: don't print status of last process in pipe twice
If a command fails, print the pipestatus in red instead of yellow and
don't print the status of the last process again. See #6375.

Also use $fish_color_status for coloring status consistently.

Also use __fish_pipestatus_with_signal to print SIGPIPE instead
of a numeric code on e.g.: yes | less +q

[ci skip]
2019-12-11 01:19:12 +01:00
Johannes Altmanninger
6b2addd9f3 prompt: don't print pipestatus if only the last process failed
Example: ps | grep something

[ci skip]
2019-12-10 22:35:24 +01:00
Akatsuki
efb72f1f91 Revert "Move __fish_systemd_machines into machinectl completion script"
This reverts commit 9c15b5b7a4.
2019-12-09 21:07:21 +01:00
Fabian Homborg
b2332e9f3e Switch default prompt to Classic+VCS
This has more info, in particular vcs and status.

The old default is still available as the "classic" prompt.

Fixes #6375.
2019-12-07 19:25:41 +01:00
Peter Collingbourne
6dc4ac60ae Use $PWD to retrieve the current directory in __fish_move_last.
(command pwd) uses the system's implementation of pwd. At least the GNU
coreutils implementation defaults to -P, which resulted in symlinks being
expanded when switching between directories with nextd/prevd.
2019-12-07 12:20:31 +01:00
Jason
7999cd4f25 Remove fish_fallback_prompt function 2019-12-07 12:16:48 +01:00
Fabian Homborg
9d14594f7c
Merge pull request #6390 from ammgws/debian
Move __fish_print_debian_services into invoke-rc.d completion script
2019-12-07 12:16:29 +01:00
Jason
c4400c31f7 Remove deprecated function 2019-12-07 12:16:15 +01:00
Jason
3129b3c5ef
Move __fish_print_debian_services into invoke-rc.d completion script 2019-12-05 05:26:26 +09:00
Fabian Homborg
9efb7fd5f6 __fish_cancel_commandline: Always repaint
Fixes #6394.
2019-12-04 21:21:34 +01:00
Jason
a361cde1df Move __fish_complete_svn_diff into the completion script 2019-12-04 20:53:58 +01:00
Jason
965b142acd Move __fish_print_zfs_* into zfs completion script 2019-12-04 20:53:01 +01:00
Jason
69dccce937 Move __fish_print_function_prototypes into valgrind completion script 2019-12-04 20:51:55 +01:00
Jason
013001c283 Move __fish_print_lsblk_columns into lsblk completion script 2019-12-04 20:51:37 +01:00
Jason
5107de395d Move __fish_print_xdg_desktop_file_ids into xdg-mime completion script 2019-12-04 20:51:21 +01:00
Jason
9c15b5b7a4 Move __fish_systemd_machines into machinectl completion script 2019-12-04 20:51:09 +01:00
Jason
b658b421ad Move __fish_ports_dirs into ports completion script 2019-12-04 20:50:55 +01:00
Jason
40832f897c Move __fish_portage_print_repository_names into emaint completion script 2019-12-04 20:50:28 +01:00
Jason
69255d5641 Move __fish_parse_configure into configure completion script 2019-12-04 20:50:19 +01:00
Jason
b3f8a93e02 Move __fish_print_abook_emails into mutt completion script 2019-12-04 20:50:01 +01:00
Jason
dacc0b595c Dont clobber fish_browser if cygstart is available 2019-12-03 18:07:18 +01:00
Johannes Altmanninger
c3374ffd08 Use read --tokenize instead of eval for $BROWSER & $EDITOR 2019-12-03 12:19:16 +01:00
edef
031d30c8ac Handle multiple arguments in $PAGER
$PAGER may contain arguments, and should thus be word-split before 
invocation.
2019-12-02 15:15:33 +01:00
Fabian Homborg
d91b0f86f4 Repaint all prompts if the variables change
This is a good idea in general and simplifies the Classic + VCS
prompt.
2019-12-01 18:15:36 +01:00
Fabian Homborg
115892ccd2 alias: Use read --tokenize
This did some weird unescaping to try to extract the first word.

So we're now more likely to be *correct*, and the alias benchmark is
about 20% *faster*.

Call it a win-win.
2019-12-01 18:14:26 +01:00
Jason
2fd1e4ab75 Move __fish_complete_unrar into the completion script 2019-12-01 17:35:35 +01:00
Jason
fa373c102c Move __fish_complete_wvdial_peers into the completion script 2019-12-01 17:34:46 +01:00
Jason
6486349725 Move __fish_complete_tar into the completion script 2019-12-01 17:34:27 +01:00
Jason
6245d76e57 Move __fish_complete_lsusb into the completion script 2019-12-01 17:33:07 +01:00
Jason
b3291619f4 Add missing logic to trampoline block 2019-12-01 17:31:41 +01:00
Jason
b358cee5fe Move __fish_complete_setxkbmap into the completion script 2019-11-30 12:12:18 +01:00
Jason
d1a153cc7e Dont convert path if browser is going to be run in terminal 2019-11-30 09:33:38 +01:00
Jason
585e4e905b Dont convert path if browser is going to be run in terminal 2019-11-30 09:33:38 +01:00
Jason
8192fb2f2a Fix Windows path support for WSL/Cygwin
- Use wslpath under WSL to provide full path to help file
- Use eval on the final command to cmd.exe
- Use trampoline where necessary for Cygwin
2019-11-30 09:33:38 +01:00
mk2
c36d802dda Move __fish_complete_file_url to evince.fish 2019-11-30 00:21:47 -08:00
mk2
439470b048 Move __fish_complete_ant_targets to ant.fish 2019-11-27 16:32:37 +01:00
0x005c
48dc9b1e82 Add replace mode in vi-mode 2019-11-25 16:05:10 -08:00
Akatsuki
cb72a33e0c Fix some issues in __fish_complete_subcommand.fish
Fix 'string length: Unknown option': add `--` before $subcommand

Fix count $subcommand always = 1 with `sudo` and `doas`:
give argv as array to __fish_complete_subcommand

[ci skip]
2019-11-17 00:39:06 +01:00
Fabian Homborg
330f1701d7 Restyle
This mostly fixes some wrong indents or replaces some stray tab indents.

I excluded alignment on purpose, because we have a whole bunch of code
that goes like

```fish
complete -c foo -n 'some-condition'        -l someoption
complete -c foo -n 'some-longer-condition' -l someotheroption
```

and changing it seems like a larger thing and would include more
thrashing.

See #3622.
2019-11-16 14:57:59 +01:00
Fabian Homborg
c14a7cbc8f seq.fish: Allow "--" separator
This ended up breaking the random test on OpenBSD (apparently the only
place where this is actually used).
2019-11-16 11:21:45 +01:00
Fabian Homborg
7527fc265b psub: Use explicit command
This would have prevented #6323.

While we don't want to pepper `command` everywhere, `psub` is kind of
a core thing, so we should try to proof it against common problems.
2019-11-14 17:13:39 +01:00
Johannes Altmanninger
270fd14b00 Fix typo
[ci skip]
2019-11-08 11:40:03 +01:00
Johannes Altmanninger
0e4a75c0b5 Do not print greeting with empty $fish_greeting and --private
Fixes #6299

[ci skip]
2019-11-08 11:09:33 +01:00
Johannes Altmanninger
5c3e43bc0c vi mode: make return key in replace mode insert a newline
Fixes #6298

[ci skip]
2019-11-08 10:51:58 +01:00
Johannes Altmanninger
d242ff1808 Add description for automatic fish_update_completions job
See #6269
2019-11-07 23:33:35 +01:00
Johannes Altmanninger
35115d3d54 __fish_print_help: do not read $LESS 2019-11-07 17:45:54 +01:00
Jakub Darul
3b4234a9de added d0 to vi keybindings 2019-11-06 18:18:43 +01:00
Johannes Altmanninger
4f1fa9513c Make most subcommand completions take external commands only
Also fix ssh completions which were broken by
277fca9c6a.
2019-11-05 11:47:05 +01:00
Johannes Altmanninger
36693e4391 Complete empty subcomands consistently
If the command is empty, try to complete starting from the empty command
instead of the whole commandline.
2019-11-05 09:05:46 +01:00
Fabian Homborg
e893c8ca97 Revert "Set fish_clipboard_paste handler once on startup"
This reverts commit f620ddf03b.

Setting the paste handler isn't performance-sensitive.

On the other hand setting it this way makes things less transparent,
less flexible (if e.g. a paste handler is installed while the shell is running),
and causes #6286.

Fixes #6286.

[ci skip]
2019-11-04 20:47:58 +01:00
Johannes Altmanninger
6fb7f9b6b8 Fix completion for builtins (with subcommands)
Presently the completion engine ignores builtins that are part of the
fish syntax. This can be a problem when completing a string that was
based on the output of `commandline -p`.  This changes completions to
treat these builtins like any other command.

This also disables generic (filename) completion inside comments and
after strings that do not tokenize.

Additionally, comments are stripped off the output of `commandline -p`.

Fixes #5415
Fixes #2705
2019-11-04 16:44:51 +01:00
LawAbidingCactus
19b59fc54e minor fixes to version-specific completions 2019-11-03 21:37:57 +08:00
Z. Grace Moreau
dd1f8489a7 add -o/--old to __fish_seen_argument 2019-11-02 14:48:57 -07:00
Johannes Altmanninger
e0d4a1d78b Fix sudo/doas completions not using /sbin
Fixes #6259
[ci skip]
2019-11-01 21:24:03 +08:00
David Adam
713c8f2d32 gpg completions: add further options
Restores work from #6251 wiped out by merge.
2019-11-01 21:16:24 +08:00
Fabian Homborg
9380b7ff39 history: Use --contains by default for "delete"
This just makes more sense, as people don't want to enter exact
matches if they delete interactively.

It also brings it in line with "search".

Fixes #6142
Rejects #6070
2019-11-01 08:53:24 +01:00
Fabian Homborg
8acff328e0 svn_prompt: Check for svnversion
MacOS Catalina apparently ships a stripped down svn that doesn't have
`svnversion`, which we use to print the revision.

For now skip the entire step to remove error spam.

Fixes #6267.

[ci skip]
2019-10-30 21:45:50 +01:00
Johannes Altmanninger
deefdaec57 Use the new &| in __fish_paginate 2019-10-29 20:48:10 +01:00
Johannes Altmanninger
4095247deb completions/git: some improvements 2019-10-29 19:13:31 +01:00
LawAbidingCactus
21a6a192ae refactor gpg.fish completions
refactor gpg completions into functions
comment changes; improve gpg version detection

[ci skip]
2019-10-29 19:07:35 +01:00
Johannes Altmanninger
97d031e20c reformat 2019-10-28 18:36:07 +01:00
Johannes Altmanninger
61486954bc Use a pager to view long outputs of builtin --help
Every builtin or function shipped with fish supports flag -h or --help to
print a slightly condensed version of its manpage.
Some of those help messages are longer than a typical screen;
this commit pipes the help to a pager to make it easier to read.

As in other places in fish we assume that either $PAGER or "less" is a
valid pager and use that.

In three places (error messages for bg, break and continue) the help is
printed to stderr instead of stdout.  To make sure the error message is
visible in the pager, we pass it to builtin_print_help, every call of which
needs to be updated.

Fixes #6227
2019-10-28 18:36:07 +01:00
Mahmoud Al-Qudsi
f620ddf03b Set fish_clipboard_paste handler once on startup
Instead of searching each time.
2019-10-27 12:40:53 -05:00
Mahmoud Al-Qudsi
ae6bdfa37c Handle empty clipboard for all providers
Closes #6254
2019-10-27 12:38:52 -05:00
Johannes Altmanninger
56b4763c67 Fix file completion for builtins "set" and "test -f" and others 2019-10-27 08:07:54 +01:00
Akatsuki
b89a6451a3 functions/__fish_print_hostnames: Fix ssh_configs no values return (#6236)
* functions/__fish_print_hostnames: Fix ssh_configs no values return
`string replace` not working with mutlilines variable.
So split per line first.

* functions/__fish_print_hostnames: remove quotes at `split '\n'`
"\n with quotes" will cause `string split` weird issues.

* functions/__fish_print_hostnames: using `read -alz -d \n`
Fix `$contents` issues together
2019-10-26 18:17:52 +02:00
Akatsuki
d1214edc7a functions/__fish_print_pacman_repos.fish: fix
This function return wrong data.
Fix this.
2019-10-26 18:11:29 +02:00
Johannes Altmanninger
0a5c2051b1 Always use wl-{copy,paste} if running on wayland 2019-10-24 11:42:33 +02:00
Johannes Altmanninger
868eba5e80 Fix error on typing Alt-l on a token that starts with a dash 2019-10-19 12:31:09 +02:00
jalr
2e6ab0b418 cd: Fix test for too many args 2019-10-10 18:06:11 +02:00
Greg Anders
055a332133 Only print extra newlines for multi-line prompts (#6179)
Corrects #6110

BSD `seq` produces a down-counting sequence when the second argument is
smaller than the first, e.g.:

    $ seq 2 1
    2
    1
    $

While GNU `seq` produces no output at all:

    $ seq 2 1
    $

To accommodate for this behavior, only run `seq` when we are sure that
the second argument is greater than or equal to the first (in this case,
the second argument `line_count` should be greater than 1).
2019-10-08 19:14:51 +02:00
ridiculousfish
e2952f230b Revert #6139
Revert "gut gpg.fish/gpg1.fish/gpg2.fish; migrate functionality to __fish_complete_gpg.fish"

This reverts commit d558218d03.

Revert "break version-specific completions out into independent function;"

This reverts commit 9160e77b01.

Revert "split gpg2- and gpg1-specific completions to conditional block"

This reverts commit a069b95f63.
2019-10-06 12:35:07 -07:00
LawAbidingCactus
d558218d03 gut gpg.fish/gpg1.fish/gpg2.fish; migrate functionality to __fish_complete_gpg.fish 2019-10-06 12:31:42 -07:00
LawAbidingCactus
9160e77b01 break version-specific completions out into independent function;
document changes
2019-10-06 12:31:42 -07:00
Greg Anders
0f802eaad8 Add default \es keybinding for "prepend sudo" 2019-10-06 15:17:49 +02:00
Greg Anders
e5fc8abefe Fix default Alt+W keybinding (#6110)
* Fix default Alt+W keybinding

The old keybinding would chop off the last line of the `whatis` output
when using a multi-line prompt. This fix corrects that.

* Make variable local and remove unneeded if statement

* Test that token is non-empty
2019-10-06 15:14:10 +02:00
Kon Doumou
e44d207d64 sudo keywork is ignored when alt+h is pressed
if `sudo` is in the beggining of the command string, then at alt+h press
the manual of the following command is shown instead.

Fixes https://github.com/fish-shell/fish-shell/issues/5982
2019-10-06 15:12:02 +02:00
Johannes Altmanninger
d74b774f51 Fix paginate binding (\ep) for multiline jobs
Reproducer: type `: \<RET><M-p>`. This used to print an error due to builtin test receiving
too many arguments.

It looks like (commandline -j) can return multiple items, because a job can be broken up in multiple
lines terminated by backslashes.
2019-10-03 21:40:25 +02:00
Aaron Gyes
19c575e116 builtin functions: colorize output if interactive
We can also get rid of the | fish_indent --ansi stuff in type.fish
2019-09-25 04:18:06 -07:00
ridiculousfish
e1f46d22de Simplify space binding and fix search
With the new support for self-insert inserting a bound sequence,
the default binding for space as expanding abbreviations can be simplified
to just `self-insert expand-abbr`. This also fixes the bug where space
would cancel pager search.
2019-09-21 16:06:19 -07:00
David Adam
737c2d156d history: fixup exact matching by default
Work on #6070. Fixup from 54ed2ad440.
2019-09-11 23:12:10 +08:00
Mahmoud Al-Qudsi
912421f1cb Switch away from awk for __fish_print_hostnames
By not manipulating each line or even each file at a time, we can go
back to `string` and piece together a pipeline that will execute
significantly faster than shelling out to `awk` will. This also removes
one of the few dependencies on `awk` in the codebase.

With this change, `__fish_print_hostnames` now finishes ~80% faster than
it used to a few commits back.
2019-09-05 22:44:09 -05:00
Mahmoud Al-Qudsi
1db861b4db Clean & slightly optimize SSH hostnames handling in __fish_print_hostnames 2019-09-05 22:44:09 -05:00
Mahmoud Al-Qudsi
06317f0a98 Optimize __fish_print_hostnames hosts file loading/parsing
Reordering the `getent hosts` and read from `/etc/hosts` combined with
minimizing shelling and job invocations for parsing the output results
in a profiled and benchmarked ~42% decrease in the time it takes to run,
and that's on a machine with a very small hosts list in the first place.

This update also fixes the hadling of IPv6 addresses in the hosts
output, which were previously ignored, and ignores 127.* loopback
addresses in addition to the 0.0.0.0 address (plus adds support for
shorter IPv4 notations).
2019-09-05 22:44:09 -05:00
David Adam
54ed2ad440 history: implement exact matching by default for delete
Brings behaviour into line with documented and intended behaviour.
Closes #6070.
2019-09-02 22:59:52 +08:00
Aaron Gyes
edc8d5d7a3 string-replace-fewer-backslashes -> regex-easyesc
This shortens a very long feature name.

See discussion in #5805
2019-08-13 22:32:04 -07:00
mk2
0083555925 Move __fish_complete_abook_formats to abook 2019-08-04 15:20:32 +02:00
Fabian Homborg
ef403129e4 fish_vi_key_bindings: Remove duplicate \cc binding
Already done in the shared bindings.

[ci skip]
2019-07-15 21:04:23 +02:00
Fabian Homborg
33dbd98200 Remove x-bit from function 2019-07-15 21:02:08 +02:00
Fabian Homborg
56e122866c fish_svn_prompt: Shorten a return 2019-07-15 21:02:08 +02:00
Per Bothner
2dcaf4f5c0 Emit 'fish_cancel' at end of __fish_cancel_commandline.
This helps with shell integration - see issue #5973
"shell-integration - how distringuish winch repaint from ctrl-c cancel".
2019-07-15 21:01:49 +02:00
Fabian Homborg
47e9e8ab8a fish_vcs_prompt: Stop at first success
Closes #5980.
2019-07-15 17:32:22 +02:00
Leonard Hecker
ca5427865d Fixed invalid assignments in fish_print_git_action 2019-07-03 17:37:44 +02:00
Fabian Homborg
c392a05db0 functions/__fish_anypython: Also try python{3,2}.7
NetBSD!!!!! *shakes fist*
2019-06-25 19:40:22 +02:00
Fabian Homborg
427a18c1ea fish_git_prompt: Add a way to use the informative chars
$__fish_git_prompt_use_informative_chars will use the informative
chars without requiring informative mode (which is really frickin'
slow!).

See #5726.

[ci skip]
2019-06-25 16:11:18 +02:00
Fabian Homborg
3bc392a6b3 functions/__fish_print_hostnames: Check getent's status
This previously effectively checked `string split ' '`s return status,
which was false if it didn't split anything. And while that should be
true if getent fails (because it should produce no output), it's also
true if it doesn't print a line with multiple aliases. Which should be
fairly typical.

Instead we use our new-found $pipestatus to check what getent returns,
in the assumption that it'll fail if it doesn't support hosts.

Follow up to 8f7a47547e.

[ci skip]
2019-06-25 08:40:31 +02:00
Fabian Homborg
8f7a47547e functions/__fish_print_hostnames: Don't run getent hosts twice
`getent hosts` is expensive-ish - ~50ms, so we don't want to run it
twice just to figure out it works.

Apparently this works everywhere but CYGWIN and possibly older
OpenBSD, but we don't want to explicitly blacklist those.

[ci skip]
2019-06-24 19:19:31 +02:00
Fabian Homborg
77103ddbab Dishonour
[ci skip]
2019-06-12 10:22:46 +02:00
Fabian Homborg
c0ca4d3236 functions/history: Read the search term if none is given
Fixes #5791.
2019-06-06 15:07:46 +02:00
Fabian Homborg
d0921489ee fish_git_prompt: Fix changing show_informative_status
If you changed $__fish_git_prompt_show_informative_status, it
triggered a variable handler, which erased the chars, but neglected to
unset $___fish_git_prompt_init, so we just kept chugging along with
empty characters.

What's the hardest thing in CS again? Cache something something?

[ci skip]
2019-05-29 10:36:14 +02:00
Fabian Homborg
dcf017ff57 fish_complete_directories: Use complete -C
This way we use our core file completion code, which is much more
flexible than we can easily achieve directly in script (which would
require e.g. an `expand` builtin, and case-insensitive globs).

Fixes #5896.
2019-05-27 19:33:52 +02:00
Fabian Homborg
7ddae68645 Restyle a few stragglers
THERE WERE TABS! TABS!

TABS!

[ci skip]
2019-05-20 21:07:37 +02:00
ridiculousfish
3d25ce1fd4 Merge remote-tracking branch 'takoyaki/ant_completion' into master 2019-05-11 23:22:45 -07:00
Fabian Homborg
816df47c10 fish_clipboard_paste: Only trim leading whitespace on first line
We remove leading spaces so a paste isn't histignored, but we did so
on all lines, which removed indentation.

[ci skip]
2019-05-11 11:19:21 +02:00
Fabian Homborg
cc205a134b Disable fish_title in emacs 2019-05-06 17:06:40 +02:00
Fabian Homborg
afff93bdb2 Disable vi-cursor in tests
Otherwise this breaks if run inside a terminal that could do the cursor.
2019-05-05 17:31:33 +02:00
Fabian Homborg
bcce6d691f Keep "; and" and "; or" on fish files
This reformats *.fish files from before commit
c2970f9618 with the changes to fish_indent.

[ci skip]
2019-05-05 13:34:38 +02:00
Fabian Homborg
46b804cf19 fish_vi_cursor: Don't fail if --force-iterm is given in non-iterm
Otherwise this would have used it as the terminal.

Fixup!

[ci skip]
2019-05-05 13:05:19 +02:00
Fabian Homborg
e952f60b02 functions/fish_vi_cursor: Disable on iTerm, allow override
I still don't get #3696, so let's just offer an override for now.

[ci skip]
2019-05-05 13:01:02 +02:00
Fabian Homborg
7451443050 functions/fish_vi_cursor: Cleanup
Removes the unused "uses_echo" variable and adds some comments.

[ci skip]
2019-05-05 12:57:14 +02:00
Fabian Homborg
7d2eb9649c functions/fish_vi_cursor: Detect a few more terms
These have $TERM entries of their own, so detecting them is quite easy.
2019-05-05 12:57:14 +02:00
Fabian Homborg
c22af0d8c7 functions/fish_vi_cursor: Simplify detection
This was quite famously rather complicated.

We drop a bunch of cases - we can't handle tmux-starting-terminals
100% accurately, so we just don't try. It should be quite rare that
somebody starts a different terminal from tmux.

We drop the `tput` since it is useless (like terminfo in general for
feature-detection, because everyone claims to be xterm).

So we just check if we are in konsole, iTerm, vte or genuine-xterm.

Fixes #3696.

See #3481.
2019-05-05 12:57:14 +02:00
Fabian Homborg
787ef3e558 functions/fish_vi_cursor: Move $XTERM_VERSION check earlier
Saves us from having to do it again and again.
2019-05-05 12:56:31 +02:00
Fabian Homborg
ce245704d7 Reformat completion scripts
These were excluded from style.fish
2019-05-05 12:53:09 +02:00
Fabian Homborg
c2970f9618 Reformat all files
This runs build_tools/style.fish, which runs clang-format on C++, fish_indent on fish and (new) black on python.

If anything is wrong with the formatting, we should fix the tools, but automated formatting is worth it.
2019-05-05 12:09:25 +02:00
Fabian Homborg
3b532fc793 functions/fish_vi_key_bindings: Pass "-s" to shared bindings
Fixes #5853.

[ci skip]
2019-04-30 11:41:26 +02:00
Fabian Homborg
82052a6cc9 Don't start focus reporting until later
[ci skip]
2019-04-21 20:26:57 +02:00
Fabian Homborg
b5351bce1b Bind tmux focus reporting as --preset bindings
Purely cleanup, basically.

[ci skip]
2019-04-21 19:48:46 +02:00
Aaron Gyes
51e963bf44 fixup last commit 2019-04-21 09:07:29 -07:00
Aaron Gyes
9d84b45256 __fish_print_help: remove indent
Do this lame replacement in order to make some_builtin --help
output less tacky.
2019-04-21 02:06:29 -07:00