fixed reloading plugin files and highlight after colorscheme

This commit is contained in:
iris committed 2022-08-03 14:22:50 -04:00
1 parent 72be4d853c
commit ea0cdc2c9e
7 files changed
+72 -16

No files matched your search

+2
View File
@@ -2,4 +2,6 @@ for _, name in ipairs({
'reload', 'reload',
'settings', 'settings',
'plugins', 'plugins',
'neovide',
'theme'
}) do require('config.' .. name) end }) do require('config.' .. name) end
+27
View File
@@ -0,0 +1,27 @@
vim.g.gui_font_default_size = 14
vim.g.gui_font_size = vim.g.gui_font_default_size
vim.g.gui_font_face = "Comic Code Ligatures"
RefreshGuiFont = function()
vim.opt.guifont = string.format("%s:h%s", vim.g.gui_font_face, vim.g.gui_font_size)
end
ResizeGuiFont = function(delta)
vim.g.gui_font_size = vim.g.gui_font_size + delta
RefreshGuiFont()
end
ResetGuiFont = function()
vim.g.gui_font_size = vim.g.gui_font_default_size
RefreshGuiFont()
end
-- Call function on startup to set default value
ResetGuiFont()
-- Keymaps
local opts = { noremap = true, silent = true }
vim.keymap.set({ 'n', 'i' }, "<C-+>", function() ResizeGuiFont(1) end, opts)
vim.keymap.set({ 'n', 'i' }, "<C-_>", function() ResizeGuiFont(-1) end, opts)
+1 -1
View File
@@ -16,7 +16,7 @@ return function(use)
} }
}, },
window = { window = {
width = 30, width = 20,
}, },
} }
+6
View File
@@ -4,6 +4,8 @@ return function(use)
config = function() config = function()
require 'onedark'.setup { style = 'darker' } require 'onedark'.setup { style = 'darker' }
require 'onedark'.load() require 'onedark'.load()
package.loaded['config.theme'] = nil
require 'config.theme'
end end
} }
use { use {
@@ -23,4 +25,8 @@ return function(use)
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
config = function() require 'gitsigns'.setup() end config = function() require 'gitsigns'.setup() end
} }
use {
'sunjon/shade.nvim',
config = function() require 'shade'.setup() end
}
end end
+31 -11
View File
@@ -1,19 +1,39 @@
local group = vim.api.nvim_create_augroup("reload", {}) local group = vim.api.nvim_create_augroup('reload', {})
local post_write = function(path, cmd) local post_write = function(path, fn)
vim.api.nvim_create_autocmd("BufWritePost", { vim.api.nvim_create_autocmd('BufWritePost', {
group = group, group = group,
pattern = "**/lua/config/" .. path, pattern = '**/lua/config/' .. path,
command = cmd, callback = fn,
}) })
end end
for _, path in ipairs({ for _, path in ipairs({
"reload.lua", 'reload.lua',
"settings.lua", 'settings.lua',
"utils.lua" 'utils.lua',
}) do post_write(path, "source <afile>") end 'neovide.lua',
'theme.lua',
}) do post_write(path, function(arg) dofile(arg.file) end) end
-- allows you to install and clean plugins after writing to the file -- allows you to install / clean / update plugins
post_write("plugins.lua", "source <afile> | PackerCompile") -- after writing to the file
---
--- @param arg {file: string}
local update_plugins = function(arg)
-- unload the file if it's not plugins.lua
local i = arg.file:find("config/plugins/")
if i ~= nil then
local mod = arg.file:sub(i):gsub("/", "."):sub(0, -5)
package.loaded[mod] = nil
end
-- reload plugins.lua and compile
package.loaded['config.plugins'] = nil
require 'config.plugins'
require 'packer'.compile()
end
post_write('plugins.lua', update_plugins)
post_write('plugins/*', update_plugins)
-4
View File
@@ -28,10 +28,6 @@ else
o.termguicolors = false o.termguicolors = false
end end
-- highlight extra white space with red
vim.api.nvim_set_hl(0, 'TrailingWhitespace', { ctermbg = 'red', bg = '#ff5555' })
vim.cmd([[match TrailingWhitespace /\s\+$/]])
-- diagnostics -- diagnostics
local signs = { Error = "", Warn = "", Hint = "", Info = "" } local signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(signs) do for type, icon in pairs(signs) do
+5
View File
@@ -0,0 +1,5 @@
-- highlight extra white space with red
vim.api.nvim_set_hl(0, 'ExtraWhitespace', { ctermbg = 'red', bg = '#ff8888' })
vim.cmd [[match ExtraWhitespace /\s\+$/]]
print("hello???")