aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/nvim/.config
diff options
context:
space:
mode:
authorToby Vincent <tobyv@tobyvin.dev>2023-11-07 16:15:45 -0600
committerToby Vincent <tobyv@tobyvin.dev>2023-11-07 16:15:45 -0600
commite1b8be563e331a561a764223beaa63090f3824ae (patch)
tree0b03263e2337d7b92d45f680904edff609283eb8 /nvim/.config
parent7240dfd2cb2be631f85298daeb0bd3a8ad842757 (diff)
refactor(nvim): clean up conform and noice plugins
Diffstat (limited to 'nvim/.config')
-rw-r--r--nvim/.config/nvim/lua/plugins/conform.lua15
-rw-r--r--nvim/.config/nvim/lua/plugins/noice.lua96
2 files changed, 32 insertions, 79 deletions
diff --git a/nvim/.config/nvim/lua/plugins/conform.lua b/nvim/.config/nvim/lua/plugins/conform.lua
index 37eee44..92c6fb6 100644
--- a/nvim/.config/nvim/lua/plugins/conform.lua
+++ b/nvim/.config/nvim/lua/plugins/conform.lua
@@ -18,6 +18,7 @@ local M = {
sass = { "prettier" },
scss = { "prettier" },
sh = { "shfmt" },
+ ["*"] = { "injected" },
},
formatters = {
prettier = {
@@ -39,16 +40,12 @@ local M = {
}
function M:init()
- local args = { lsp_fallback = "always" }
- vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
-
- vim.keymap.set({ "n", "v" }, "gqq", function()
- return require("conform").format(args)
- end, { desc = "format" })
+ local function format()
+ return require("conform").format({ lsp_fallback = "always" })
+ end
- vim.keymap.set({ "n", "v" }, "<leader>lf", function()
- return require("conform").format(args)
- end, { desc = "format" })
+ vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
+ vim.keymap.set({ "n", "v" }, "<leader>lf", format, { desc = "format" })
end
return M
diff --git a/nvim/.config/nvim/lua/plugins/noice.lua b/nvim/.config/nvim/lua/plugins/noice.lua
index fe13540..a1bb3f9 100644
--- a/nvim/.config/nvim/lua/plugins/noice.lua
+++ b/nvim/.config/nvim/lua/plugins/noice.lua
@@ -2,19 +2,15 @@
local M = {
"folke/noice.nvim",
version = "*",
- event = { "VeryLazy" },
+ event = { "LspAttach" },
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
},
- config = true,
- ---@type NoiceConfig
opts = {
cmdline = { enabled = false },
messages = { enabled = false },
- popupmenu = {
- backend = "cmp",
- },
+ popupmenu = { backend = "cmp" },
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
@@ -30,88 +26,48 @@ local M = {
{ "{data.progress.client} ", hl_group = "NoiceLspProgressClient" },
},
format_done = {
- {
- " ",
- hl_group = "NoiceLspProgressDone",
- },
+ { " ", hl_group = "NoiceLspProgressDone" },
{ "{data.progress.title} ", hl_group = "NoiceLspProgressTitle" },
{ "{data.progress.client} ", hl_group = "NoiceLspProgressClient" },
},
},
},
- commands = {
- all = {
- view = "split",
- opts = { enter = true, format = "details" },
- filter = {},
- },
- },
- routes = {
- {
- view = "notify_send",
- filter = {
- event = "notify",
- cond = function()
- return vim.g.notify_send_enabled
- end,
- },
- opts = { stop = false, app_name = "nvim" },
- },
- {
- view = "mini",
- filter = {
- event = "notify",
- any = {
- {
- error = false,
- warning = false,
- cond = function(message)
- return vim.tbl_get(message, "opts", "title") == "Neogit"
- end,
- },
- },
- },
- },
- },
views = {
hover = {
- border = {
- style = "single",
- },
+ border = { style = "single" },
position = { row = 2, col = 2 },
},
mini = {
- position = {
- row = -2,
- },
- win_options = {
- winblend = 0,
- },
+ position = { row = -2 },
+ win_options = { winblend = 0 },
},
},
},
}
-function M.init()
- vim.api.nvim_set_hl(0, "NoiceLspProgressSpinner", {
- link = "DiagnosticSignInfo",
- })
+function M:init()
+ vim.api.nvim_set_hl(0, "NoiceLspProgressSpinner", { link = "DiagnosticSignInfo" })
+ vim.api.nvim_set_hl(0, "NoiceLspProgressDone", { link = "DiagnosticSignOk" })
- vim.api.nvim_set_hl(0, "NoiceLspProgressDone", {
- link = "DiffAdd",
- })
+ ---@diagnostic disable-next-line: duplicate-set-field
+ vim.notify = function(...)
+ require("lazy").load({ plugins = { "noice.nvim" } })
+ return vim.notify(...)
+ end
- vim.keymap.set({ "n", "i", "s" }, "<c-d>", function()
- if not require("noice.lsp").scroll(4) then
- return "<c-d>"
- end
- end, { desc = "up half page", expr = true })
+ vim.api.nvim_create_autocmd("LspAttach", {
+ group = vim.api.nvim_create_augroup("noice-lsp", { clear = true }),
+ callback = function(args)
+ vim.keymap.set({ "n", "i", "s" }, "<c-d>", function()
+ return require("noice.lsp").scroll(4) and "<Ignore>" or "<c-d>"
+ end, { expr = true, buffer = args.buf, desc = "up half page" })
- vim.keymap.set({ "n", "i", "s" }, "<c-u>", function()
- if not require("noice.lsp").scroll(-4) then
- return "<c-u>"
- end
- end, { desc = "down half page", expr = true })
+ vim.keymap.set({ "n", "i", "s" }, "<c-u>", function()
+ return require("noice.lsp").scroll(-4) and "<Ignore>" or "<c-u>"
+ end, { expr = true, buffer = args.buf, desc = "down half page" })
+ end,
+ desc = "setup noice documentation scroll",
+ })
end
return M