Commit Graph

9177 Commits

Author SHA1 Message Date
Fabian Homborg
3253893923 funced: Use variable-as-command 2018-10-21 15:34:19 +02:00
Fabian Homborg
e9568069a7 help: Use variable-as-command instead of eval 2018-10-21 15:33:29 +02:00
Fabian Homborg
fc51c156cb __fish_config_interactive: Use variable-as-command
This removes a use of eval, and some duplication.
2018-10-21 15:31:49 +02:00
Fabian Homborg
09f77a355f __fish_config_interactive: Remove unused $configdir 2018-10-21 15:31:12 +02:00
Fabian Homborg
3b2be9009e funcsave: Use mkdir -p
It's in POSIX, and simplifies stuff.
2018-10-21 15:24:38 +02:00
ridiculousfish
00b1dd861e Merge branch 'splitenv_1.8'
This merges support for PATH variables. Closes #5245
2018-10-20 12:51:51 -07:00
ridiculousfish
1b5ccb12d5 Document PATH variables 2018-10-20 12:31:44 -07:00
Fabian Homborg
6eccf6557f common: Pass in length for wcs2str with wcstring
Removes _two_ wcslen calls.
2018-10-20 20:52:02 +02:00
Fabian Homborg
d4db4f40a4 Remove another unnecessary wcstring->wchar conversion 2018-10-20 20:52:02 +02:00
Fabian Homborg
27c0ee92de Remove a few useless .c_str()
With .c_str(), these call the wchar_t* overloads, which frequently then go on to call wcslen.
Just directly use the wcstring we already have.
2018-10-20 20:51:05 +02:00
ridiculousfish
f4d666f56c Allow user to set and unset path property of variables
This adds flags --path and --unpath to builtin set, analogous to
--export and --unexport. These flags change whether a variable is
marked as a path variable.

Universal variables cannot yet be path variables.
2018-10-19 17:39:21 -07:00
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