• Stars
    star
    785
  • Rank 57,957 (Top 2 %)
  • Language
    Python
  • Created over 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An oh-my-zsh plugin to help remembering those aliases you defined once

alias-tips

Build Status

A Zsh plugin to help remembering those shell aliases and Git aliases you once defined.

Works with Oh My Zsh, Fig, zplug, antigen, zgen, Arch Linux, or pure Zsh.

It works by trying to find an shell or Git alias for the command you are currently executing and printing a help line reminding you about that alias.

The idea is that you might be too afraid to execute aliases defined because you can't remember them correctly, or just have forgotten about some aliases, or that aliases for your daily commands even exist.

Example

$ ls -lh
Alias tip: ll
:

$ git gui
Alias tip: gg
:

$ git rebase --interactive master
Alias tip: grbi master
:

$ git status
Alias tip: g st
:

Installation

Oh My Zsh

  1. Get it

    Go to your custom plugins folder:

    cd ${ZSH_CUSTOM1:-$ZSH/custom}/plugins

    Then either clone:

    git clone https://github.com/djui/alias-tips.git

    Or download:

    wget https://github.com/djui/alias-tips/archive/master.zip
    unzip master.zip && mv alias-tips-master alias-tips && rm master.zip

    Or add it as submodule:

    git submodule add https://github.com/djui/alias-tips
    git submodule update --init
  2. Include it

    Then add the plugin to your plugin list in oh-my-zsh configuration:

    $EDITOR ~/.zshrc
    
    # -plugins=(...)
    # +plugins=(... alias-tips)

Fig

Fig adds apps, shortcuts, and autocomplete to your existing terminal.

Install alias-tips in just one click.

zplug

  1. Add zplug "djui/alias-tips" to your .zshrc
  2. Install it with zplug install

Antigen

  1. Add antigen bundle djui/alias-tips to your .zshrc with your other antigen bundle commands.

zgen

  1. Add zgen load djui/alias-tips to your .zshrc
  2. Regenerate your init.zsh with zgen save

Arch Linux

  1. Install alias-tips-git from the AUR.

  2. Add the following to your .zshrc:

    source /usr/share/zsh/plugins/alias-tips/alias-tips.plugin.zsh
  3. Start a new terminal session.

Zsh

    1. Get it git clone https://github.com/djui/alias-tips.git ~/.zsh/alias-tips
  1. Add source alias-tips/alias-tips.plugin.zsh to your .zshrc.

Usage

After installation re-source your .zshrc.

Customizations

Customize the Output

The help string can be configured exporting an environment variable, e.g. in your .zshrc:

:
export ZSH_PLUGINS_ALIAS_TIPS_TEXT="Alias tip: "
:

Exclude some Aliases

A list of aliases to be excluded from being reminded of can be configured exporting an environment variable of space separated aliases, e.g. in your .zshrc:

:
export ZSH_PLUGINS_ALIAS_TIPS_EXCLUDES="_ ll vi"
:

Disable Command Expansion

If you have several alias, e.g. for different git commands the command get expanded before looking for an alias.

Example:

alias gRv='git remote -v'
alias gR='git remote'

Without the expand option gR -v will execute without a tip, with expand, it will suggest gRv.

If this may not be desired, the behaviour can be disabled by setting the environment variable, e.g. in your .zshrc:

:
export ZSH_PLUGINS_ALIAS_TIPS_EXPAND=0
:

Force Alias Use

If you want to force yourself to use the aliases you set you can enable this option through this environmental variable:

:
export ZSH_PLUGINS_ALIAS_TIPS_FORCE=1
:

This will cause alias-tips to abort the command you have entered if there exists an alias for it.

Reveal Command

If you want to reveal aliased command, e.g. to demonstrate your shell to someone else you can enable this option through this environmental variable:

:
export ZSH_PLUGINS_ALIAS_TIPS_REVEAL=1
:

Use this environmental variable to customize text:

:
export ZSH_PLUGINS_ALIAS_TIPS_REVEAL_TEXT="Alias tip: "
:

And this to exclude some obvious expansions:

:
export ZSH_PLUGINS_ALIAS_TIPS_REVEAL_EXCLUDES=(_ ll vi)
:

Limitations

  • Suffix and Global aliases are currently not supported. Only Prefix aliases ("command position") are supported. Check the Zsh manual on alias for their definition.
  • Multiline aliases (aliases which definition span multiple lines) are not supported. Currently their first line only will be used (likely incorrectly)

FAQ

Q: Why only Zsh?

A: This works because of feature in Zsh called preexec. Other shells, e.g. Bash, do not have this feature. There are workarounds[1,2] but integrating these is a task left for the reader.

Testing

$ python  -m unittest test_alias-tips
$ python3 -m unittest test_alias-tips

Contributing

See: CONTRIBUTIONS.md.

More Repositories

1

bashunit

xUnit unit testing framework for Bash scripts
Shell
42
star
2

UDBarTrackballItem

Objective-C
38
star
3

eraft

Raft reference implementation for Erlang
Erlang
31
star
4

docker-vbox-img

vbox-img Docker image
24
star
5

docker-ovftool

VMWare's ovftool Docker image
Dockerfile
19
star
6

nyancat

ASCII Nyancat animation
C
13
star
7

pdftitle

PDF article title extraction tool
Shell
12
star
8

erlang-neo4j-rest-api

Neo4j REST API client
Erlang
12
star
9

erlang-rest-client

Erlang REST Client
Erlang
11
star
10

ehf

Erlang Helper Functions
Erlang
10
star
11

diff-ss

Side-by-side diff
Python
10
star
12

qcast

InfoQ presentations podcast
HTML
9
star
13

json-query

A command-line tool (CLI) that evaluates a given query on a given JSON object string or the standard input
JavaScript
8
star
14

ascii

Terminal ASCII animation art
C
7
star
15

docker-guestfs

libguestfs-tools Docker image
7
star
16

dot-files

Some dot files as configuration in *nix
Emacs Lisp
6
star
17

EtherTeX

EtherTeX is a EtherPad editor with almost instance PDF result viewer
Objective-C
6
star
18

clj-otp

HOTP (rfc4226) & TOTP (rfc6238) Clojure API (fork of omarkj/cljotp)
Clojure
6
star
19

epub-tools

Tools for EPUB to Audiobook workflow
Python
6
star
20

dominance

Find dominant colors in an image
Clojure
5
star
21

stipe

Distributed message queue as pipe
Erlang
4
star
22

bleem

Erlang implementation of Bloom
4
star
23

mysore

A Hyder implementation in Erlang
Erlang
4
star
24

code-poster

Produce an image poster from a path of source files.
Go
4
star
25

go-funclen

Prints a list of all Go functions and their body length recursively in a given directory.
Go
4
star
26

stree

Draws a supervision tree given the registered supervisor name
Erlang
4
star
27

clojure.contrib.djui

Library of helper functions as extension to clojure in the spirit of clojure.contrib.
Clojure
3
star
28

kgist

A shameless snippet board clone of Github's Gist and pastebin.com
JavaScript
3
star
29

i2cssh

Multiterminal for iTerm2
Shell
3
star
30

iq

INI file query tool
Go
3
star
31

check-speech

Checks your scientific report for classic speech mistakes.
Python
3
star
32

saml-client

Python class to fetch a website behind a SAML2 SSO service conforming to the Shibboleth protocol.
Python
3
star
33

go-readinglist

Export Safari's ReadingList as list of URLs or JSON.
Go
2
star
34

compendencies

Compilation dependencies, lists files needed to compile an Erlang source file into beam code.
Erlang
2
star
35

iLeopard

iTunes like themes installer for Mac OS X 10.6
Objective-C
2
star
36

secret-tool

OS X port of Gnome's secret-tool (https://www.mankier.com/1/secret-tool)
Go
2
star
37

umf

2
star
38

erlang-wadl-stub

WADL Web Application Description Language stub generator
Erlang
2
star
39

docker-machine-doctor

A tool that helps debugging problems with docker-machine
Shell
2
star
40

bb

Erlang
2
star
41

spdyweb

Erlang SPDY toolkit
2
star
42

LFU

O(1) LFU cache implementation
Erlang
2
star
43

annotate

A command-line tool that annotates command output (standard output and standard error).
Go
2
star
44

Shobit

Shobit - Shopping list iOS app that learns your shopping habit of how you walk the store
Objective-C
2
star
45

erldocs_chrome_extensions

A Chrome/Chromium extension that gives [Erldocs](http://erldocs.com/) the [Erlang.org favicon](http://erlang.org/favicon.ico) for better recognition when an open Erldocs tab is pinned and you can't see its title.
JavaScript
2
star
46

pkg

Go standard library convenience extension.
Go
1
star
47

vsm

Vehicle state machine - A library for state transitions on an abstract vehicle with role permissions
Go
1
star
48

tipesso

Discover who to tip
Clojure
1
star
49

clj-sqrl

Clojure SQRL implementation
1
star
50

rebar-git-bug

1
star
51

stail

Streaming tail-f for Node.js
JavaScript
1
star
52

ENB

A toolbox for Naive Bayes Classifier written in Erlang
1
star
53

sportboard

A community platform to announce training times and places
JavaScript
1
star
54

djuio

URL Shortener done in NodeJS
JavaScript
1
star
55

brainbranch-legacy

Helps to remember your work tasks by not getting lost in the recursion maze.
JavaScript
1
star
56

oktane

oktane (Oldskool Keep Talking and Nobody Explodes) is an ASCII/ANSI implementation of the original game mechanics.
Go
1
star
57

DETSCask

A Mnesia backend implementation using Bitcask for disc_only_copies table access
1
star
58

InfoQ

InfoQ iOS app
Swift
1
star
59

sparkleshare

Repository for SparkleShare syncing
1
star
60

13th-secession

Vector redraw of the 13th Secession exhibition poster by Koloman Moser without the bottom textual part
1
star
61

kanimo

Klarna logo ASCII animation
C
1
star
62

mvp

Shows oldest installed iOS app by release/purchase date
Python
1
star
63

sendfile

Erlang sendfile() linked-in driver
C
1
star
64

docker-swift

A Docker image that allows using Apple's Swift to compile source files and use the REPL.
1
star