fish-shell/doc_src
Fabian Homborg c4593828f4
commandline: Add --is-valid option (#8142)
* commandline: Add --is-valid option to query whether it's syntactically complete

This means querying when the commandline is in a state that it could
be executed. Because our `execute` bind function also inserts a
newline if it isn't.

One case that's not handled right now: `execute` also expands
abbreviations, those can technically make the commandline invalid
again.

Unfortunately we have no real way to *check* without doing the
replacement.

Also since abbreviations are only available in command position when
you _execute_ them the commandline will most likely be valid.

This is enough to make transient prompts work:

```fish
function reset-transient --on-event fish_postexec
    set -g TRANSIENT 0
end

function maybe_execute
    if commandline --is-valid
        set -g TRANSIENT 1
        commandline -f repaint
    else
        set -g TRANSIENT 0
    end
    commandline -f execute
end

bind \r maybe_execute
```

and then in `fish_prompt` react to $TRANSIENT being set to 1.
2021-08-14 11:29:22 +02:00
..
cmds commandline: Add --is-valid option (#8142) 2021-08-14 11:29:22 +02:00
python_docs_theme docs: Remove background from pygments 2021-07-30 18:36:12 +02:00
commands.rst We no longer have two doc systems, move sphinx_doc_src back to doc_src 2020-02-19 17:00:35 -08:00
completions.rst docs: Replace all internal links with :ref:s 2021-03-26 19:32:14 +01:00
conf.py docs: Remove lAtEx thing again 2021-07-14 17:03:41 +02:00
design.rst Make rationale spacing consistent 2020-10-12 20:25:35 +02:00
faq.rst docs: Made the abort/edit history feature more discoverable. 2021-07-03 16:39:32 +02:00
fish_for_bash_users.rst docs: Fix a label 2021-07-27 18:49:34 +02:00
fish_indent_lexer.py Highlight keywords differently 2021-02-07 21:18:51 +01:00
index.rst doc: Some more rewordings 2021-07-23 18:00:57 +02:00
interactive.rst docs: Document that commands with space will be kept until the next 2021-08-01 14:01:49 +02:00
language.rst docs: Remove stuff from globbing 2021-08-11 18:42:21 +02:00
license.rst Update copyright years 2021-05-03 13:12:11 +02:00
relnotes.rst docs: call the CHANGELOG "release notes" 2021-02-25 22:46:24 +08:00
tutorial.rst docs: Add some links 2021-07-16 18:08:55 +02:00