From 4ef15b5f8020a3f51d346d24c245d2956d7e3bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Sat, 1 Aug 2020 14:11:26 +0200 Subject: [PATCH] docs/alias: simplify the 'persistent' section, using --save (#2285) All the workarounds using `config` aren't necessary anymore. Only `config path` is still of interest. --- docs/commands/alias.md | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/docs/commands/alias.md b/docs/commands/alias.md index 292e748678..a169ef4d7f 100644 --- a/docs/commands/alias.md +++ b/docs/commands/alias.md @@ -6,7 +6,7 @@ Syntax: `alias {flags} [] {}` The command expects three parameters: -* The name of alias +* The name of the alias * The parameters as a space-separated list (`[a b ...]`), can be empty (`[]`) * The body of the alias as a `{...}` block @@ -51,30 +51,15 @@ flags: ## Persistent aliases -Aliases are most useful when they are persistent. For that, add them to your startup config: +Aliases are most useful when they are persistent. For that, use the `--save` flag: ```shell -> config set startup ["alias myecho [msg] { echo $msg }"] +> alias --save myecho [msg] { echo $msg } ``` -This is fine for the first alias, but since it overwrites the startup config, you need a different approach for additional aliases. - -To add a 2nd alias: +This will store the alias in your config, under the `startup` key. To edit the saved alias, run it again with the same name, or edit your config file directly. You can find the location of the file using `config path`. +For example, to edit your config file in `vi`, run: ```shell -> config get startup | append "alias s [] { git status -sb }" | config set_into startup -``` - -This first reads the `startup` config (a table of strings), then appends another alias, then sets the `startup` config with the output of the pipeline. - -To make this process easier, you could define another alias: - -```shell -> alias addalias [alias-string] { config get startup | append $alias-string | config set_into startup } -``` - -Then use that to add more aliases: - -```shell -> addalias "alias s [] { git status -sb }" +> vi $(config path) ```