Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command chaining #103

Merged
merged 4 commits into from
Aug 24, 2019
Merged

Command chaining #103

merged 4 commits into from
Aug 24, 2019

Conversation

karlch
Copy link
Owner

@karlch karlch commented Aug 17, 2019

This allows chaining multiple commands using &&.

Useful examples:

# Write the current image to disk and quit, aliased to wq
:write && quit
# In case the statusbar is usually visible, this hides the statusbar for fullscreen mode
:fullscreen && set statusbar.show!

Aliasing to chained commands is possible even recursively. Unfortunately the alias tag-open is still not very useful as the remaining argument, namely the tag NAME, would require to be in the middle of the alias (tag-load NAME && open %m) which is not supported by simple aliases.

fixes #73

karlch added 4 commits August 17, 2019 20:46
It is now possible to chain multiple commands using '&&', e.g.
```
:tag-load my_tag && open %m
:write && quit
```

If any part fails, the following parts are not executed.
This allows defining aliases such as ``wq`` for ``write && quit``.
The alias is now only applied once all the splitting has been completed.
This ensures that aliases which match others in part are not replaced
preliminary.

Consider, e.g.  ``:q && quack`` where
``q`` is an alias for ``quit`` and
``quack`` is an alias for ``nop``.

Before this would have been expanded to ``:quit && quituack`` in a first
step destroying the second alias. This is now fixed by recursively
splitting and expanding all the aliases until there is no more separator
and alias left.
@karlch karlch merged commit ed2b0b9 into master Aug 24, 2019
@karlch karlch deleted the command_chaining branch August 24, 2019 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command chaining
1 participant