From 67f73b704498322cfbc79315f4ee9761f630b464 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 14 Dec 2021 17:00:38 -0500 Subject: add colorscheme add colorscheme --- lua/user/colorscheme.lua | 8 ++++++++ lua/user/plugins.lua | 4 ++++ 2 files changed, 12 insertions(+) create mode 100644 lua/user/colorscheme.lua (limited to 'lua') diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua new file mode 100644 index 0000000..b1e21f6 --- /dev/null +++ b/lua/user/colorscheme.lua @@ -0,0 +1,8 @@ +vim.cmd [[ +try + colorscheme darkplus +catch /^Vim\%((\a\+)\)\=:E185/ + colorscheme default + set background=dark +endtry +]] diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 3d4499f..6b131a2 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -45,6 +45,10 @@ return packer.startup(function(use) use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins + -- Colorschemes + -- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out + use "lunarvim/darkplus.nvim" + -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins if PACKER_BOOTSTRAP then -- cgit v1.2.3 From 68de5d4fab1cd11d74829947a2809c1899280dea Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Mon, 20 Dec 2021 10:57:40 -0500 Subject: use lua way to handle color scheme errors --- lua/user/colorscheme.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'lua') diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua index b1e21f6..8c73fd6 100644 --- a/lua/user/colorscheme.lua +++ b/lua/user/colorscheme.lua @@ -1,8 +1,7 @@ -vim.cmd [[ -try - colorscheme darkplus -catch /^Vim\%((\a\+)\)\=:E185/ - colorscheme default - set background=dark -endtry -]] +local colorscheme = "default" + +local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) +if not status_ok then + vim.notify("colorscheme " .. colorscheme .. " not found!") + return +end -- cgit v1.2.3