Commit Graph

63 Commits

Author SHA1 Message Date
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
Fabian Homborg
f2fd30df03
Make fish_key_reader's output simpler (#8467)
* fish_key_reader: Simplify default output

It now only prints the bind statement. Timing information and such is
relegated to a separate "verbose" mode.

* Adjust fish_key_reader docs

* Adjust tests
2021-11-22 17:22:22 +01:00
Fabian Homborg
cbf28dfa57 Document turning off suggestions/history
Also add more mentions of `fish_config` in general.
2021-11-02 21:40:56 +01:00
Fabian Homborg
d03ec2cc6b docs/interactive: Some rewording. 2021-10-24 21:18:31 +02:00
Fabian Homborg
db5e7734a6 Some small changes to the docs
Reorder the variables, make more cd-related stuff subsections, a
slight rewording.
2021-10-20 21:28:14 +02:00
Fabian Homborg
711796ad13 Highlight options differently
This introduces a new variable, $fish_color_option, that can be used
to highlight options differently.

Options are tokens starting with `-`, but only up to (and including!)
the first `--`.

Fixes #8292.
2021-10-19 17:20:21 +02:00
Fabian Homborg
8b4585d387 docs: Some mistakes in interactive
"This page" is no longer index, we don't match matching parentheses or
quotes and the `\n` didn't show up in the render as the backslash disappeared.
2021-09-01 19:48:33 +02:00
Fabian Homborg
2c420ef728 docs: Document that commands with space will be kept until the next 2021-08-01 14:01:49 +02:00
Fabian Homborg
2b7f6e4b0c docs: Put a note on which binding function to call in each section
Fixes #8084.
2021-07-14 16:49:22 +02:00
Fabian Homborg
feb3a15739 docs: Make title level consistent
This allows us to ..include these without getting confused.
2021-07-13 23:05:23 +02:00