diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index 637afcd..87c20b7 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -11,10 +11,10 @@ lsp.nvim_workspace() local cmp = require("cmp") local cmp_select = { behavior = cmp.SelectBehavior.Select } local cmp_mapping = lsp.defaults.cmp_mappings({ - [""] = cmp.mapping.select_prev_item(cmp_select), - [""] = cmp.mapping.select_next_item(cmp_select), - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.complete(), + [""] = cmp.mapping.select_prev_item(cmp_select), + [""] = cmp.mapping.select_next_item(cmp_select), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.complete(), }) lsp.setup_nvim_cmp({ mapping = cmp_mapping }) @@ -23,25 +23,28 @@ vim.diagnostic.config({ virtual_text = false, }) +vim.keymap.set("n", "ci", vim.diagnostic.open_float, { desc = "Display diagnostic Code Info" }) + -- Gimme pretty icons lsp.set_sign_icons({ - error = '✘', - warn = '▲', - hint = '⚑', - info = '»' + error = '✘', + warn = '▲', + hint = '⚑', + info = '»' }) -lsp.on_attach(function(_, buffnr) +lsp.on_attach(function(_, buffnr) local opts = { buffer = buffnr, remap = false } vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, opts) vim.keymap.set("n", "re", vim.lsp.buf.rename, opts) - vim.keymap.set({"n", "i"}, "", vim.lsp.buf.signature_help, opts) + vim.keymap.set({ "n", "i" }, "", vim.lsp.buf.signature_help, opts) vim.keymap.set("n", "fmt", function() - vim.lsp.buf.format({ async = false, timeout_ms = 5000 }) + vim.lsp.buf.format({ async = false, timeout_ms = 5000 }) end) end) @@ -49,12 +52,10 @@ end) -- NOTE: Format on save does not support async formatting lsp.format_on_save({ servers = { - ["rust_analyzer"] = {"rust"} + ["rust_analyzer"] = { "rust" } } }) - +require("lsp-inlayhints").setup() lsp.setup() - -require("lsp-inlayhints").setup() diff --git a/after/plugin/lualine.lua b/after/plugin/lualine.lua new file mode 100644 index 0000000..0a758a1 --- /dev/null +++ b/after/plugin/lualine.lua @@ -0,0 +1,31 @@ +local overseer = require("overseer") + +local task_status = { + "overseer", + colored = true, + symbols = { + [overseer.STATUS.FAILURE] = "✗ ", + [overseer.STATUS.CANCELED] = "o ", + [overseer.STATUS.SUCCESS] = "✓ ", + [overseer.STATUS.RUNNING] = "⟳ ", + }, +} + +require("lualine").setup({ + sections = { + lualine_b = { + "branch", + "diff", + { + "diagnostics", + symbols = { error = "E:", warn = "W:", info = "I:", hint = "H:" } + }, + }, + lualine_x = { + task_status, + "encoding", + { "fileformat", icons_enabled = false }, + "filetype" + } + }, +}) diff --git a/lua/valeth/packer.lua b/lua/valeth/packer.lua index 4aaa1db..777045f 100644 --- a/lua/valeth/packer.lua +++ b/lua/valeth/packer.lua @@ -102,32 +102,9 @@ local function spec(use) use { "nvim-lualine/lualine.nvim", requires = { - { "nvim-tree/nvim-web-devicons" } - }, - config = function() - local overseer = require("overseer") - local task_status = { - "overseer", - colored = true, - symbols = { - [overseer.STATUS.FAILURE] = "✗ ", - [overseer.STATUS.CANCELED] = "o", - [overseer.STATUS.SUCCESS] = "✓ ", - [overseer.STATUS.RUNNING] = "⟳ ", - }, - } - - require("lualine").setup({ - sections = { - lualine_x = { - task_status, - "encoding", - { "fileformat", icons_enabled = false }, - "filetype" - } - }, - }) - end + { "nvim-tree/nvim-web-devicons" }, + { "stevearc/overseer.nvim" }, + } } use {