Oh-my-fish: Where do I put my custom configuration?

Created on 28 Jul 2016  路  4Comments  路  Source: oh-my-fish/oh-my-fish

Oh my zsh export here. In zsh, all configuration was done in .zshrc or sourced from .zshrc.

For oh my fish, I'm not sure where to put my custom config.

I'd like to have an aliases file, similar to this one: https://github.com/calebmeyer/dotfiles/blob/master/aliases.zsh

I'd like to have a custom functions file where I define useful helpers.

I'd also like to customize the path and have the changes stick for new shells.

Where is the recommended place to put these in oh my fish? Should I edit ~/.config/fish/config.fish? Should I create a package for all my stuff? Should I create files in $OMF_CONFIG?

Is it possible to do this in a way that I can re-install all my configuration on a new computer from my dotfiles repo easily?

Finally, can we update the docs to point this out to new people better?

question

Most helpful comment

@calebmeyer The canonical place to put OMF configuration is in $OMF_CONFIG/init.fish. It is sourced at the beginning of every terminal, so it is an ideal location to customize paths and such. You can also put these things in ~/.config/fish/config.fish, but be aware that the order of things in that file can affect whether you have access to your plugins and functions yet or not. For Fish 2.3.0 when the new install setup is released (soon!), this will no longer be an issue and config.fish can be used freely.

init.fish is already described in the readme here.

A Fish-ism you should be aware of that differs from ZSH is that the recommended way to define functions / aliases is with function autoloading. Typically this means putting your functions in individual files in either $OMF_CONFIG/functions or ~/.config/fish/functions.

Should I create a package for all my stuff?

I don't except for specific functions that are portable and generic and I think others might want to use. I know some people who do turn everything into packages, even if they are private. It's all up to personal preference.

Is it possible to do this in a way that I can re-install all my configuration on a new computer from my dotfiles repo easily?

Sure. Most OMF users I know just put all of $OMF_CONFIG into their dotfiles collection, which can by symlinked to the proper location to easily carry over your dotfiles. I do this myself so that my $OMF_CONFIG directory always stays in sync between my personal and work laptops.

Finally, can we update the docs to point this out to new people better?

Some of this isn't OMF-specific, but we could definitely add a section to the readme about $OMF_CONFIG/functions.

All 4 comments

@calebmeyer The canonical place to put OMF configuration is in $OMF_CONFIG/init.fish. It is sourced at the beginning of every terminal, so it is an ideal location to customize paths and such. You can also put these things in ~/.config/fish/config.fish, but be aware that the order of things in that file can affect whether you have access to your plugins and functions yet or not. For Fish 2.3.0 when the new install setup is released (soon!), this will no longer be an issue and config.fish can be used freely.

init.fish is already described in the readme here.

A Fish-ism you should be aware of that differs from ZSH is that the recommended way to define functions / aliases is with function autoloading. Typically this means putting your functions in individual files in either $OMF_CONFIG/functions or ~/.config/fish/functions.

Should I create a package for all my stuff?

I don't except for specific functions that are portable and generic and I think others might want to use. I know some people who do turn everything into packages, even if they are private. It's all up to personal preference.

Is it possible to do this in a way that I can re-install all my configuration on a new computer from my dotfiles repo easily?

Sure. Most OMF users I know just put all of $OMF_CONFIG into their dotfiles collection, which can by symlinked to the proper location to easily carry over your dotfiles. I do this myself so that my $OMF_CONFIG directory always stays in sync between my personal and work laptops.

Finally, can we update the docs to point this out to new people better?

Some of this isn't OMF-specific, but we could definitely add a section to the readme about $OMF_CONFIG/functions.

@coderstephen thanks for your quick response! Do you recommend the funced and funcsave functions? Or should I just start creating files in the $OMF_CONFIG/functions directory?

@calebmeyer I would just start making files in $OMF_CONFIG/functions -- then you can use a nicer editor. funced is mostly good for one-liners I find.

If you would like to see an example, you can check out my OMF config directory in my own dotfiles: https://github.com/coderstephen/dotfiles/tree/master/omf

I keep forgetting how readable fish scripts are. I'm totally stealing your install script, that's awesome!

I'm closing this issue, you've more than answered my questions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pydo picture pydo  路  6Comments

Ramblurr picture Ramblurr  路  4Comments

kaelumania picture kaelumania  路  6Comments

adrianObel picture adrianObel  路  6Comments

quenode picture quenode  路  6Comments