2015-01-07 05:00:00 +00:00
|
|
|
# NAME
|
|
|
|
# import - load libraries, plugins, themes, etc.
|
|
|
|
#
|
|
|
|
# SYNOPSIS
|
|
|
|
# import <path/library>[<path/library>..]
|
|
|
|
#
|
|
|
|
# DESCRIPTION
|
|
|
|
# Import libraries, plugins, themes, completions. Prepend existing
|
|
|
|
# user custom/<library> directories to the path to allow users to
|
|
|
|
# override specific functions in themes/plugins.
|
|
|
|
#
|
|
|
|
# NOTES
|
|
|
|
# $fish_path and $fish_custom point to oh-my-fish home and the user
|
|
|
|
# dotfiles folder respectively. Both globals are usually configured
|
2015-01-13 18:10:51 +00:00
|
|
|
# in ~/.config/fish/config.fish. Also, import is clever enough to
|
|
|
|
# skip directories with *.spec.fish files.
|
2015-01-07 05:00:00 +00:00
|
|
|
#
|
|
|
|
# EXAMPLES
|
2015-01-07 18:04:54 +00:00
|
|
|
# import plugins/<plugin>
|
|
|
|
# import plugins/{dpaste,cask} themes/bobthefish
|
2015-01-07 05:00:00 +00:00
|
|
|
#
|
|
|
|
# AUTHORS
|
|
|
|
# Jorge Bucaran <jbucaran@me.com>
|
|
|
|
#
|
|
|
|
# SEE ALSO
|
|
|
|
# functions/_prepend_path.fish
|
|
|
|
# functions/_prepend_tree.fish
|
|
|
|
#
|
2015-01-13 18:10:51 +00:00
|
|
|
# v.0.1.1
|
2015-01-07 05:00:00 +00:00
|
|
|
#/
|
|
|
|
function import -d "Load libraries, plugins, themes, etc."
|
2015-01-13 18:10:51 +00:00
|
|
|
# Do not add spec files to function path.
|
|
|
|
set -l skip_spec \*.fish -a ! \*.spec.fish
|
|
|
|
|
2015-01-07 05:00:00 +00:00
|
|
|
for library in $argv
|
|
|
|
# Prepend plugins, themes and completions, traversing library
|
|
|
|
# trees and prepending directories with fish code.
|
2015-01-13 18:10:51 +00:00
|
|
|
_prepend_tree $fish_path/$library $skip_spec
|
|
|
|
_prepend_tree $fish_custom/$library $skip_spec
|
2015-01-07 05:00:00 +00:00
|
|
|
_prepend_path $fish_path/$library/completions -d fish_complete_path
|
|
|
|
|
2015-01-07 17:21:51 +00:00
|
|
|
# Set path to load files.
|
|
|
|
set -l path $library/(basename $library).load
|
|
|
|
|
2015-01-07 05:00:00 +00:00
|
|
|
# Source each plugin, theme, etc., configuration load file.
|
2015-01-07 17:21:51 +00:00
|
|
|
for load in $fish_path/$path $fish_custom/$path
|
|
|
|
if [ -e $load ]
|
|
|
|
. $load
|
2015-01-07 05:00:00 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|