vim: more robust setting of colorscheme

This commit is contained in:
Fernando Schauenburg 2023-08-09 16:38:12 +02:00
parent a8cae3438e
commit 48ecd25d7c
2 changed files with 9 additions and 1 deletions

View file

@ -10,5 +10,5 @@ require 'fschauen.filetypes'
require 'fschauen.diagnostics' require 'fschauen.diagnostics'
require 'fschauen.lazy' require 'fschauen.lazy'
vim.cmd [[colorscheme gruvbox]] require('fschauen.util').set_colorscheme('gruvbox')

View file

@ -185,5 +185,13 @@ M.toggle_quickfix = function() toggle_qf_list('c') end
--- Toggle location list. --- Toggle location list.
M.toggle_loclist = function() toggle_qf_list('l') end M.toggle_loclist = function() toggle_qf_list('l') end
M.set_colorscheme = function(name)
vim.cmd('silent! colorscheme ' .. name)
if vim.v.errmsg ~= '' then
vim.notify(string.format('Colorscheme %s not found!', name), vim.log.levels.WARN)
end
end
return M return M