Commit Graph

8916 Commits

Author SHA1 Message Date
ridiculousfish
5947aa0171 Join variables by their delimiter in quoted expansion
This switches quoted expansion like "$foo" to use foo's delimiter instead of
space. The delimiter is space for normal variables and colonf or path variables.
Expansions like "$PATH" will now expand using ':'.
2018-10-19 17:35:36 -07:00
ridiculousfish
3f3b3a7006 Export arrays as colon delimited, and support path-style variables
This commit begins to bake in a notion of path-style variables.

Prior to this fix, fish would export arrays as ASCII record separator
delimited, except for a whitelist (PATH, CDPATH, MANPATH). This is
surprising and awkward for other programs to deal with, and there's no way
to get similar behavior for other variables like GOPATH or LD_LIBRARY_PATH.

This commit does the following:

1. Exports all arrays as colon delimited strings, instead of RS.

2. Introduces a notion of "path variable." A path variable will be
"colon-delimited" which means it gets colon-separated in quoted expansion,
and automatically splits on colons. In this commit we only do the exporting
part.

Colons are not escaped in exporting; this is deliberate to support uses
like

    `set -x PYTHONPATH "/foo:/bar"`

which ought to work (and already do, we don't want  to make a compat break
here).
2018-10-19 17:29:39 -07:00
ridiculousfish
ff042bbb7b Relnote %self 2018-10-19 17:13:13 -07:00
ridiculousfish
b66e5ea5ea Merge branch 'percentself'
This merges support for %self

Closes #5249
2018-10-19 17:09:21 -07:00
ridiculousfish
5fa4e0d2ee Highlight %self as an operator 2018-10-19 16:17:30 -07:00
ridiculousfish
d73c487d60 Restore %self to refer to the fish pid
This brings back the %self argument. Like the original %self it only expands
if the argument is literally %self.
2018-10-19 16:17:25 -07:00
Mahmoud Al-Qudsi
6df29b2fd1 Revert "Disable ONLCR mapping of NL output to CR-NL"
This reverts commit 3f820f0edf.
While the premise described by @nbuwe is sound in #4505, we are now
apparently relying on this behavior is some places (although
inadvertently as there doesn't seem to be a deliberate acknowledgement
of that anywhere).

Turning off ONLCR causes things like indented multiline commands to not
appear correct at the tty (subsequent lines appear both at column 0 and
again indented).
2018-10-19 17:49:11 -05:00
Mahmoud Al-Qudsi
3f820f0edf Disable ONLCR mapping of NL output to CR-NL
Per @nbuwe's excellent explanation in #4505, we can save on output
to the tty by maintaining column location after NL by disabling the
ONLCR terminal mode.

Closes #4505.
2018-10-17 21:20:39 -05:00
Mahmoud Al-Qudsi
dfe6bc531e Enable case-insensitive substring fuzzy matching
Adds a new match mode for `string_fuzzy_match_t` that matches against a
case-insensitive subsequence within a string, e.g. `LL` now (partially)
matches against `hello`. This is implemented as a separate mode, given a
lower priority of match than a same-case match (when present).

Note that `fuzzy_match_subsequence_insertions_only` has purposely not
been extended with a case-insensitive version as that would be a)
unlikely to match often, and b) adding a second inefficient fuzzy search
to something that's queried a lot. Perhaps `subsequence_insertions_only`
can simply be changed to be a case-insensitive comparison in the future?

Closes #1196. Affects #3978.
2018-10-16 21:45:04 -05:00
Mahmoud Al-Qudsi
bb829075d8 Add case-insensitive string/wcstring search 2018-10-16 21:42:55 -05:00
Mahmoud Al-Qudsi
259135b211 fixup! Simplify wildcard_complete prototype
Fix broken build under clang 8.0 under Linux.
2018-10-16 20:38:46 -05:00
ridiculousfish
202bf0bede Tab complete abbreviations
This allows abbreviations to be expanded by tab completions.

Fixes #3233
2018-10-16 16:15:27 -07:00
ridiculousfish
161196fe53 Simplify wildcard_complete prototype
Rather than accepting both a 'description' and a 'description function',
accept just the description function.
2018-10-16 15:43:42 -07:00
Mahmoud Al-Qudsi
ec2659c500 fixup! add makensis (#5242) 2018-10-16 13:50:42 -05:00
Mahmoud Al-Qudsi
0e62dedb26 Correct misdetection of [001] as literal zero index
The control flow in expand.cpp is a bit more complicated than it seemed
at first blush. Ref #4862.
2018-10-15 14:11:37 -05:00
Mahmoud Al-Qudsi
c02bf2548f Close the completions pager (if it's open) on ctrl+c
If you're using the old binding that only clears the commandline and
doesn't preserve its contents and start a new line, you can use

```fish
bind \cc "commandline -f cancel; commandline ''"
```

instead.

Closes #4298.
2018-10-15 13:34:34 -05:00
Fabian Homborg
d22446f651 Let funced handle empty $EDITOR
For some weird reason we only used $editor if it wasn't empty, but
then failed to fail if it was.

This will now print an error and use fish, just like if the $EDITOR
value is invalid in any other way.

Fixes #5257.
2018-10-15 10:14:59 +02:00
Mahmoud Al-Qudsi
c140b3c724 Add completions for git config
This includes dynamic completion of existing keys.
2018-10-14 18:17:23 -05:00
Mahmoud Al-Qudsi
a5b8359c1c Add script for diffing two fish profile runs
Came in handy for tracking down the performance regression in #5219. This will
take the output of two (necessarily identical) `fish --profile ...` runs and
produce a third profile log in which all times are the difference between the
first and the second profile provided.

(I'm not sure if build_tools is the right place for it, but I think it's OK?)
2018-10-14 16:45:16 -05:00
Mahmoud Al-Qudsi
a8a9a823f2 Correct unescaped backslash in \n in string.txt 2018-10-14 16:40:27 -05:00
Mahmoud Al-Qudsi
9c6bd8b1b4 Add completions for kitty terminal
This is a wrapper that calls kitty to dynamically provide completions,
as generated by kitty itself, via `kitty + complete setup fish`.

ref: https://sw.kovidgoyal.net/kitty/#fish
2018-10-14 16:32:49 -05:00
Jan T. Sott
36d3714a62 add makensis (#5242)
* add makensis

* remove duplicate line

* fix typo
2018-10-14 13:17:42 +02:00
Mahmoud Al-Qudsi
6bc59db721 Detect when running out of cmake build directory
Load fish docs and configuration out of the source and/or build
directories rather from the installed paths when running directly out
of the cmake build directory.

Closes #5255.
2018-10-13 21:48:28 -05:00
ridiculousfish
f212518d3e Allow SIGINT in non-interactive mode
Prior to this fix, fish would swallow SIGINT in non-interactive mode. This
meant that scripts could only be Ctrl-C'd if fish was executing an external
command.

Unblock SIGINT in non-interactive mode.

Fixes #5253
2018-10-12 23:58:14 -07:00
ridiculousfish
c76de58758 Normalize "/" path to "/"
This is one obnoxious function.

Fixes #5250
2018-10-12 22:15:16 -07:00
Mahmoud Al-Qudsi
8c3481a921 Block the history race test from running under WSL
It's always failing, and the current test scripts refuse to progress
after the first failure, making it impossible to test fish under WSL.
2018-10-11 18:54:32 -05:00
ridiculousfish
e363171b8d Switch from strdup to std::string in fish_tests 2018-10-11 09:58:16 -07:00
ridiculousfish
8de34a3fb1 Merge branch 'completion_move'
Some awkward optimizations that improve the time spent in a particular
expansion-heavy benchmark by ~30%.
2018-10-11 02:07:02 -07:00
ridiculousfish
90d89a3262 Use more move constructors in expansion
Reduce allocations by switching to move semantics.
clang-tidy detects some use-after-moves.
2018-10-11 02:03:28 -07:00
ridiculousfish
4c08cbd050 Mark completion move ctor as noexcept
Move constructors aren't used unless we mark this ctor as noexcept.
2018-10-11 02:02:55 -07:00
Dennis Schridde
e3643c610f doc_src/set.txt: -U affects only the user running the command, not all users 2018-10-10 18:42:56 +02:00
Mahmoud Al-Qudsi
1f0085bc08 fixup! Add status fish-path
Fixes broken macOS build. I'm not sure how the code used to compile
without including `dyld.h` previously, perhaps a different header used
to pull it in?
2018-10-10 00:29:45 -05:00
Mahmoud Al-Qudsi
e212269ab1 Add status fish-path
Retrieves the fully resolved path to the currently executing fish binary
(regardless of PATH). Can be used to ensure that the same fish is
launched again from a script.

`get_executable_path()` moved from fish binary to libfish, also cleaned
up some duplicated (but differing!) definitions of PATH_MAX (which was
used by that function) in the process.
2018-10-09 22:34:41 -05:00
Mahmoud Al-Qudsi
c6230ddfde Clean up status_builtin options and enums
Drop usage of magic numbers and sort lists where possible.
2018-10-09 22:14:42 -05:00
Mahmoud Al-Qudsi
236556ba05 Update get_executable_path() for FreeBSD
Remove dependency on the Linux compatibility layer's procfs being
installed and mounted when running under FreeBSD by directly querying
the MIB for the path to the running fish executable
(KERN_PROC_PATHNAME). Tested under FreeBSD 11.2-RELEASE.
2018-10-09 19:47:49 -05:00
Adel Atallah
6a9f0fc0c1 Fix typo in the documentation 2018-10-09 16:52:27 +02:00
Xuanwo
5e77689c5a completions: Add systemctl set-property support 2018-10-09 16:51:49 +02:00
Fabian Homborg
728dd25665 [completions/git] Add rebase --exec
Fixes #5236.
2018-10-08 15:43:45 +02:00
Jason
ca159ae4b8 Fix typo 2018-10-07 12:49:02 +02:00
ridiculousfish
786c0c5abb Merge branch 'virtualpwd'
This merges a switch to  a 'virtual PWD' model where it no longer resolves
symlinks by default.
2018-10-06 17:04:52 -07:00
ridiculousfish
3e4bdf51d4 Teach hg prompt to use pwd -P
The hg prompt walks up the directory hierarchy to decide if we are in a
repo subdirectory. Because hg is an external command, it resolves symlinks.
Switch to using pwd -P so hg and fish will have the same view of the hg repo.

Based on comment:
https://github.com/fish-shell/fish-shell/pull/5190#issuecomment-421912360
2018-10-06 17:03:18 -07:00
ridiculousfish
0f0bb1e10f Don't resolve symlinks with cd
This switches fish to a "virtual" PWD, where it no longer uses getcwd to
discover its PWD but instead synthesizes it based on normalizing cd against
the $PWD variable.

Both pwd and $PWD contain the virtual path. pwd is taught about -P to
return the physical path, and -L the logical path (which is the default).

Fixes #3350
2018-10-06 17:03:18 -07:00
ridiculousfish
6ad4d94e12 Introduce path_normalize
This new function performs normalization of paths including dropping
/./ segments, and resolving /../ segments, in preparation for switching
fish to a "virtual" PWD.
2018-10-06 17:03:18 -07:00
jacob
02b093d70a Change only to exactly 2018-10-06 16:35:03 -07:00
jacob
739ad77f38 Fix typos and address formatting
There are a few opportunities to improve the formatting as well as a
handful of typos in this document. I was looking into contributing and
noticed that it might be worthwhile to address them.
2018-10-06 16:35:03 -07:00
ridiculousfish
767b7a2180 Migrate the completion set to owning_lock_t 2018-10-05 09:05:59 -07:00
jacob
35c01bcba2 Fix a capitalization error and add a link
I just submitted a PR to fix a few issues in CONTRIBUTING.MD, so I took
a few minutes too look over README.md as well. This is the only room
for improvement I noticed.
2018-10-03 22:12:10 +08:00
Fabian Homborg
0aedd47af2 [completions/env] Argparsify
This fixes subcommand completions by using argparse to get the
subcommand, just like we did for `sudo`.

Reported by @adregan on gitter
2018-10-02 19:31:30 +02:00
evuez
f3cee81338 Add --color completion for diff 2018-10-02 18:51:14 +02:00
Fabian Homborg
64783428d4 [CHANGELOG] Add more for 3.0 2018-10-02 18:41:59 +02:00