diff --git a/README.md b/README.md index cbce7a7..46bbfc1 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ There are multiple ways to use **navi**: - pros: you have access to all possible subcommands and flags - by invoking it via a [shell widget](docs/installation.md#installing-the-shell-widget) in the terminal - pros: the shell history is correctly populated (i.e. with the actual command you ran instead of `navi`) and you can edit the command as you wish before executing it +- as [aliases](docs/aliases.md) - as a [shell scripting tool](docs/shell_scripting.md) - as an [Alfred workflow](docs/alfred.md) diff --git a/docs/aliases.md b/docs/aliases.md new file mode 100644 index 0000000..32d7607 --- /dev/null +++ b/docs/aliases.md @@ -0,0 +1,40 @@ +Aliases +---------------------------- + +**navi** doesn't have support for aliases as first-class citizens at the moment. + +However, it should be 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="navibastmatch 'This is one command'" +alias ef="navibastmatch 'This is another command'" +``` \ No newline at end of file