2012-07-29 11:36:36 +08:00
|
|
|
|
###
|
|
|
|
|
# Helper functions
|
|
|
|
|
###
|
|
|
|
|
|
|
|
|
|
function _fish_add_plugin
|
|
|
|
|
set -l plugin $argv[1]
|
|
|
|
|
set -l plugin_path "plugins/$plugin"
|
|
|
|
|
|
|
|
|
|
if test -d $FISH/$plugin_path
|
|
|
|
|
set fish_function_path $FISH/$plugin_path $fish_function_path
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if test -d $FISH_CUSTOM/$plugin_path
|
|
|
|
|
set fish_function_path $FISH_CUSTOM/$plugin_path $fish_function_path
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function _fish_add_completion
|
|
|
|
|
set -l plugin $argv[1]
|
|
|
|
|
set -l completion_path "plugins/$plugin/completions"
|
|
|
|
|
|
|
|
|
|
if test -d $FISH/$completion_path
|
|
|
|
|
set fish_complete_path $FISH/$completion_path $fish_complete_path
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if test -d $FISH_CUSTOM/$completion_path
|
|
|
|
|
set fish_complete_path $FISH_CUSTOM/$completion_path $fish_complete_path
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2012-07-29 12:14:44 +08:00
|
|
|
|
function _fish_source_plugin_load_file
|
|
|
|
|
set -l plugin $argv[1]
|
|
|
|
|
set -l load_file_path "plugins/$plugin/$plugin.load.fish"
|
|
|
|
|
|
|
|
|
|
if test -e $FISH/$load_file_path
|
|
|
|
|
. $FISH/$load_file_path
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if test -e $FISH_CUSTOM/$load_file_path
|
|
|
|
|
. $FISH_CUSTOM/$load_file_path
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2012-07-29 11:36:36 +08:00
|
|
|
|
###
|
|
|
|
|
# Configuration
|
|
|
|
|
###
|
|
|
|
|
|
2012-07-25 12:07:27 +08:00
|
|
|
|
# Set FISH_CUSTOM to the path where your custom config files
|
|
|
|
|
# and plugins exists, or else we will use the default custom.
|
|
|
|
|
if not set -q FISH_CUSTOM
|
|
|
|
|
set -g FISH_CUSTOM $FISH/custom
|
|
|
|
|
end
|
|
|
|
|
|
2012-07-25 08:16:18 +08:00
|
|
|
|
# Extracting user's functions – will be added later.
|
|
|
|
|
set user_function_path $fish_function_path[1]
|
|
|
|
|
set -e fish_function_path[1]
|
|
|
|
|
|
2012-07-27 10:13:48 +08:00
|
|
|
|
# Add all functions
|
2012-07-24 11:59:50 +08:00
|
|
|
|
set fish_function_path $FISH/functions/ $fish_function_path
|
|
|
|
|
|
2012-07-27 10:13:48 +08:00
|
|
|
|
# Add all defined plugins
|
2012-07-24 07:33:02 +08:00
|
|
|
|
for plugin in $FISH_PLUGINS
|
2012-07-29 11:36:36 +08:00
|
|
|
|
_fish_add_plugin $plugin
|
|
|
|
|
_fish_add_completion $plugin
|
2012-07-29 12:14:44 +08:00
|
|
|
|
_fish_source_plugin_load_file $plugin
|
2012-07-24 07:33:02 +08:00
|
|
|
|
end
|
|
|
|
|
|
2012-07-27 10:13:48 +08:00
|
|
|
|
# Add user defined theme
|
2012-07-29 05:05:55 +08:00
|
|
|
|
set fish_function_path $FISH/themes/$FISH_THEME $fish_function_path
|
2012-07-25 08:16:18 +08:00
|
|
|
|
|
2012-07-25 12:07:27 +08:00
|
|
|
|
# Source all files inside custom folder
|
2012-07-29 12:14:44 +08:00
|
|
|
|
for config_file in $FISH_CUSTOM/*.load.fish
|
2012-07-25 12:07:27 +08:00
|
|
|
|
. $config_file
|
|
|
|
|
end
|
|
|
|
|
|
2012-07-25 08:16:18 +08:00
|
|
|
|
# Re-adding user's functions so they have the highest priority
|
|
|
|
|
set fish_function_path $user_function_path $fish_function_path
|