Commit Graph

72 Commits

Author SHA1 Message Date
Johannes Altmanninger
d9633f2b38 Remove stale docs about fish_vi_force_cursor
Remove in 983746a69 (fish_vi_cursor: Remove terminal checks, 2024-08-30).
2024-10-21 21:53:32 +02:00
Johannes Altmanninger
6af96a81a8 Default bindings for token movement commands
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
There is no natural default binding for token movements. Add the
alt-{left,right,backspace,delete}, breaking some existing behavior.

For example, backward-delete-word is no longer bound to alt-backspace but
only to ctrl-backspace.  Unfortunately some terminals (particularly tmux)
don't support distinguishing ctrl-backspace from ctrl-h yet, so the loss
of alt-backspace may be tragic.

---

I guess we could also add:

    bind alt-B backward-token
    bind alt-F forward-token
    bind ctrl-W backward-kill-token
    bind alt-D kill-token

Those might be intercepted by the terminal on Linux, but I don't know where
that happens.

Tested on foot, kitty, alacritty, xterm, tmux, konsole and gnome-terminal.

Closes #10766
2024-10-13 14:53:45 +02:00
Johannes Altmanninger
2e9de57fd7 Document ctrl-backspace and bind ctrl-delete as well
This has a slightly different behavior than what the CUA user expects:
it fails to eat up trailing spaces.  We should probably fix this.
2024-09-23 14:52:50 +02:00
Harmen
fc4dd8f4de docs: fix "theme choose None" command
The command needs an upper-case "None", not a lower case.
2024-09-13 12:21:34 +02:00
Johannes Altmanninger
de7f39d627 builtin bind: make function keys lowercase (f1 instead of F1)
All other key names are lowercase so this inconsistency is weird.
2024-05-22 22:38:06 +02:00
Fabian Boehm
18a0b44f0f docs: More on new keys 2024-04-20 17:05:46 +02:00
Johannes Altmanninger
c921c124ef docs: use canonical key names in :kbd: tags
This seems a bit better because it's what bind uses.  To makes sure that
something like :kbd:`ctrl-x` looks good in HTML, remove the border from the
kbd style.  Else both "ctrl" and "x" get small boxes which looks weird.
2024-04-20 15:36:29 +02:00
Fabian Boehm
53961c7759 Fix doc formatting
This is RST, not markdown
2024-04-02 17:39:39 +02:00
Johannes Altmanninger
8bf8b10f68 Extended & human-friendly keys
See the changelog additions for user-visible changes.

Since we enable/disable terminal protocols whenever we pass terminal ownership,
tests can no longer run in parallel on the same terminal.

For the same reason, readline shortcuts in the gdb REPL will not work anymore.
As a remedy, use gdbserver, or lobby for CSI u support in libreadline.

Add sleep to some tests, otherwise they fall (both in CI and locally).

There are two weird failures on FreeBSD remaining, disable them for now
https://github.com/fish-shell/fish-shell/pull/10359/checks?check_run_id=23330096362

Design and implementation borrows heavily from Kakoune.

In future, we should try to implement more of the kitty progressive
enhancements.

Closes #10359
2024-04-02 14:35:16 +02:00
Johannes Altmanninger
47aa79813d Open command script in external editor on Alt+o
Fish functions are great for configuring fish but they don't integrate
seamlessly with the rest of the system. For tasks that can run outside fish,
writing scripts is the natural approach.

To edit my scripts I frequently run

    $EDITOR (which my-script)

Would be great to reduce the amount typing for this common case (the names
of editor and scripts are usually short, so that's a lot of typing spent on
the boring part).

Our Alt+o binding opens the file at the cursor in a pager.  When the cursor
is in command position, it doesn't do anything (unless the command is actually
a valid file path). Let's make it open the resolved file path in an editor.

In future, we should teach this binding to delegate to "funced" upon seeing
a function instead of a script. I didn't do it yet because funced prints
messages, so it will mess with the commandline rendering if used from
a binding.  (The fact that funced encourages overwriting functions that
ship with fish is worrysome. Also I'm not sure why funced doesn't open the
function's source file directly (if not sourced from stdin). Persisting the
function should probably be the default.)

Alternative approach: I think other shells expand "=my-script" to
"/path/to/my-script".  That is certainly an option -- if we do that we'd want
to teach fish to complete command names after "=".  Since I don't remember
scenarios where I care about the full path of a script beyond opening it in
my editor, I didn't look further into this.

Closes #10266
2024-02-07 00:07:47 +01:00
David Adam
ea256323ab docs: standardise name for vi mode
Vi mode, vi-mode and various permutations are used.

Standardise on "vi mode".
2023-12-17 17:40:45 +08:00
Fabian Boehm
496fc03b98 docs: More on key timeout, key chord limitations 2023-10-24 18:25:49 +02:00
Fabian Boehm
8abd0319fb docs: Some slight rewordings 2023-08-23 23:08:56 +02:00
Kevin Cali
716001789b docs: correct insert mode key 2023-08-21 17:50:45 +02:00
Fabian Boehm
c07136e8d3 docs: Mention fish_cursor_replace
Fixes #9956
2023-08-15 19:11:03 +02:00
Fabian Boehm
2fa2b802c9 docs/interactive: Some small adjustments
Wording improvements and move private mode down, to the history section.
2023-05-25 17:46:25 +02:00
Fabian Boehm
0c900f74d0 docs: Explain bind --mode in custom bindings 2023-05-18 09:40:03 +02:00
Fabian Boehm
483478f4cf docs: Improve prompt section and move title after it 2023-04-28 17:19:00 +02:00
Fabian Boehm
c55ec59e22 docs: A tad more on shared bindings
alt+enter, some consistency fixes
2023-04-26 21:22:34 +02:00
Paiusco
564039093b Create fish_[default|vi]_key_bindings documentation
- Create docs file for both vi and default key bindings
- Remove variable mention on `interactive` and point to their own pages
2023-04-19 19:22:55 +02:00
Eric N. Vander Weele
a6e16a11c2 docs/interactive: Document fish_color_history_current variable
All *.theme files set variables documented in the "Syntax highlighting
variables" section, and fish_color_history_current was missing.
2023-04-07 15:29:23 +02:00
Fabian Boehm
e45bddcbb1 __fish_cursor_xterm: Ignore unknown cursor settings
This prevents leaking the escape sequence by printing nonsense, and it
also allows disabling cursor setting by just setting the variable to
e.g. empty.

And if we ever added any shapes, it would allow them to be used on new
fish and ignored on old

Fixes #9698
2023-03-31 20:07:54 +02:00
Quinten Roets
f5506803d7
fish_vi_cursor: add new variable for external cursor mode (#9565)
* add new variable for external cursor mode

* fix backwards compatibility

* add documentation

* document change in changelog
2023-03-14 10:50:20 +01:00
Fabian Boehm
01d681067c Bind ctrl-g to cancel as well
Classic emacs thing and the chord is so far unused.

Fixes #9484
2023-01-21 13:35:22 +01:00
Fabian Boehm
1d29ae7847 docs: Document more vi-mode bindings
These are quite incomplete and need more work.
2023-01-10 20:36:59 +01:00
Fabian Boehm
16369a3abb docs/interactive: More on custom bindings 2023-01-08 20:36:10 +01:00
Fabian Boehm
126647380a docs: More on fish_greeting 2023-01-08 12:44:02 +01:00
David Adam
c2ad9e44ec docs: include fish_cursor_selection_mode in list of special variables 2023-01-01 22:44:09 +08:00
Fabian Boehm
ddcb14c8f8 docs: Make color variables envvar definitions
This allows linking them from elsewhere (currently fish_indent) and
also improves the formatting - the code formatting here isn't actually a good look.
2022-12-28 12:21:42 +01:00
Fabian Boehm
d1741c42f3 docs/interactive: Some slight rewordings and additions to bindings 2022-12-26 21:34:11 +01:00
Fabian Boehm
d6a117d2a4 docs/interactive: Move bindings under "Command line editor" 2022-12-26 21:19:48 +01:00
Fabian Boehm
285b0602e4 docs: Fix link 2022-12-19 20:22:27 +01:00
Fabian Boehm
f82e00dbf6 docs: Some on completions 2022-12-19 19:46:16 +01:00
Johannes Altmanninger
622a0278bc interactive.rst: fix broken cross-reference 2022-12-17 18:09:54 +01:00
Fabian Boehm
95d672534e docs: Explain how to skip abbrs 2022-12-16 17:10:45 +01:00
Fabian Boehm
0e194adb70 docs: More on abbr 2022-12-15 17:54:16 +01:00
Fabian Boehm
98552817f5 Document fish_clipboard_copy/paste 2022-10-19 20:10:26 +02:00
Fabian Boehm
1e7a4b076d vi-mode: Bind "/" to history-pager
This is unused currently, so we can just use it here. Ctrl-s as the
inverse stays because that's shared.

Fixes #2271
2022-10-11 17:47:13 +02:00
Fabian Boehm
38b24c2325 docs: Use :doc: role when linking to commands
This makes it so we link to the very top of the document instead of a
special anchor we manually include.

So clicking e.g. :doc:`string <cmds/string>` will link you to
cmds/string.html instead of cmds/string.html#cmd-string.

I would love to have a way to say "this document from the root of the
document path", but that doesn't appear to work, I tried
`/cmds/string`.

So we'll just have to use cmds/string in normal documents and plain
`string` from other commands.
2022-09-24 10:56:43 +02:00
Luca Trevisani
86138db9f5 Fix Control+C key binding description 2022-09-20 23:21:16 +02:00
tocic
ade61fd50f docs: Fix typos 2022-09-17 21:31:06 +08:00
Fabian Boehm
ee6270301b docs: Moar history pager 2022-09-10 20:44:15 +02:00
Fabian Boehm
79642995f1 docs: ctrl-r is only history pager in emacs mode
We do not currently have a vi-binding for it because ctrl-r is redo
there.
2022-09-10 15:17:56 +02:00
Fabian Boehm
dbeb667ff4 Document history pager 2022-09-08 22:50:00 +02:00
Fabian Boehm
a42a651d0a Use color for $fish_color_valid_path if it exists
This otherwise threw away the color. Since that's just information
that is thrown away, let's just use it.

Fixes #9159.
2022-08-25 17:42:42 +02:00
Michael Forster
91c68ec1af Add fish_cursor_selection_mode documentation 2022-07-30 09:49:23 -07:00
David Adam
4bad88f0df update Vi key binding documentation to reflect reality
PR #6777 changed all the keys to uppercase, but many Vi commands are case
sensitive.

PR #7908 changed the "u" binding but the documentation still had the old
meaning.
2022-07-21 22:57:37 +08:00
Johannes Altmanninger
cfce285a05 Document some missing color variables 2022-04-24 21:31:51 +02:00
Fabian Homborg
5926a75cc5 highlight: Also use the fallback variable if the main is empty
Currently, when a variable like $fish_color_command is set but empty:

    set -g fish_color_command

what happens is that highlight parses it and ends up with a "normal"
color.

Change it so instead it sees that the variable is empty and goes
on to check the fallback variable, e.g. fish_color_normal.

That makes it easier to make themes that override variables.

This means that older themes that expect an empty variable to be
"normal" need to be updated to set it to "normal".

Following from this, we could make writing .theme files easier by no
longer requiring them to list all variables with specific values.
Either the theme reader could be updated to implicitly set known color
variables to empty, or the themes could feature empty values.

See #8787.
2022-03-20 17:04:28 +01:00
Fabian Homborg
959e17face Update title documentation
This included "the default", which was no longer true.

Also there's no need to keep explaining things are "new" if they were
added in fish 2.2.0.
2022-03-06 13:19:29 +01:00