mirror of
https://github.com/denisidoro/navi
synced 2025-02-16 12:38:28 +00:00
Update cheatsheet_syntax.md
This commit is contained in:
parent
fdc5603278
commit
ef1521f553
1 changed files with 39 additions and 0 deletions
|
@ -142,3 +142,42 @@ cat <jsons>
|
||||||
|
|
||||||
$ jsons: find . -iname '*.json' -type f -print --- --multi --expand
|
$ 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'"
|
||||||
|
```
|
||||||
|
|
Loading…
Add table
Reference in a new issue