aboutsummaryrefslogtreecommitdiffstats
path: root/lua/simenandre/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lua/simenandre/plugins')
-rw-r--r--lua/simenandre/plugins/completion.lua51
-rw-r--r--lua/simenandre/plugins/lsp.lua46
-rw-r--r--lua/simenandre/plugins/telescope.lua2
-rw-r--r--lua/simenandre/plugins/which-key.lua6
4 files changed, 71 insertions, 34 deletions
diff --git a/lua/simenandre/plugins/completion.lua b/lua/simenandre/plugins/completion.lua
index f9cfb0a..0da6ab9 100644
--- a/lua/simenandre/plugins/completion.lua
+++ b/lua/simenandre/plugins/completion.lua
@@ -1,23 +1,44 @@
return {
- {
- "saghen/blink.cmp",
- dependencies = "rafamadriz/friendly-snippets",
- version = "*",
+ "saghen/blink.cmp",
+ event = "VimEnter",
+ version = "1.*",
+ dependencies = {
+ {
+ "L3MON4D3/LuaSnip",
+ version = "2.*",
+ build = (function()
+ if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
+ return
+ end
+ return "make install_jsregexp"
+ end)(),
+ },
+ "rafamadriz/friendly-snippets",
+ "folke/lazydev.nvim",
+ },
- ---@module 'blink.cmp'
- ---@type blink.cmp.Config
- opts = {
- keymap = { preset = "default" },
+ ---@module 'blink.cmp'
+ ---@type blink.cmp.Config
+ opts = {
+ keymap = { preset = "default" },
- appearance = {
- use_nvim_cmp_as_default = true,
- nerd_font_variant = "mono",
- },
+ appearance = {
+ nerd_font_variant = "mono",
+ },
- sources = {
- default = { "lsp", "path", "snippets", "buffer" },
+ completion = {
+ documentation = { auto_show = false, auto_show_delay_ms = 500 },
+ },
+
+ sources = {
+ default = { "lsp", "path", "snippets", "lazydev" },
+ providers = {
+ lazydev = { module = "lazydev.integrations.blink", score_offset = 100 },
},
},
- opts_extend = { "sources.default" },
+
+ snippets = { preset = "luasnip" },
+ fuzzy = { implementation = "lua" },
+ signature = { enabled = true },
},
}
diff --git a/lua/simenandre/plugins/lsp.lua b/lua/simenandre/plugins/lsp.lua
index 1f87bb6..4161489 100644
--- a/lua/simenandre/plugins/lsp.lua
+++ b/lua/simenandre/plugins/lsp.lua
@@ -11,14 +11,14 @@ return {
},
{
-- Mason for installing LSP servers and tools
- "williamboman/mason.nvim",
+ "mason-org/mason.nvim",
config = function()
require("mason").setup()
end,
},
{
"WhoIsSethDaniel/mason-tool-installer.nvim",
- dependencies = { "williamboman/mason.nvim" },
+ dependencies = { "mason-org/mason.nvim" },
opts = {
ensure_installed = {
"gopls",
@@ -35,7 +35,7 @@ return {
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
- "williamboman/mason.nvim",
+ "mason-org/mason.nvim",
"WhoIsSethDaniel/mason-tool-installer.nvim",
"saghen/blink.cmp",
},
@@ -54,6 +54,24 @@ return {
"lua_ls",
})
+ vim.diagnostic.config({
+ severity_sort = true,
+ float = { border = "rounded", source = "if_many" },
+ underline = { severity = vim.diagnostic.severity.ERROR },
+ signs = vim.g.have_nerd_font and {
+ text = {
+ [vim.diagnostic.severity.ERROR] = "󰅚 ",
+ [vim.diagnostic.severity.WARN] = "󰀪 ",
+ [vim.diagnostic.severity.INFO] = "󰋽 ",
+ [vim.diagnostic.severity.HINT] = "󰌶 ",
+ },
+ } or {},
+ virtual_text = {
+ source = "if_many",
+ spacing = 2,
+ },
+ })
+
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }),
callback = function(event)
@@ -62,20 +80,20 @@ return {
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
end
- map("gd", vim.lsp.buf.definition, "Goto Definition")
- map("gr", vim.lsp.buf.references, "Goto References")
- map("gI", vim.lsp.buf.implementation, "Goto Implementation")
- map("gD", vim.lsp.buf.declaration, "Goto Declaration")
- map("<leader>D", vim.lsp.buf.type_definition, "Type Definition")
- map("<leader>ds", require("telescope.builtin").lsp_document_symbols, "Document Symbols")
- map("<leader>ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "Workspace Symbols")
- map("<leader>rn", vim.lsp.buf.rename, "Rename")
- map("<leader>ca", vim.lsp.buf.code_action, "Code Action", { "n", "x" })
+ map("grn", vim.lsp.buf.rename, "Rename")
+ map("gra", vim.lsp.buf.code_action, "Code Action", { "n", "x" })
+ map("grr", require("telescope.builtin").lsp_references, "Goto References")
+ map("gri", require("telescope.builtin").lsp_implementations, "Goto Implementation")
+ map("grd", require("telescope.builtin").lsp_definitions, "Goto Definition")
+ map("grD", vim.lsp.buf.declaration, "Goto Declaration")
+ map("grt", require("telescope.builtin").lsp_type_definitions, "Goto Type Definition")
+ map("gO", require("telescope.builtin").lsp_document_symbols, "Document Symbols")
+ map("gW", require("telescope.builtin").lsp_dynamic_workspace_symbols, "Workspace Symbols")
local client = vim.lsp.get_client_by_id(event.data.client_id)
-- Highlight references on cursor hold
- if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
+ if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
local highlight_augroup = vim.api.nvim_create_augroup("lsp-highlight", { clear = false })
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
buffer = event.buf,
@@ -97,7 +115,7 @@ return {
end
-- Toggle inlay hints
- if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
+ if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
map("<leader>th", function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }))
end, "Toggle Inlay Hints")
diff --git a/lua/simenandre/plugins/telescope.lua b/lua/simenandre/plugins/telescope.lua
index 313a4ed..602cac1 100644
--- a/lua/simenandre/plugins/telescope.lua
+++ b/lua/simenandre/plugins/telescope.lua
@@ -2,7 +2,7 @@ return {
{ -- Fuzzy Finder (files, lsp, etc)
"nvim-telescope/telescope.nvim",
event = "VimEnter",
- branch = "0.1.x",
+ -- branch = "0.1.x", -- Pinned due to https://github.com/nvim-telescope/telescope.nvim/issues/3438
dependencies = {
"nvim-lua/plenary.nvim",
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
diff --git a/lua/simenandre/plugins/which-key.lua b/lua/simenandre/plugins/which-key.lua
index 74a83d1..1c36d18 100644
--- a/lua/simenandre/plugins/which-key.lua
+++ b/lua/simenandre/plugins/which-key.lua
@@ -42,12 +42,10 @@ return {
-- Document existing key chains
spec = {
- { "<leader>c", group = "[C]ode", mode = { "n", "x" } },
- { "<leader>d", group = "[D]ocument" },
- { "<leader>r", group = "[R]ename" },
+ { "gr", group = "LSP" },
{ "<leader>s", group = "[S]earch" },
- { "<leader>w", group = "[W]orkspace" },
{ "<leader>t", group = "[T]oggle" },
+ { "<leader>x", group = "Trouble" },
{ "<leader>h", group = "Git [H]unk", mode = { "n", "v" } },
},
},