From 68636ef01a9c3c758379d25dc85d68d649a156e2 Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 25 Sep 2024 01:42:24 +0200 Subject: checkpoint --- after/plugin/conform.lua | 11 ++++++++++- after/plugin/luasnip.lua | 6 +++--- lua/config/autocmds.lua | 17 +++++++---------- lua/config/lazy.lua | 6 ++++++ lua/config/lsp.lua | 2 +- lua/config/set.lua | 6 ++++++ 6 files changed, 33 insertions(+), 15 deletions(-) diff --git a/after/plugin/conform.lua b/after/plugin/conform.lua index 76f7dca..d233d3a 100644 --- a/after/plugin/conform.lua +++ b/after/plugin/conform.lua @@ -1,7 +1,9 @@ require("conform").setup({ formatters_by_ft = { lua = { "stylua" }, - html = { "prettier" }, + -- html = { "prettier" }, + go = { "goimports", "gofmt" }, + c = { "clang-format" }, }, format_on_save = { -- These options will be passed to conform.format() @@ -9,3 +11,10 @@ require("conform").setup({ lsp_format = "fallback", }, }) + +require("conform").formatters["clang-format"] = { + prepend_args = { + "--style", + "{IndentWidth: 4, AlignAfterOpenBracket: BlockIndent, AlignConsecutiveAssignments: Consecutive, AlignArrayOfStructures: Right, BreakBeforeBraces: Linux}", + }, +} diff --git a/after/plugin/luasnip.lua b/after/plugin/luasnip.lua index e14a1a5..e882168 100644 --- a/after/plugin/luasnip.lua +++ b/after/plugin/luasnip.lua @@ -26,6 +26,6 @@ ls.config.set_config({ history = true, }) -ls.add_snippets("all", { - ls.parser.parse_snippet("expand", "-- this is $1 expanded $2 $3!"), -}) +-- ls.add_snippets("all", { +-- ls.parser.parse_snippet("expand", "-- this is $1 expanded $2 $3!"), +-- }) diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index d39ab1a..0e6fe51 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -23,16 +23,6 @@ autocmd("BufWritePre", { end, }) --- Run gofmt + goimports on save -local format_sync_grp = vim.api.nvim_create_augroup("goimports", {}) -autocmd("BufWritePre", { - pattern = "*.go", - callback = function() - require("go.format").goimports() - end, - group = format_sync_grp, -}) - autocmd("TermOpen", { callback = function() local o = vim.opt_local @@ -96,3 +86,10 @@ autocmd({ "BufNewFile", "BufRead" }, { -- Automatically resize panes autocmd("VimResized", { pattern = "*", command = "wincmd =" }) + +vim.api.nvim_create_autocmd("BufEnter", { + callback = function() + vim.opt.formatoptions:remove({ "c", "r", "o" }) + end, + desc = "Disable New Line Comment", +}) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 3cbe77c..43362f0 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -24,6 +24,12 @@ require("lazy").setup({ "stevearc/conform.nvim", "mfussenegger/nvim-lint", "neovim/nvim-lspconfig", + { + "norcalli/nvim-colorizer.lua", + config = function() + require("colorizer").setup() + end, + }, { "williamboman/mason.nvim", diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua index e94966a..346f791 100644 --- a/lua/config/lsp.lua +++ b/lua/config/lsp.lua @@ -2,7 +2,7 @@ local map = vim.keymap.set map("n", " la", vim.lsp.buf.code_action) map("n", "gd", vim.lsp.buf.definition) -map("n", " lr", vim.lsp.buf.rename) +map("n", " r", vim.lsp.buf.rename) map("n", " li", vim.lsp.buf.implementation) map("n", " lh", vim.lsp.buf.signature_help) map("n", " lt", vim.lsp.buf.typehierarchy) diff --git a/lua/config/set.lua b/lua/config/set.lua index 8ddc23c..6a0edd2 100644 --- a/lua/config/set.lua +++ b/lua/config/set.lua @@ -115,3 +115,9 @@ vim.cmd("match Todo /\\(TODO\\|FIXME\\):/") vim.cmd("match matchURL /" .. "\\(https\\?\\|ftp\\|magnet\\):\\/\\/[[:alnum:]%\\/_#.-~:]*" .. "/") vim.cmd("hi matchURL guifg=" .. require("nord.colors").palette.aurora.yellow) + +-- -- Custom highlight for markdown definitions +if vim.filetype.match({ buf = 0 }) == "markdown" then + vim.cmd("match mdDefs /^[[:space:]]*-[^:]\\+:/") + vim.cmd("hi mdDefs guifg=" .. require("nord.colors").palette.frost.ice) +end -- cgit v1.2.3