diff options
author | Rubem Pacelli <rubem.engenharia@gmail.com> | 2023-12-04 03:48:37 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-04 03:48:37 -0300 |
commit | ef1521f5531209a20023f225d7246a7eb31dd466 (patch) | |
tree | 33824db5a42892a18362d2fd2ed1ae93d7891b6c | |
parent | fdc5603278016cab01074909fb4507411011e012 (diff) |
Update cheatsheet_syntax.md
-rw-r--r-- | docs/cheatsheet_syntax.md | 39 |
1 files changed, 39 insertions, 0 deletions
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> $ 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 `:: <some_alias>`: + +```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'" +``` |