Files
fish-shell/doc_src/cmds
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
..
2020-04-04 10:44:53 +02:00
2021-07-23 18:00:57 +02:00
2021-02-02 08:35:38 +01:00
2020-03-21 15:31:25 +01:00
2020-04-04 10:44:53 +02:00
2020-04-04 10:44:53 +02:00
2021-07-27 23:00:23 +02:00
2020-04-04 10:44:53 +02:00
2020-03-21 15:31:25 +01:00
2021-08-10 21:01:39 +02:00
2021-08-09 17:42:00 +02:00
2021-05-04 13:21:46 -07:00
2020-09-10 20:48:13 +02:00
2021-07-21 22:33:39 +02:00
2020-04-13 22:56:22 +02:00
2021-04-14 21:46:51 +02:00
2021-05-04 13:50:09 -07:00
2021-08-04 21:09:47 +02:00
2021-08-04 21:09:47 +02:00
2020-03-22 15:53:09 +01:00
2020-03-21 15:31:25 +01:00
2021-02-02 08:35:38 +01:00