├── LICENSE ├── README.md └── conf.d └── local-config.fish /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Justin Hileman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 |
6 |
7 | 8 | 9 | # local-config 10 | 11 | Local configuration plugin for [Oh My Fish][omf-link]. 12 | 13 | Support per-user, per-host and per-platform custom configuration files. 14 | 15 | 16 | ## Install 17 | 18 | ```fish 19 | $ omf install local-config 20 | ``` 21 | 22 | 23 | ## Usage 24 | 25 | Upon installation or loading, local-config automatically loads custom configuration files for the current user, host and platform. It'll even generate them if they're missing! 26 | 27 | Use these for any custom configuration that should only run for a specific machine, operating system or user: 28 | 29 | ``` 30 | $OMF_CONFIG/users/strongbad.fish 31 | $OMF_CONFIG/hosts/lappy486.fish 32 | $OMF_CONFIG/platforms/Linux.fish 33 | ``` 34 | 35 | Additionally, you can add per-user, per-host and per-platform functions and completions: 36 | 37 | ``` 38 | $OMF_CONFIG/users/strongbad/functions/beleted.fish 39 | $OMF_CONFIG/hosts/lappy486/completions/beleted.fish 40 | ``` 41 | 42 | 43 | # License 44 | 45 | [MIT][mit] © [Justin Hileman][author] et [al][contributors] 46 | 47 | 48 | [mit]: http://opensource.org/licenses/MIT 49 | [author]: http://github.com/bobthecow 50 | [contributors]: https://github.com/oh-my-fish/plugin-local-config/graphs/contributors 51 | [omf-link]: https://www.github.com/oh-my-fish/oh-my-fish 52 | 53 | [license-badge]: https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square 54 | -------------------------------------------------------------------------------- /conf.d/local-config.fish: -------------------------------------------------------------------------------- 1 | set -l host (hostname | sed -E 's/(-[0-9]+)?(\.(local|home))?$//') 2 | set -l user (whoami) 3 | set -l platform (uname -s) 4 | 5 | # Load custom settings for current hostname 6 | set -l host_specific_file $OMF_CONFIG/hosts/$host.fish 7 | if test -f $host_specific_file 8 | source $host_specific_file 9 | else 10 | echo Creating host specific config file: $host_specific_file 11 | mkdir -p (dirname $host_specific_file) 12 | touch $host_specific_file 13 | end 14 | 15 | # Load custom settings for current user 16 | set -l user_specific_file $OMF_CONFIG/users/$user.fish 17 | if test -f $user_specific_file 18 | source $user_specific_file 19 | else 20 | echo Creating user specific config file: $user_specific_file 21 | mkdir -p (dirname $user_specific_file) 22 | touch $user_specific_file 23 | end 24 | 25 | # Load custom settings for current OS 26 | set -l platform_specific_file $OMF_CONFIG/platforms/$platform.fish 27 | if test -f $platform_specific_file 28 | source $platform_specific_file 29 | else 30 | echo Creating platform specific config file: $platform_specific_file 31 | mkdir -p (dirname $platform_specific_file) 32 | touch $platform_specific_file 33 | end 34 | 35 | # Support current host, user and platform local config dirs 36 | set -l local_config_bundles $OMF_CONFIG/{hosts*/$host,users*/$user,platforms*/$platform} 37 | if [ "$local_config_bundles" ] 38 | require --no-bundle --path $local_config_bundles 39 | end 40 | --------------------------------------------------------------------------------