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"
|
|
|
|
|
|
2013-11-04 02:47:32 +08:00
|
|
|
|
_append_path $fish_path/$plugin_path fish_function_path
|
|
|
|
|
_append_path $fish_custom/$plugin_path fish_function_path
|
2012-07-29 11:36:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function _fish_add_completion
|
|
|
|
|
set -l plugin $argv[1]
|
|
|
|
|
set -l completion_path "plugins/$plugin/completions"
|
|
|
|
|
|
2013-11-04 02:47:32 +08:00
|
|
|
|
_append_path $fish_path/$completion_path fish_complete_path
|
|
|
|
|
_append_path $fish_custom/$completion_path fish_complete_path
|
2012-07-29 11:36:36 +08:00
|
|
|
|
end
|
|
|
|
|
|
2012-07-29 12:14:44 +08:00
|
|
|
|
function _fish_source_plugin_load_file
|
|
|
|
|
set -l plugin $argv[1]
|
2012-08-16 10:25:14 +08:00
|
|
|
|
set -l load_file_path "plugins/$plugin/$plugin.load"
|
2012-07-29 12:14:44 +08:00
|
|
|
|
|
2012-07-30 02:42:37 +08:00
|
|
|
|
if test -e $fish_path/$load_file_path
|
2013-10-19 01:15:47 +08:00
|
|
|
|
. $fish_path/$load_file_path
|
2012-07-29 12:14:44 +08:00
|
|
|
|
end
|
|
|
|
|
|
2012-07-30 02:42:37 +08:00
|
|
|
|
if test -e $fish_custom/$load_file_path
|
2013-10-19 01:15:47 +08:00
|
|
|
|
. $fish_custom/$load_file_path
|
2012-07-29 12:14:44 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2013-08-07 20:33:10 +08:00
|
|
|
|
function _fish_load_theme
|
2013-11-04 02:47:32 +08:00
|
|
|
|
_append_path $fish_path/themes/$fish_theme fish_function_path
|
|
|
|
|
_append_path $fish_custom/themes/$fish_theme fish_function_path
|
2013-08-07 04:31:19 +08:00
|
|
|
|
end
|
|
|
|
|
|
2012-07-29 11:36:36 +08:00
|
|
|
|
###
|
|
|
|
|
# Configuration
|
|
|
|
|
###
|
|
|
|
|
|
2012-07-30 02:42:37 +08:00
|
|
|
|
# Set fish_custom to the path where your custom config files
|
2012-07-25 12:07:27 +08:00
|
|
|
|
# and plugins exists, or else we will use the default custom.
|
2012-07-30 02:42:37 +08:00
|
|
|
|
if not set -q fish_custom
|
|
|
|
|
set -g fish_custom $fish_path/custom
|
2012-07-25 12:07:27 +08:00
|
|
|
|
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
|
2013-11-01 04:33:26 +08:00
|
|
|
|
if not contains $fish_path/functions/ $fish_function_path
|
2013-11-20 16:06:31 +08:00
|
|
|
|
set fish_function_path $fish_path/functions/ $fish_function_path
|
2013-11-01 04:33:26 +08:00
|
|
|
|
end
|
2012-07-24 11:59:50 +08:00
|
|
|
|
|
2012-07-27 10:13:48 +08:00
|
|
|
|
# Add all defined plugins
|
2012-07-30 02:42:37 +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
|
|
|
|
|
|
2013-08-07 20:33:10 +08:00
|
|
|
|
# Load user defined theme
|
|
|
|
|
_fish_load_theme $fish_theme
|
2012-07-25 08:16:18 +08:00
|
|
|
|
|
2012-07-25 12:07:27 +08:00
|
|
|
|
# Source all files inside custom folder
|
2012-08-16 10:25:14 +08:00
|
|
|
|
for config_file in $fish_custom/*.load
|
2013-10-19 01:15:47 +08:00
|
|
|
|
. $config_file
|
2012-07-25 12:07:27 +08:00
|
|
|
|
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
|