Commit Graph

1624 Commits

Author SHA1 Message Date
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
Fabian Homborg
46911a5e7f Revert "__fish_describe_command: Remove awk"
Dealing with macOS output in a fast manner using `string` is surprisingly hard, given that it features lines like

    gls(1), ls(1)            - list directory contents

Printing the "gls" with the description and the "ls" with the description requires a `while read` loop, and that's too slow.

This reverts commit 7784a5f23c.

[ci skip]
2019-04-19 20:57:45 +02:00
Aaron Gyes
92f4a009b3 __fish_config_interactive: disable file completions for builtins
Calling `complete` once here is preferable to adding a bunch of
1 line files to be autoloaded.
2019-04-15 12:49:24 -07:00
Mahmoud Al-Qudsi
e0e0fe9dd3 Re-implement eval as a regular builtin
I did not realize builtins could safely call into the parser and inject
jobs during execution. This is much cleaner than hacking around the
required shape of a plain_statement.
2019-04-12 07:04:15 -05:00
Geographer
9cf1b18b26 Honor dirprev scope (#5796)
* Honour `dirprev` scope

Honour the scope of the `dirprev` variable if it is universal
and avoid to shadow it with a global. This enables to share
the `cd` history between sessions.

* Honor dirnext and __fish_cd_direction scope

If these variables exist in the universal scope, do not shadow them
2019-04-12 09:43:34 +02:00
Fabian Homborg
e672b03993 functions/fish_hg_prompt: Remove --color and --pager
These weren't added long enough ago, and I only added them
speculatively.

So it should make it work with old hg versions.

CC @zanchey.

[ci skip]
2019-04-12 09:01:34 +02:00
Mahmoud Al-Qudsi
0cf0829c5f Add comment clarifying presence of empty eval function 2019-04-11 12:59:04 -05:00
Mahmoud Al-Qudsi
2fe2169065 Make eval a decorator
`eval` has always been implemented as a function, which was always a bit
of a hack that caused some issues such as triggering the creation of a
new scope. This turns `eval` into a decorator.

The scoping issues with eval prevented it from being usable to actually
implement other shell components in fish script, such as the problems
described in #4442, which should now no longer be the case.

Closes #4443.
2019-04-11 10:36:49 -05:00
Fabian Homborg
25dd22242d Adjust __fish_print_help for sphinx
This is beyond cheesy, but it seems to work.

Fixes #5782.
2019-04-10 18:20:25 +02:00
Aaron Gyes
b002eb350c Get rid of __fish_repaint_root
it's identical to __fish_repaint - so just register that for both
variable change events.
2019-04-09 00:29:22 -07:00
Fabian Homborg
8ff866b26b Add repaint-mode bind function
If we switch the bind mode, we add a "force-repaint" there just to
redraw the mode indicator.

That's quite wasteful and annoying, considering that sometimes the prompt can take
half a second.

So we add a "repaint-mode" function that just reexecutes the
mode-prompt and uses the cached values for the others.

Fixes #5783.
2019-04-01 15:59:39 +02:00
Fabian Homborg
0d72912641
Expand abbr explicitly (#5762)
* Add "expand-abbr" bind function

This can be used to explictly allow expanding abbreviations.

* Make expanding abbr explicit

NOTE: This accepts them for space only, we currently also do it for \n
and \r.

* Remove now dead code

We no longer trigger an abbr implicitly, so we can remove the code
that does it.

* Fix comment

[ci skip]
2019-04-01 15:59:15 +02:00
Fabian Homborg
21d8b465cc nextd/prevd: Print BEL instead of "Hit end of history"
That message is just hugely annoying.

Hat-tip to @floam and d524bad5f16b5a18c22fefe440.
2019-03-28 11:58:53 +01:00
Fabian Homborg
e2ce63ff62 functions/help: Adjust command paths to sphinx
We now build a separate page per-command in cmds/$cmd.html instead of
a section in the "commands.html" page.

See #5696.

[ci skip]
2019-03-27 12:46:51 +01:00
Fabian Homborg
2a51e42ee0 functions/help: Try harder to find a browser on WSL
We now try cmd.exe via $PATH and via a common location, wsl-open, and
an open command.

Fixes #5756.

[ci skip]
2019-03-27 09:06:11 +01:00
Fabian Homborg
248200520e functions/help: Prefer xdg-open/cygstart over open
Some systems like Debian have "open" as a symlink to "openvt" (for... historical
reasons).

See #5756.

[ci skip]
2019-03-27 09:06:11 +01:00
Fabian Homborg
5afd1336e8 functions/fish_npm_helper: Use physical pwd
This searched for package.json in any parent, so just like finding
.git and .hg directories it _needs_ to use the physical pwd because
that's what git/hg/yarn use.

In general, if you do _any_ logic on $PWD, it should be the physical
path. Logical $PWD is basically only good for display and cd-ing
around with symlinks.

[ci skip]
2019-03-24 10:49:04 +01:00
Fabian Homborg
25ba16d4b6 functions/help: Cleanup 2019-03-22 12:48:26 +01:00
Fabian Homborg
4c61691377 functions/help: Don't eval to check for lynx
This called `eval $fish_browser --version` to figure out if it is
lynx.

That's really not worth it just to support edge-cases using a rather
unusual browser, to work around a bug in it.

Instead we just see if the browser name starts with "lynx", which
should work in 99.9% of cases.
2019-03-22 12:38:23 +01:00