On Tue, Mar 30, 2010 at 3:48 PM, David Frascone <[email protected]> wrote:
> Ok -- let's start slow -- my aliases need to be recreated -- which is fine.

It's better to write functions than use "alias". "alias" is a sort of
a crutch; in Fish, it's a function that creates a simple function for
you, but functions in general are more powerful than "aliases".

> I set the alias 'vi' to either be vim, or mvim depending on if I'm on my
> mac, or shelled into a linux box.  But, the "type" command does not seem to
> do what I think it should:
>
> codemon...@daves-mbp ~/.c/fish> type vi
>  -- type -Q -o tpPafh -- vi
> type: Could not find 'vi'
> codemon...@daves-mbp ~/.c/fish> vi
> codemon...@daves-mbp ~/.c/fish> type fg
>  -- type -Q -o tpPafh -- fg
> fg is a builtin

Do these problems occur on Linux or only on MacOS? type, which and
alias work on my standard install of Fish 1.23.1 on Linux:

~> type type
type is a builtin
~> type vi
vi is /usr/bin/vi
~> type which
which is /usr/bin/which
~> type alias
alias is a function with definition
[...]
~> which vi
/usr/bin/vi
~> alias vi=vim
~> type vi
vi is a function with definition
function vi
        vim $argv
end
~> alias hello vi
~> type hello
hello is a function with definition
function hello
        vi $argv
end


> codemon...@daves-mbp ~/.c/fish> alias
> alias: Expected one or two arguments, got 0
> codemon...@daves-mbp ~/.c/fish> alias vi
> fish: Array index out of bounds
> /usr/local/share/fish/functions/alias.fish (line 19):             set body
> $tmp[2]
>
> ^
> in function 'alias',
>     called on standard input,
>     with parameter list 'vi'

Feel free to extend the "alias" function with these features:
1. Handling the case when there are no arguments
2. Querying for an alias. You could simply call the "functions" builtin here.

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to