Before this fix, `function -a arg1 name1` would produce a
function named 'arg1'. After this fix, it will produce a
function named 'name'. See #2068 for more.
When declaring a function using the function "function", the options must follow, not precede, the function name.
The examples demonstrate this syntax, but the synopsis previously showed the options preceding the name.
In FAQ:
> I'm seeing weird output before each prompt when using screen. What's wrong?
The command provided is
echo 'function fish_title;end' > ~/.config/fish/config.fish
Using `>` will overwrite current config.fish.
We should use `>>` instead.
With the fix for #365, fish_command_not_found event handlers
receive the command and all of its arguments. But commands
like /usr/lib/command-not-found expect only the command name.
So when invoking an external command, just pass the command
name, not all of the arguments.
Before running a command, we add the command to history, so
that if the command causes us to exit it's still captured in
history. But that command should not be considered part of
history when expanding the history within the command itself.
For example, `echo $history[1]` should be the previously
run command, not `echo $history[1]` itself.
Fixes#2028
For the case
```
bind \et "commandline -i 1" "commandline -i 2"
```
the order of execution of the commands is now in-order.
Note that functions codes are prepended to the queue in reverse order, so they
will be executed in-order. This should allow all bindings of the form
```
bind \et beginning-of-line force-repaint
```
to remain unchanged.
Using builtin `commandline -f`, one would expect to have commands executed in
the order that they were given. This motivates the change to a queue.
Unfortunately, fish internals still need lookahead_list to act as a stack. Add
and rename functions to support both cases and have lookahead_list as
a std::deque internally.
This code is delicate, and we should probably dog-food this in nightly for
a while before the next-minor release.
Fixes#1567
Examples that work as expected (even completions don't get confused):
$ begin true; end;
$ begin if true; end; end
$ begin if true; echo hi; end
The last example correctly expects another 'end' to match 'begin'.
Fixes#1248.