Commit graph

1653 commits

Author SHA1 Message Date
Gokul Soumya
2fd78fd5c2
Uncomment most recent comment if commandline is empty when using toggle comment binding (#7137)
* functions/__fish_toggle_comment_commandline: Uncomment most recent comment if commandline is empty

* Refactor variable setting in functions/__fish_toggle_comment_commandline.fish

* Update changelog regarding toggle comment binding
2020-06-24 18:35:36 +02:00
Fabian Homborg
63f7f1925e git prompt: Simplify "staged" logic
This had this weird "pass along the sha, then check" logic to it which
is entirely unnecessary.

This function just says when something is staged, nothing more. Why
that is you can figure out for yourself.

This makes it easier to call this function, and it no longer prints an
empty line if nothing is staged.
2020-06-20 21:47:19 +02:00
Fabian Homborg
197d615cc8 git prompt: Minor cleanup 2020-06-20 19:01:27 +02:00
Fabian Homborg
4186d840db git prompt: Simplify some helper functions 2020-06-20 19:01:27 +02:00
Fabian Homborg
73c0fa03b8 git prompt: Also repaint correctly if use_informative_chars is set 2020-06-20 19:01:27 +02:00
Fabian Homborg
894ec3dfd4 fish_git_prompt: Always allow for displaying stashstate
This wasn't added to the prompt status order, so it was computed and
then not used for the informative prompt.

We still check later if we should compute it, so this is harmless if
showstashstate is unset.

Fixes #7136.
2020-06-20 09:33:04 +02:00
Fabian Homborg
4660be372a Only disable title in emacs "term"
There's more than one emacs terminal (for some reason), and term is
the most broken one and can't even handle a title.

Fixes #7122.
2020-06-17 16:48:13 +02:00
Shun Sakai
ffaf969e6e Add completions for apk-tools
Completion of options for each subcommand is not implemented.
2020-06-14 19:23:49 +02:00
Lennard Hofmann
1b90be57f2 Add foot to update_cwd_osc
See https://codeberg.org/dnkl/foot
2020-06-09 12:49:33 -07:00
Fabian Homborg
a4a4a2e1b6 __fish_print_packages: Fix apt
On my system this printed just "Description:" without any additional
characters, so this awkward `sed` didn't match and produced *all
packages on one line*.

Tbh this should probably be rewritten, but first we'd have to find a
way to get proper output here.
2020-06-08 18:32:52 +02:00
Fabian Homborg
e646285bcb
Let __fish_prepend_sudo use the last commandline if there is no current one (#7079)
* docs/faq: Mention prepend_sudo

[ci skip]

* __fish_prepend_sudo: Use $history[1] if commandline is empty

Currently, if you press alt+s with an empty commandline, it inserts
"sudo", which seems fairly useless.

Now, it inserts "sudo " followed by the last history entry, which
makes it a replacement for `sudo !!`.

* docs
2020-06-04 18:25:02 +02:00
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