From 1f1782a46078577e01da8bbe06d0f53201d4624a Mon Sep 17 00:00:00 2001 From: Pocco81 Date: Sun, 29 Aug 2021 15:51:32 -0500 Subject: [PATCH] dev: removed CPLoad command in favor of the builtin 'colorscheme' --- colors/catppuccino.vim | 9 --------- .../{catppuccino.lua => dark_catppuccino.lua} | 0 lua/catppuccino/core/list_cs.lua | 5 ----- lua/catppuccino/init.lua | 4 ++-- lua/catppuccino/main.lua | 5 +++-- lua/catppuccino/utils/cli_completion.lua | 7 ------- plugin/cpcmds.vim | 20 ------------------- 7 files changed, 5 insertions(+), 45 deletions(-) rename lua/catppuccino/color_schemes/{catppuccino.lua => dark_catppuccino.lua} (100%) delete mode 100644 lua/catppuccino/core/list_cs.lua delete mode 100644 lua/catppuccino/utils/cli_completion.lua diff --git a/colors/catppuccino.vim b/colors/catppuccino.vim index 9608769..1f42425 100644 --- a/colors/catppuccino.vim +++ b/colors/catppuccino.vim @@ -1,12 +1,3 @@ lua << EOF --- clear cache so this reloads changes. --- package.loaded['catppuccino'] = nil --- package.loaded['catppuccino.utils.util'] = nil --- package.loaded['catppuccino.utils.hsluv'] = nil --- package.loaded["catppuccino.color_schemes.catppuccino"] = nil --- package.loaded['catppuccino.config'] = nil --- package.loaded['catppuccino.main'] = nil --- package.loaded['catppuccino.core.mapper'] = nil - require('catppuccino').load() EOF diff --git a/lua/catppuccino/color_schemes/catppuccino.lua b/lua/catppuccino/color_schemes/dark_catppuccino.lua similarity index 100% rename from lua/catppuccino/color_schemes/catppuccino.lua rename to lua/catppuccino/color_schemes/dark_catppuccino.lua diff --git a/lua/catppuccino/core/list_cs.lua b/lua/catppuccino/core/list_cs.lua deleted file mode 100644 index f077144..0000000 --- a/lua/catppuccino/core/list_cs.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - ["catppuccino"] = "catppuccino", - ["neon_latte"] = "neon_latte", - ["light_melya"] = "light_melya", -} diff --git a/lua/catppuccino/init.lua b/lua/catppuccino/init.lua index aeb5d9c..896b879 100644 --- a/lua/catppuccino/init.lua +++ b/lua/catppuccino/init.lua @@ -1,7 +1,7 @@ local M = {} -function M.load() - require("catppuccino.main").main("load") +function M.load(args) + require("catppuccino.main").main("load", args) end function M.setup(custom_opts, remaps) diff --git a/lua/catppuccino/main.lua b/lua/catppuccino/main.lua index a198112..e9966c8 100644 --- a/lua/catppuccino/main.lua +++ b/lua/catppuccino/main.lua @@ -2,14 +2,15 @@ local M = {} local utils = require("catppuccino.utils.util") -local function load(args) +local function load(colorscheme) local catppuccino = require("catppuccino") if catppuccino.before_loading ~= nil then catppuccino.before_loading() end - local theme = require("catppuccino.core.mapper").apply(args) + -- colorscheme gets evaluated from mapper.lua + local theme = require("catppuccino.core.mapper").apply(colorscheme) utils.load(theme) if catppuccino.after_loading ~= nil then diff --git a/lua/catppuccino/utils/cli_completion.lua b/lua/catppuccino/utils/cli_completion.lua deleted file mode 100644 index b98de0f..0000000 --- a/lua/catppuccino/utils/cli_completion.lua +++ /dev/null @@ -1,7 +0,0 @@ -local M = {} - -function M.available_commands() - return vim.tbl_keys(require("catppuccino.core.list_cs")) -end - -return M diff --git a/plugin/cpcmds.vim b/plugin/cpcmds.vim index 9f0f2da..37bf4a7 100644 --- a/plugin/cpcmds.vim +++ b/plugin/cpcmds.vim @@ -6,27 +6,7 @@ if exists('g:loaded_catppuccino') | finish | endif let s:save_cpo = &cpo " save user coptions set cpo&vim " reset them to defaults -" Utils {{{ -function! cpcmds#get_first_arg(...) - return "".get(a:, 1, 1)."" -endfunction -" }}} - -" Test Availability {{{ -" aa = available arguments -function! cpcmds#available_args_flavors() abort - return luaeval('require("catppuccino.utils.cli_completion").available_commands()') -endfunction -" }}} - -" Tab Completion {{{ -function! s:complete_args_flavors(arg, line, pos) abort - return join(cpcmds#available_args_flavors(), "\n") -endfunction -" }}} - " Interface {{{ -command! -nargs=+ -complete=custom,s:complete_args_flavors CPLoad call v:lua.require'catppuccino.main'.main('load',cpcmds#get_first_arg()) command! -nargs=0 CPClear call v:lua.require'catppuccino.main'.main('clear') " }}}