diff --git a/lua/colors/hybrid.lua b/lua/colors/hybrid.lua index de217b3..08b0356 100644 --- a/lua/colors/hybrid.lua +++ b/lua/colors/hybrid.lua @@ -116,7 +116,7 @@ M.setup = function() hi("Comment", { fg = colors.comment.gui, ctermfg = colors.comment.cterm }) hi("Constant", { fg = colors.red.gui, ctermfg = colors.red.cterm }) - hi("String", { fg = colors.green.gui, ctermfg = colors.green.cterm }) + hi("String", { fg = colors.dark_yellow.gui, ctermfg = colors.dark_yellow.cterm }) hi("Identifier", { fg = colors.purple.gui, ctermfg = colors.purple.cterm }) hi("Function", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm }) @@ -129,7 +129,7 @@ M.setup = function() hi("Type", { fg = colors.orange.gui, ctermfg = colors.orange.cterm }) hi("Structure", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm }) - hi("Special", { fg = colors.green.gui, ctermfg = colors.green.cterm }) + hi("Special", { fg = colors.dark_yellow.gui, ctermfg = colors.dark_yellow.cterm }) hi("Underlined", { fg = colors.blue.gui, ctermfg = colors.blue.cterm, underline = true }) hi("Error", { fg = colors.red.gui, bg = colors.dark_red.gui, ctermfg = colors.red.cterm, ctermbg = colors.dark_red.cterm, underline = true }) @@ -139,13 +139,13 @@ M.setup = function() hi("qfLineNr", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm }) -- Tree-sitter highlight groups - hi("@variable", { fg = colors.foreground.gui, ctermfg = colors.foreground.cterm }) + hi("@variable", { fg = colors.blue.gui, ctermfg = colors.foreground.cterm }) hi("@variable.builtin", { fg = colors.purple.gui, ctermfg = colors.purple.cterm }) - hi("@variable.parameter", { fg = colors.foreground.gui, ctermfg = colors.foreground.cterm }) - hi("@variable.member", { fg = colors.blue.gui, ctermfg = colors.blue.cterm }) + hi("@variable.parameter", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm, italic = true}) + hi("@variable.member", { fg = colors.foreground.gui, ctermfg = colors.foreground.cterm }) - hi("@constant", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm }) - hi("@constant.builtin", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm }) + hi("@constant", { fg = colors.red.gui, ctermfg = colors.red.cterm }) + hi("@constant.builtin", { fg = colors.red.gui, ctermfg = colors.red.cterm }) hi("@constant.macro", { fg = colors.orange.gui, ctermfg = colors.orange.cterm }) hi("@string", { fg = colors.dark_yellow.gui, ctermfg = colors.green.cterm }) @@ -158,20 +158,20 @@ M.setup = function() --hi("@float", { fg = colors.red.gui, ctermfg = colors.red.cterm }) -- generally high priority - hi("@function", { fg = colors.blue.gui, ctermfg = colors.blue.cterm }) + hi("@function", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm }) hi("@function.builtin", { fg = colors.purple.gui, ctermfg = colors.purple.cterm }) - hi("@function.call", { fg = colors.blue.gui, ctermfg = colors.blue.cterm }) + hi("@function.call", { fg = colors.yellow.gui, ctermfg = colors.yellow.cterm }) --hi("@function.macro", { fg = colors.purple.gui, ctermfg = colors.purple.cterm }) --hi("@function.method", { fg = colors.blue.gui, ctermfg = colors.blue.cterm }) hi("@method", { fg = colors.blue.gui, ctermfg = colors.blue.cterm }) hi("@method.call", { fg = colors.blue.gui, ctermfg = colors.blue.cterm }) hi("@constructor", { fg = colors.blue.gui, ctermfg = colors.blue.cterm, bold = true}) - hi("@operator", { fg = colors.red.gui, ctermfg = colors.red.cterm }) + hi("@operator", { fg = colors.aqua.gui, ctermfg = colors.aqua.cterm }) hi("@keyword", { fg = colors.purple.gui, ctermfg = colors.purple.cterm }) hi("@keyword.function", { fg = colors.purple.gui, ctermfg = colors.purple.cterm }) - hi("@keyword.operator", { fg = colors.blue.gui, ctermfg = colors.blue.cterm }) + hi("@keyword.operator", { fg = colors.purple.gui, ctermfg = colors.purple.cterm }) hi("@keyword.return", { fg = colors.purple.gui, ctermfg = colors.purple.cterm }) hi("@keyword.conditional", { fg = colors.purple.gui, ctermfg = colors.purple.cterm }) hi("@keyword.repeat", { fg = colors.purple.gui, ctermfg = colors.purple.cterm }) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index bfa8c45..add136e 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -25,7 +25,7 @@ require("lazy").setup({ lazy = false, -- should plugins be lazy-loaded? version = false, -- always use the latest git commit }, - checker = { enabled = true }, -- automatically check for plugin updates + checker = { enabled = false }, -- disabled auto check for plugin updates performance = { rtp = { -- disable some rtp plugins diff --git a/lua/config/options.lua b/lua/config/options.lua index 767d90f..79d01ff 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -102,3 +102,44 @@ vim.cmd("highlight default link MyTodo Todo") -- syntax match MyTodo /\v<(TODO|FIXME|NOTE|HACK|BUG)>/ containedin=ALL -- highlight default link MyTodo Todo -- ]]) + +-- Custom go file template when opening empty file +-- vim.api.nvim_create_autocmd("BufNewFile", { +-- pattern = "*.go", +-- callback = function() +-- -- Only insert if the file is empty +-- if vim.fn.line("$") == 1 and vim.fn.getline(1) == "" then +-- vim.api.nvim_buf_set_lines(0, 0, -1, false, { +-- "package main", +-- "", +-- "func main() {", +-- "\t", +-- "}", +-- "", +-- }) +-- vim.api.nvim_win_set_cursor(0, {4, 2}) -- place cursor inside main +-- end +-- end, +-- }) +vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*.go", + callback = function() + -- 1) Organize imports (gopls code action) + local params = vim.lsp.util.make_range_params() + params.context = { only = { "source.organizeImports" } } + + local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 3000) + for _, res in pairs(result or {}) do + for _, action in pairs(res.result or {}) do + if action.edit then + vim.lsp.util.apply_workspace_edit(action.edit, "utf-8") + elseif action.command then + vim.lsp.buf.execute_command(action.command) + end + end + end + + -- 2) Format (gopls formatting) + vim.lsp.buf.format({ async = false }) + end, +}) diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index eb02024..b95838a 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -7,6 +7,7 @@ return { config = function() require("colors.hybrid").setup() require("transparency").setup() + vim.api.nvim_set_hl(0, "@keyword.directive.python", { link = "Comment" }) end, }, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 1dcb8b9..3cba4e7 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -47,7 +47,7 @@ return { settings = { perlnavigator = { perlPath = '/usr/local/bin/p64', - -- includePaths = {'/home/keegan/src/intex/fips/scripts/perlmodule'}, + includePaths = {'/home/keegan/src/intex/fips/scripts/perlmodule', '/home/keegan/src/intex/intexnet'}, perlcriticProfile = '/home/keegan/src/intex/binnt/perlcritic_config.txt', perltidyProfile = '/home/keegan/src/intex/binnt/perltidy_config', },