-
Notifications
You must be signed in to change notification settings - Fork 383
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 aliases #1800
Comments
For the shell command, how would you go about using |
For readability, this is not a good idea. Instead, we could change keymap.tomlShell commandsWe only need We can also specify which shell to use for running the script. keymap = [
{ on = "<C-t>", run_shell = 'echo "Hello world"', block = true, orphan = true, interactive = false, cursor = 1, shell = "fish" },
{ on = "<C-t>", run_shell = 'echo "Hello world"', block = true, orphan = true, interactive = false, cursor = 1 }, Built-in and custom pluginsUsing keymap = [
{ on = "<C-t>", run_plugin = 'smart-enter --foo "bar baz"' },
{ on = "<C-t>", run_plugin = 'hide-preview --foo "bar baz"', sync = true },
] Built-in Yazi CommandsWe can either keep it as keymap = [
{ on = "O", run = "open --interactive", desc = "Show task manager" },
{ on = "O", run_cmd = "open --interactive", desc = "Show task manager" },
] yazi.tomlOpener
|
This proposal aims to introduce the concept of command aliases to simplify existing
shell
andplugin
commands.Alias commands are treated as special command markers, with everything following the marker considered parameters for the actual command. This allows:
to be rewritten as:
Here, the
;
marker representsshell '...' --confirm
. Similarly, it enables:to be written as:
In this case, the
!
marker stands forplugin --sync ... --args='...'
, greatly simplifying command writing.Note that the
;
and!
markers are not final and require further discussion — such as whether to use;;
or!!
instead of a single character. Also, we need to determine which marker to use for commands likeshell --confirm 'ya pub dds-cd --str "/tmp"'
, one possible way is:We also need to consider a separate marker for async plugins, i.e., just
plugin
without--sync
.The text was updated successfully, but these errors were encountered: