mirror of
https://github.com/denisidoro/navi
synced 2024-11-25 13:00:20 +00:00
Add doc for aliases (#408)
This commit is contained in:
parent
fa08d58706
commit
5b9831e1a0
2 changed files with 41 additions and 0 deletions
|
@ -50,6 +50,7 @@ There are multiple ways to use **navi**:
|
||||||
- pros: you have access to all possible subcommands and flags
|
- 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
|
- 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
|
- 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 a [shell scripting tool](docs/shell_scripting.md)
|
||||||
- as an [Alfred workflow](docs/alfred.md)
|
- as an [Alfred workflow](docs/alfred.md)
|
||||||
|
|
||||||
|
|
40
docs/aliases.md
Normal file
40
docs/aliases.md
Normal file
|
@ -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 `:: <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="navibastmatch 'This is one command'"
|
||||||
|
alias ef="navibastmatch 'This is another command'"
|
||||||
|
```
|
Loading…
Reference in a new issue