From aeecb233829eaff121965bdae0e36e065977202d Mon Sep 17 00:00:00 2001 From: Matt Leong Date: Tue, 8 Feb 2022 15:17:30 -0800 Subject: [PATCH] feat: clean up packerInit file --- init.lua | 4 ++-- lua/cosmic/core/pluginsInit.lua | 24 +++++------------------- lua/cosmic/core/user.lua | 16 ++-------------- lua/cosmic/theme/plugins.lua | 2 +- 4 files changed, 10 insertions(+), 36 deletions(-) diff --git a/init.lua b/init.lua index ec6f152..997573e 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,5 @@ -if vim.fn.has('nvim-0.6') == 0 then - error('Need NVIM 0.6 in order to run Cosmic!!') +if vim.fn.has('nvim-0.7') == 0 then + error('Need Neovim v0.7+ in order to run Cosmic!') end do diff --git a/lua/cosmic/core/pluginsInit.lua b/lua/cosmic/core/pluginsInit.lua index 207ee45..d0d67fa 100644 --- a/lua/cosmic/core/pluginsInit.lua +++ b/lua/cosmic/core/pluginsInit.lua @@ -1,22 +1,8 @@ -local present, cosmic_packer = pcall(require, 'cosmic.packer') - -if not present then - return false -end - +local user_config = require('cosmic.core.user') +local cosmic_packer = require('cosmic.packer') local packer = cosmic_packer.packer local use = packer.use -local ok, user_config = pcall(require, 'cosmic.core.user') -if not ok then - user_config = { - add_plugins = {}, - disable_builtin_plugins = {}, - } -end - -local config = require('cosmic.core.user') - return packer.startup(function() use({ 'wbthomason/packer.nvim', @@ -26,14 +12,14 @@ return packer.startup(function() }) -- initialize theme plugins - require('cosmic.theme.plugins').init(use, config) + require('cosmic.theme.plugins').init(use, user_config) use({ 'rcarriga/nvim-notify', config = function() require('cosmic.plugins.notify') end, - after = config.theme, + after = user_config.theme, disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'notify'), }) @@ -45,7 +31,7 @@ return packer.startup(function() config = function() require('cosmic.plugins.galaxyline') end, - after = config.theme, + after = user_config.theme, disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'galaxyline'), }) diff --git a/lua/cosmic/core/user.lua b/lua/cosmic/core/user.lua index 038dcea..a380468 100644 --- a/lua/cosmic/core/user.lua +++ b/lua/cosmic/core/user.lua @@ -1,11 +1,9 @@ --- DO NOT TOUCH :) local ok, user_config = pcall(require, 'cosmic.config.config') if not ok then user_config = {} end --- these settings will be merged with any settings definined in config.lua local default_config = { border = 'rounded', disable_builtin_plugins = {}, @@ -14,26 +12,16 @@ local default_config = { lsp = { format_on_save = true, -- true/false or table of filetypes {'.ts', '.js',} rename_notification = true, - -- vim.diagnostic.config settiings servers = { - -- enable/disable server + formatting - -- enable non-default servers - -- rust_analyzer = true, - - -- or override lsp server options - --[[ rust_analyzer = { - opts = {} - }, ]] - jsonls = { format = false, }, sumneko_lua = { - format = false, -- disable formatting all together + format = false, }, html = true, tsserver = { - format = false, -- disable formatting all together + format = false, }, }, }, diff --git a/lua/cosmic/theme/plugins.lua b/lua/cosmic/theme/plugins.lua index d28addc..d231b24 100644 --- a/lua/cosmic/theme/plugins.lua +++ b/lua/cosmic/theme/plugins.lua @@ -33,7 +33,7 @@ function M.init(use, config) local catppuccin = require('catppuccin') catppuccin.setup({ styles = { - comments = 'NONE', + comments = 'italic', functions = 'NONE', keywords = 'NONE', strings = 'NONE',