fish-shell/doc_src
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
..
cmds docs/argparse: Add some more examples, something on -x 2024-02-03 21:41:50 +01:00
python_docs_theme doc_src: add print media support to the Sphinx theme 2024-01-12 17:52:43 +01:00
commands.rst docs: Add else and end to keywords list 2024-01-09 16:27:33 +01:00
completions.rst Fix grammar in completion docs 2023-07-09 14:11:01 +08:00
conf.py bump copyright year to 2024 2024-01-06 22:24:55 +08:00
contributing.rst Improve CONTRIBUTING and add it to the docs 2023-06-01 18:09:02 +02:00
design.rst docs: Fix typos 2022-09-17 21:31:06 +08:00
faq.rst docs/faq: Remove external tools 2023-05-25 17:46:25 +02:00
fish_for_bash_users.rst docs: Explain globs more in fish-for-bash-users 2024-01-14 11:06:51 +01:00
fish_indent_lexer.py docs: restore default highlighting keywords and options in HTML 2022-01-16 14:07:19 +01:00
fish_synopsis.py Restyle fishscript and python 2023-06-01 18:20:19 +02:00
index.rst docs: Some slight rewordings 2023-08-23 23:08:56 +02:00
interactive.rst Open command script in external editor on Alt+o 2024-02-07 00:07:47 +01:00
language.rst Add feature flag to turn off %self (#10262) 2024-02-06 22:13:16 +01:00
license.rst Import FindRust from Corrosion 2024-01-30 18:18:55 +08:00
prompt.rst docs/prompt: A few small fixes 2024-02-03 11:12:11 +01:00
relnotes.rst docs: call the CHANGELOG "release notes" 2021-02-25 22:46:24 +08:00
tutorial.rst docs: Some on the tutorial 2023-04-28 17:11:23 +02:00