Commit graph

12635 commits

Author SHA1 Message Date
Fabian Homborg
e6f5c78d39 Convert Markdown files to RST
We use sphinx with rst for our documentation, and github supports rst
here, so it seems weird to have markdown just for these.

It also allows us e.g. to include the CHANGELOG in the docs without
requiring another build dependency.
2020-05-30 10:07:21 +02:00
Mahmoud Al-Qudsi
bc756a981e Recover from bad redirections in the middle of a job pipeline
Currently fish aborts execution mid-pipeline if a file redirection
failed, which can leave the shell in a broken state (job abandoned after
giving control of the terminal to an already-executed job in the
pipeline).

This patch replaces a failed fd with a closed fd and continues execution
if the affected process wasn't the first in the pipeline.

While this is a hack to address the regression behind fish-shell/#7038
introduced in d62576c, it can also be argued that this behavior is
actually more correct... right?

Closes #7038.
2020-05-30 00:27:11 -05: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
1e17a68133 docs/tutorial: Recommend fish_add_path over $fish_user_paths 2020-05-29 20:51:09 +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
f041daecc6 completions: update python3 2020-05-28 17:42:00 +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
Jason
90b9dd3627 Reword sentence 2020-05-28 17:39:37 +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
Jason
fb57a98aef Shorten python3 completion descriptions 2020-05-27 20:12:48 +02:00
Fabian Homborg
7cb452c7e7 Computed variables are global
Variables like $status and $history showed up in all scopes, including
universal, when querying with `set -q` or `set -S`.

This makes it so they all only count as set in global scope, because
we already only allow assignment to electric variables in global scope.

Fixes #7032
2020-05-27 19:59:20 +02:00
Fabian Homborg
46068cd257 completions/unzip: Stop filtering suffixes
It's unhelpful quite often.

See #7040.
2020-05-27 19:35:17 +02:00
Fabian Homborg
2f7ac8767e Fix wordo
English! It's a thing!

[ci skip]
2020-05-27 18:12:56 +02:00
Fabian Homborg
1dfc701ec6 docs: Slight rewording on the unmatched globs faq
[ci skip]
2020-05-27 18:11:59 +02:00
Fabian Homborg
ec267a1d54 Document how fish does not pass along unmatched globs
See #7043.

[ci skip]
2020-05-27 18:09:53 +02:00
Joel Kuhn
6853705b0b Fix underflow in commandline jump functions
This patch fixes an underflow in the jump family of readline commands
when called via `commandline -f` outside of a bind context such as
`commandline -f backward-jump`. To reproduce, run that command at a
prompt and the shell will crash with a buffer underlow.

This happens because the jump commands have non-zero arity, requiring a
character event to be pushed on the function args stack. Pushing the
character event is handled in `function_push_args`, called by
`inputter_t::mapping_execute`, which checks the arity of the function
and enqueues the required number of charcter events. However,
`builtin_commandline` calls `reader_queue_ch`, which in turn calls
`inputter_t::queue_ch`, which immediately enqueues the readline event
without calling `function_push_args`, so the character event is never
pushed on the arg stack.

This patch adds a check in inputter_t::queue_ch which checks if the
character event is a readline event, and if so, calls
`function_push_args`.
2020-05-26 19:53:09 -07: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
Cherichy
f32777a0cc check for both wsl1 and wsl2 2020-05-25 13:05:13 +08:00
Cherichy
b34d9bcc97 fix is_wsl() on wsl2
on wsl2 the /proc/version contains no Microsoft as wsl1 do.
2020-05-25 13:05:13 +08:00
Fabian Homborg
38a6f34dd5 CHANGELOG Showing suggestions more
See #6948

[ci skip]
2020-05-24 22:27:03 +02:00
ksralgp
f55f98b064
Show autosuggestions when (left prompt + command) exceed right prompt (#7035)
* Show autosuggestions when (left prompt + command) exceed right prompt

* Fix indentation whitespace and run build_tools/fish.style on src/screen.cpp
2020-05-24 21:54:00 +02:00
Fabian Homborg
1879b4e697 docs: Some rewording in Special Variables 2020-05-24 20:23:31 +02:00
Fabian Homborg
420f68b1e3 docs: Some rewording in the variable scope section 2020-05-24 20:23:31 +02:00
Fabian Homborg
82d720ca2a docs: Rewrite variables section 2020-05-24 20:23:31 +02:00
Fabian Homborg
87660d3d87 docs: Rewrite identifiers and move it down
Weird to mention it before even explaining variables.
2020-05-24 20:23:31 +02:00
Jason Nader
65dde5b55a Fallback to the slower --list-devices if device not immediately available 2020-05-24 20:19:19 +02:00
Jason Nader
68a1f2b20a completions: speed up kdeconnect-cli device discovery 2020-05-24 20:19:19 +02:00
Jason
7b9119cc9a fish_vcs_prompt: allow argv passthrough
fish_git_prompt encloses its output in brackets, however this can be changed by supplying a format string to it, i.e. `fish_git_prompt %s`.
However when using `fish_vcs_prompt` there's no way to pass on the arg to fish_git_prompt, so you need to manually remove it.
fish_hg_prompt doesn't have the same format string support as fish_git_prompt, but I suppose it could be added later if needed.
2020-05-24 20:18:06 +02:00
David Adam
b9ea880535 CHANGELOG: minor work on 3.2.0
[ci skip]
2020-05-24 16:26:01 +08:00
David Adam
b6eb95abad docs: minor spelling/style corrections
[ci skip]
2020-05-24 16:14:23 +08:00
Fabian Homborg
07e6ccd444 docs: Rewrite index range section 2020-05-24 09:33:24 +02:00
Fabian Homborg
2522249145 docs: Rewrite cartesian product section 2020-05-24 09:33:20 +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
c2a8557c38 docs: Reword brace expansion 2020-05-23 18:31:33 +02:00
Fabian Homborg
255ab2f140 docs: Reword command substitution 2020-05-23 18:31:33 +02:00
Fabian Homborg
85c970187b docs: Reword parameter expansion/globbing
Why it said "Parameter expansion ("globbing")" no idea.
2020-05-23 18:31:07 +02:00
Fabian Homborg
1eb2bd13ca docs: Reword autoloading
This is hard to understand, so it needs polish polish polish.
2020-05-23 18:24:43 +02:00
Fabian Homborg
25d51bf093 docs: Reword redirection/piping
Less emphasis on the file descriptors
2020-05-23 18:24:43 +02:00
Fabian Homborg
840663bc0b docs: Reword quotes section 2020-05-23 18:24:37 +02:00
Fabian Homborg
814efb5569 docs: More on variable scoping
Specifically more examples, and more *real* examples. Some of it is
copied straight from my config.fish.
2020-05-23 16:42:54 +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
ridiculousfish
a9bfe7f164 Remove find_program(sed) from CMake
We no longer use sed.
2020-05-22 13:44:55 -07:00
ridiculousfish
84e0c8d32e Guard thread_local
Mac OS X 10.9 supports __thread but not C++11 thread_local.
Teach CMake to detect support for thread_local and use the proper
define guard.

Fixes #7023
2020-05-22 13:41:05 -07:00
ridiculousfish
1fd0cd5510 Avoid forming owning_lock of incomplete type in history
Older libstdc++ will error on this.

Partially addresses #7023
2020-05-22 13:36:46 -07:00
Johannes Altmanninger
285861d346 Do notify about jobs that were continued outside fish
When sending SIGCONT to a stopped job, this behaves now
a bit more like a job that was continued by the bg builtin;
bg uses job_t::continue_job which seems overkill here.
2020-05-22 21:28:54 +02:00