https://github.com/roguh/tryalias
Aliases with fallbacks. `tryalias openpdf "zathura --fork" evince mupdf-x11 mupdf openoffice gimp reader10.exe`
https://github.com/roguh/tryalias
Last synced: about 1 month ago
JSON representation
Aliases with fallbacks. `tryalias openpdf "zathura --fork" evince mupdf-x11 mupdf openoffice gimp reader10.exe`
- Host: GitHub
- URL: https://github.com/roguh/tryalias
- Owner: roguh
- Created: 2018-02-19T16:21:01.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2021-09-08T05:27:59.000Z (almost 5 years ago)
- Last Synced: 2025-01-26T04:42:01.679Z (over 1 year ago)
- Language: Shell
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tryalias
`tryalias openpdf "zathura --fork" evince mupdf-x11 mupdf openoffice gimp reader10.exe`
Aliases with fallbacks.
The `tryalias` command works like `alias`, but it sequentially checks
each of its multiple arguments until it finds a valid command.
If no argument is found, alias the first argument to the last argument.
## Installation
### fish
Place your tryalias commands in `~/.aliases`.
Copy `tryalias.fish` to `~/.config/fish/functions/` and source `~/.aliases`
in your `config.fish`. See `config.fish-sample`.
### bash or zsh
Place your tryalias commands in `~/.aliases`.
```
$ cp .tryalias ~
$ cat bashrc-sample >> ~/.bashrc
```
### csh
Place your tryalias commands in `~/.aliases`.
In csh, `tryalias` is an alias for `alias`.
See `cshrc-sample`.
## Usage
```
tryalias please sudo
# Use previously defined aliases
tryalias exa "exa --git"
tryalias l "exa -Fa" "ls -Fa"
tryalias ll "l -lh"
# Confirm overwrites and deletions
tryalias mv "mv -i"
tryalias cp "cp -i"
tryalias rm "rm -i"
# PDF reader
tryalias e "zathura --fork" evince mupdf-x11 mupdf
# Favorite editor?
tryalias v vis nvim vim vi elvis ex-vi nano ed gedit libreoffice openoffice "playonlinux --run 'Microsoft Powerpoint 2010'"
# Start emacs with CLI
tryalias em "emacs -nw"
# Start emacs client. Start daemon if its not running.
tryalias emc "emacsclient -nw --alternate-editor="""
```