Merge `$OMF_CONFIG` and `$OMF_CUSTOM`.

Per conversation with @bpinto in Gitter.

There's no need for two separate directories. You don't have a `.git` and `.git-custom` folder, you just put your config in `.git` :)

The most straightforward interpretation of XDG basedir spec is that user configuration for omf would go in `~/.config/omf`, so let's put it there. The only question is whether omf-generated config (i.e. the `theme` file) should go there as well. By analogy with git, programmatically generated config should probably be merged in with user config. This also makes it so when a user clones their dotfiles to a new machine, both kinds of settings come with it.
pull/2/head
Justin Hileman 9 years ago
parent e116608c01
commit 0359ba047c

@ -41,11 +41,11 @@ There are roughly 3 kinds of packages:
+ Autoload installed packages and themes under `$OMF_PATH/`.
+ Autoload your custom path. `$OMF_PATH/custom` by default, but configurable via `$OMF_CUSTOM`.
+ Autoload your config path. `~/.config/omf` by default, but configurable via `$OMF_CONFIG`.
+ Autoload any `functions` directory under `$OMF_PATH` and `$OMF_CUSTOM`
+ Autoload any `functions` directory under `$OMF_PATH` and `$OMF_CONFIG`
+ Run `$OMF_CUSTOM/init.fish` if available.
+ Run `$OMF_CONFIG/init.fish` if available.
## How can I upgrade from an existing Oh My Fish installation?

@ -107,7 +107,7 @@ Remove a theme or package.
Scaffold out a new package or theme.
> This creates a new directory under `$OMF_CUSTOM/{pkg | themes}/` with a template.
> This creates a new directory under `$OMF_CONFIG/{pkg | themes}/` with a template.
## `omf submit` _`pkg/<name>`_ _`[<url>]`_
@ -135,9 +135,9 @@ Uninstall Oh My Fish. See [uninstall](#uninstall) for more information.
## Startup
This script runs each time a new session begins, autoloading packages, themes and your _custom_ path (dotfiles) in that order.
This script runs each time a new session begins, autoloading packages, themes and your _config_ path in that order.
The _custom_ path (`$HOME/.dotfiles` by default) is defined by `$OMF_CUSTOM` in `$HOME/.config/fish/config.fish`. Modify this to load your own dotfiles if you have any.
The _config_ path (`~/.config/omf` by default) is defined by `$OMF_CONFIG` in `~/.config/fish/config.fish`. Modify this to load your own configuration if you have any.
## Core Library

@ -3,7 +3,7 @@
# USAGE
# #1: curl -L git.io/omf | sh
# #2: curl -L git.io/omf > install && chmod +x install && ./install
# #3: OMF_CUSTOM=~/.dotfiles curl -L git.io/omf | sh
# #3: OMF_CONFIG=~/.omf curl -L git.io/omf | sh
#
# ENV
# XDG_DATA_HOME Base directory (~/.local/share)
@ -14,7 +14,6 @@
#
# OMF_PATH Oh My Fish directory
# OMF_CONFIG Oh My Fish configuration
# OMF_CUSTOM Custom dotfiles directory
#
# OMF_REPO_URI Source git repository
# OMF_REPO_BRANCH Source repository default branch (master)
@ -25,11 +24,10 @@
# omf_create_fish_config <path/to/fish.config>
# omf_install
test -z ${XDG_DATA_HOME+_} && XDG_DATA_HOME="${HOME}/.local/share"
test -z ${XDG_CONFIG_HOME+_} && XDG_CONFIG_HOME="${HOME}/.config"
test -z ${XDG_DATA_HOME+_} && XDG_DATA_HOME="${HOME}/.local/share"
test -z ${XDG_CONFIG_HOME+_} && XDG_CONFIG_HOME="${HOME}/.config"
test -z ${OMF_PATH+_} && OMF_PATH="${XDG_DATA_HOME}/omf"
test -z ${OMF_CUSTOM+_} && OMF_CUSTOM="${HOME}/.dotfiles"
test -z ${OMF_CONFIG+_} && OMF_CONFIG="${XDG_CONFIG_HOME}/omf"
test -z ${OMF_REPO_URI+_} && OMF_REPO_URI="https://github.com/fish-shell/omf"
@ -96,7 +94,6 @@ omf_install() {
echo "set -g OMF_PATH $(echo "${OMF_PATH}" | sed -e "s|$HOME|\$HOME|")" > ${fish_config_file}
echo "set -g OMF_CUSTOM $(echo "${OMF_CUSTOM}" | sed -e "s|$HOME|\$HOME|")" >> ${fish_config_file}
echo "set -g OMF_CONFIG $(echo "${OMF_CONFIG}" | sed -e "s|$HOME|\$HOME|")" >> ${fish_config_file}
echo "source \$OMF_PATH/init.fish" >> ${fish_config_file}

@ -6,18 +6,18 @@
# RESET_PATH Original $PATH preseved across Oh My Fish refreshes.
# OMF_PATH Set in ~/.config/fish/config.fish
# OMF_IGNORE List of packages to ignore.
# OMF_CUSTOM Same as OMF_PATH. ~/.dotfiles by default.
# OMF_CONFIG Same as OMF_PATH. ~/.config/omf by default.
#
# OVERVIEW
# + Autoload Oh My Fish packages, themes and custom path
# + For each <pkg> inside {$OMF_PATH,$OMF_CUSTOM}
# + Autoload Oh My Fish packages, themes and config path
# + For each <pkg> inside {$OMF_PATH,$OMF_CONFIG}
# + Autoload <pkg> directory
# + Source <pkg>.fish
# + Emit init_<pkg> event
#
# + Autoload {$OMF_PATH,$OMF_CUSTOM}/functions
# + Source {$OMF_PATH,$OMF_CUSTOM}fish-shell/fish-shell/issues/845
# + Source $OMF_CUSTOM/init.fish
# + Autoload {$OMF_PATH,$OMF_CONFIG}/functions
# + Source {$OMF_PATH,$OMF_CONFIG}fish-shell/fish-shell/issues/845
# + Source $OMF_CONFIG/init.fish
if set -q RESET_PATH
set PATH $RESET_PATH
@ -31,24 +31,24 @@ set -q OSTYPE; or set -g OSTYPE (uname)
set -l user_function_path $fish_function_path[1]
set fish_function_path[1] $OMF_PATH/lib
set -l theme {$OMF_PATH,$OMF_CUSTOM}/themes/(cat $OMF_CONFIG/theme)
set -l theme {$OMF_PATH,$OMF_CONFIG}/themes/(cat $OMF_CONFIG/theme)
set -l paths $OMF_PATH/pkg/*
set -l custom $OMF_CUSTOM/pkg/*
set -l config $OMF_CONFIG/pkg/*
set -l ignore $OMF_IGNORE
for path in $paths
set custom $OMF_CUSTOM/(basename $path) $custom
set config $OMF_CONFIG/(basename $path) $config
end
for path in $OMF_PATH/lib $OMF_PATH/lib/git $paths $theme $custom
for path in $OMF_PATH/lib $OMF_PATH/lib/git $paths $theme $config
contains -- (basename $path) $ignore; and continue
autoload $path $path/completions
source $path/(basename $path).fish
and emit init_(basename $path) $path
end
autoload $OMF_CUSTOM/functions
autoload $OMF_CONFIG/functions
autoload $user_function_path
source {$OMF_PATH,$OMF_CUSTOM}/events.fish
source $OMF_CUSTOM/init.fish
source {$OMF_PATH,$OMF_CONFIG}/events.fish
source $OMF_CONFIG/init.fish

@ -7,10 +7,6 @@ function omf_destroy -d "Remove Oh My Fish"
mv "$HOME/.config/fish/config".{copy,fish}
end
if test (basename "$OMF_CONFIG") = "omf"
rm -rf "$OMF_CONFIG"
end
if test "$OMF_PATH" != "$HOME"
rm -rf "$OMF_PATH"
end

@ -1,6 +1,6 @@
# List all packages available to install from the registry.
function omf_list_db_packages
for item in (basename $OMF_PATH/db/pkg/*)
contains $item (basename {$OMF_PATH,$OMF_CUSTOM}/pkg/*); or echo $item
contains $item (basename {$OMF_PATH,$OMF_CONFIG}/pkg/*); or echo $item
end
end

@ -1,6 +1,6 @@
# List all custom packages and packages installed from the registry.
function omf_list_local_packages
for item in (basename {$OMF_PATH,$OMF_CUSTOM}/pkg/*)
for item in (basename {$OMF_PATH,$OMF_CONFIG}/pkg/*)
test $item = omf; or echo $item
end
end

@ -1,7 +1,7 @@
function omf_list_themes
set -l seen ""
for theme in (basename $OMF_PATH/db/themes/*) \
(basename {$OMF_PATH,$OMF_CUSTOM}/themes/*)
(basename {$OMF_PATH,$OMF_CONFIG}/themes/*)
contains $theme $seen; or echo $theme
set seen $seen $theme
end

@ -28,7 +28,7 @@ function omf_new -a option name
echo (omf::em)"Switched to $dir"(omf::off)
else
echo (omf::err)"\$OMF_CUSTOM and/or \$OMF_PATH undefined."(omf::off) 1^&2
echo (omf::err)"\$OMF_CONFIG and/or \$OMF_PATH undefined."(omf::off) 1^&2
exit $OMF_UNKNOWN_ERR
end
end

@ -1,5 +1,5 @@
function omf_theme
if not test -e $OMF_CUSTOM/themes/$argv[1]
if not test -e $OMF_CONFIG/themes/$argv[1]
if not test -e $OMF_PATH/themes/$argv[1]
set -l theme $OMF_PATH/db/themes/$argv[1]
if test -e $theme

@ -1,10 +1,10 @@
function omf_util_mkdir -a name
set -l name "$argv[1]"
if test -d "$OMF_CUSTOM"
set name "$OMF_CUSTOM/$name"
if test -d "$OMF_CONFIG"
set name "$OMF_CONFIG/$name"
else if test -d "$OMF_PATH"
set name "$OMF_PATH/$name"
end
mkdir -p "$name"
echo $name
end
end

Loading…
Cancel
Save