new plugin:better alias

pull/2/head
CodeFalling 10 years ago
parent fdf3793b60
commit 691a9a2bc9

@ -2,6 +2,7 @@
* __android-sdk__ [Android SDK](http://developer.android.com/sdk/index.html) integration.
* __archlinux__ Provides a number of plugins to make using Arch Linux easier.
* __autojump__ Makes navigating filesystem much faster. See [autojump article](https://github.com/joelthelion/autojump/wiki) and [video](https://www.youtube.com/watch?v=tnNyoMGnbKg). Bindings only, autojump needs to be installed separately.
* __better-alias__ - Provide alias with auto completion.
* __brew__ [Homebrew](http://brew.sh/) integration.
* __bundler__ Use Ruby's [Bundler](http://bundler.io/) automatically for some commands.
* __ccache__ Enable [ccache](http://ccache.samba.org/) to speed up compilation.

@ -0,0 +1,16 @@
# A better alias provide completion
Use `balias` instead of `alias`,you can get same completion meanwhile you set alias.
# Example
```
balias apti 'sudo apt-get install'
balias gc 'git checkout'
```
Then,you will get
![apti](http://www.geekpics.net/images/2014/08/23/TJn6kfBY.png)
![gc](http://www.geekpics.net/images/2014/08/23/655x76xcPJolvxqra.png.pagespeed.ic.4S9hgPfZ53.png)

@ -0,0 +1,11 @@
function balias --argument alias command
eval 'alias $alias $command'
if expr match $command '^sudo '>/dev/null
set command (expr substr + $command 6 (expr length $command))
end
complete -c $alias -xa "(
set -l cmd (commandline -pc | sed -e 's/^ *\S\+ *//' );
complete -C\"$command \$cmd\";
)"
end
Loading…
Cancel
Save