mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2024-11-22 13:48:16 +08:00
plugin and completion load cleanup
This commit is contained in:
parent
a0331634cb
commit
ed76c2e5c5
|
@ -1,3 +1,37 @@
|
|||
###
|
||||
# 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
|
||||
|
||||
###
|
||||
# Configuration
|
||||
###
|
||||
|
||||
# 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
|
||||
|
@ -13,27 +47,13 @@ set fish_function_path $FISH/functions/ $fish_function_path
|
|||
|
||||
# Add all defined plugins
|
||||
for plugin in $FISH_PLUGINS
|
||||
set fish_function_path $FISH/plugins/$plugin $fish_function_path
|
||||
|
||||
# Add plugin completion
|
||||
if test -e $FISH/plugins/$plugin/completions
|
||||
set fish_complete_path $FISH/plugins/$plugin/completions $fish_complete_path
|
||||
end
|
||||
_fish_add_plugin $plugin
|
||||
_fish_add_completion $plugin
|
||||
end
|
||||
|
||||
# Add user defined theme
|
||||
set fish_function_path $FISH/themes/$FISH_THEME $fish_function_path
|
||||
|
||||
# Add all custom plugins
|
||||
for plugin in $FISH_CUSTOM/plugins/*
|
||||
set fish_function_path $plugin $fish_function_path
|
||||
|
||||
# Add plugin completion
|
||||
if test -e $plugin/completions
|
||||
set fish_complete_path $plugin/completions $fish_complete_path
|
||||
end
|
||||
end
|
||||
|
||||
# Source all files inside custom folder
|
||||
for config_file in $FISH_CUSTOM/*.fish
|
||||
. $config_file
|
||||
|
|
Loading…
Reference in New Issue
Block a user