Hi Robert,
Fish autoloading does not work entirely the way you expect it to. If you
execute the command `git`, fish will look for a
$fish_function_path/git.fish file and source it. Fish assumes this has
defined a `git` function that can now be executed the regular way. But your
example file named git.fish does not contain a function named `git`. So to
use autoloading, you should put your `git_is_dirty` function in
git_is_dirty.fish, and `git_branch_name` in git_branch_name.fish. Or else
if that organization doesn't suit your needs you have do what you're doing
now and put them in a file you load explicitly from config.fish.
But there have been other people with similar misunderstandings about fish
autoloading, so perhaps this should be made more clear in the docs.
Jan
On 18 February 2013 20:50, Robert Carpenter rob...@robacarp.com wrote:
Hello all,
Little bit by little bit I've been porting bash functions from my bash
workflow over to fish functions and have had great success, with one
caveat. I haven't been able to get fish to autoload files from the
functions/ directory at all. For now I'm just stashing everything in the
.config/fish/fish.config file and it all works fine. Eventually though,
I'd like to have my functions broken out in a better organized scheme like
.config/fish/functions/git_commands.fish etc.
I spent some time searching through the mailing list and the github issue
tracker and wasn't able to find any solution that worked for me, as the
only similar problem was solved by updating to fish 1.21 and I am already
on fish 2.0.
As an example, I've copied out a few functions from the readymade prompts
from the web config into a .fish file which will not load at startup.
The command sequence below seems like I've explored all the options, but I
could very well be missing something.
Any suggestions are appreciated, for until then I am putting everything in
my fish.config.
Thanks
Robert
robert@Rapha ~ uname
Darwin
robert@Rapha ~ echo $fish_function_path
/Users/robert/.config/fish/functions /usr/local/etc/fish/functions
/usr/local/share/fish/functions
robert@Rapha ~ fish --version
fish, version 2.0.0
robert@Rapha ~ ls -la .config/fish/functions
total 32
drwxr-xr-x 4 robert staff136 Feb 18 12:05 .
drwxr-xr-x 7 robert staff238 Feb 18 12:32 ..
-rwxr-xr-- 1 robert staff224 Feb 18 12:05 git.fish
robert@Rapha ~ cat .config/fish/functions/git.fish
function git_is_dirty
echo (git status -s --ignore-submodules=dirty) ^/dev/null
end
function git_branch_name
echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end
robert@Rapha ~ git_branch_name
fish: Unknown command 'git_branch_name'
robert@Rapha ~ . ~/.config/fish/functions/git.fish
robert@Rapha ~ git_branch_name
master
--
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly
thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now.
http://goparallel.sourceforge.net/
___
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users
--
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/___
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users