Fix theme_vim to only warn when no config dir found

Fixed warning being displayed when either vim or nvim config directory
was found but not both. Now only displays a warning when neither is
found.
This commit is contained in:
Marty Oehme 2020-01-31 12:46:59 +01:00
parent 36383db479
commit c193fc7221
1 changed files with 5 additions and 2 deletions

View File

@ -60,18 +60,21 @@ theme() {
save() {
dbg_msg $app "Saving theme"
local vim_dirs="${XDG_CONFIG_HOME:-/$HOME/.config}/nvim $HOME/.vim"
local foundone=false
for vim_dir in $vim_dirs; do
if [[ -d "$vim_dir" ]]; then
foundone=true
cat "$tfile" >"$vim_dir/colorscheme.vim"
echo "colorscheme base16-$theme" >>"$vim_dir/colorscheme.vim"
dbg_msg $app "Saved theme to $vim_dir/colorscheme.vim"
include "$vim_dir"
else
dbg_msg $app "warn" "No configuration directory found"
fi
done
[[ "$foundone" == false ]] && dbg_msg $app "warn" "No configuration directory found"
}
## Theme includer