From ef1521f5531209a20023f225d7246a7eb31dd466 Mon Sep 17 00:00:00 2001 From: Rubem Pacelli Date: Mon, 4 Dec 2023 03:48:37 -0300 Subject: [PATCH] Update cheatsheet_syntax.md --- docs/cheatsheet_syntax.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/docs/cheatsheet_syntax.md b/docs/cheatsheet_syntax.md index ace9df6..7e9173f 100644 --- a/docs/cheatsheet_syntax.md +++ b/docs/cheatsheet_syntax.md @@ -142,3 +142,42 @@ cat $ jsons: find . -iname '*.json' -type f -print --- --multi --expand ``` +### Aliases + +**navi** doesn't have support for aliases as first-class citizens at the moment. + +However, it is trivial to create aliases using **navi** + a few conventions. + +For example, suppose you decide to end some of your commands with `:: `: + +```bash +% aliases + +# This is one command :: el +echo lorem ipsum + +# This is another command :: ef +echo foo bar +``` + +Then, if you use **navi** as a [shell scripting tool](shell_scripting.md), you could add something similar to this in your `.bashrc`-like file: + +```bash +navialias() { + navi --query ":: $1" --best-match +} + +alias el="navialias el" +alias ef="navialias ef" +``` + +If you don't want to use these conventions, you can even add full comments in your aliases: + +```bash +navibestmatch() { + navi --query "$1" --best-match +} + +alias el="navibestmatch 'This is one command'" +alias ef="navibestmatch 'This is another command'" +```