mirror of
https://github.com/oh-my-fish/oh-my-fish
synced 2024-11-03 15:40:32 +00:00
Merge pull request #245 from CodeFalling/master
new plugin:better alias
This commit is contained in:
commit
1068df1bb7
@ -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.
|
||||
|
16
plugins/better-alias/README.md
Normal file
16
plugins/better-alias/README.md
Normal file
@ -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)
|
11
plugins/better-alias/balias.fish
Normal file
11
plugins/better-alias/balias.fish
Normal file
@ -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…
Reference in New Issue
Block a user