commit
1068df1bb7
@ -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…
Reference in New Issue