From 8aa6bf7ee2a34556d93e5fc1bc0b59d51d117559 Mon Sep 17 00:00:00 2001 From: Bruno Pinto Date: Fri, 4 Sep 2015 18:24:25 +0100 Subject: [PATCH] Remove unnecessary code This was actually trying to load PATHs that do not exist under $OMF_CONFIG directory and sourcing files that did not exist. --- init.fish | 12 +++--------- lib/autoload.fish | 4 +++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/init.fish b/init.fish index f71ce2d..7e8ee5e 100644 --- a/init.fish +++ b/init.fish @@ -31,17 +31,11 @@ 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_CONFIG}/themes/(cat $OMF_CONFIG/theme) -set -l paths $OMF_PATH/pkg/* -set -l config $OMF_CONFIG/pkg/* -set -l ignore $OMF_IGNORE +set -l theme {$OMF_PATH,$OMF_CONFIG}/themes/(cat $OMF_CONFIG/theme) -for path in $paths - set config $OMF_CONFIG/(basename $path) $config -end +for path in $OMF_PATH/lib $OMF_PATH/lib/git {$OMF_PATH,$OMF_CONFIG}/pkg/* $theme + contains -- (basename $path) $OMF_IGNORE; and continue -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 ^/dev/null and emit init_(basename $path) $path diff --git a/lib/autoload.fish b/lib/autoload.fish index fdc84ee..43b4ddd 100644 --- a/lib/autoload.fish +++ b/lib/autoload.fish @@ -10,9 +10,11 @@ function autoload -d "autoload a function or completion path" for path in $argv if test -d "$path" set -l dest fish_function_path - if test (basename "$path") = "completions" + + if test (basename "$path") = completions set dest fish_complete_path end + contains "$path" $$dest; or set $dest "$path" $$dest end end