Updated config

This commit is contained in:
2024-06-17 16:19:21 +02:00
parent cbc235c993
commit 33e490f05f
22 changed files with 59 additions and 135 deletions

View File

@ -0,0 +1,5 @@
return {
"windwp/nvim-autopairs",
event = "InsertEnter",
config = true,
}

View File

@ -0,0 +1,103 @@
return {
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
opts = {
servers = {
clangd = {},
gdscript = {},
gopls = {},
lua_ls = {
settings = {
Lua = {
completion = {
callSnippet = "Replace",
},
runtime = {
version = "LuaJIT",
},
workspace = {
checkThirdParty = false,
library = {
"${3rd}/luv/library",
unpack(vim.api.nvim_get_runtime_file("", true)),
},
},
},
},
},
rust_analyzer = {
settings = {
["rust-analyzer"] = {
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true
},
},
},
},
},
},
config = function(_, opts)
-- Servers
local servers = opts.servers
for server, server_opts in pairs(servers) do
require("lspconfig")[server].setup(server_opts)
end
-- Icons
local icons = {
Error = "",
Warn = "",
Hint = "",
Info = "",
}
for name, icon in pairs(icons) do
name = "DiagnosticSign" .. name
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
end
-- Runs when the LSP is attached
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }),
callback = function(event)
local function map(mode, lhs, rhs, info)
vim.keymap.set(mode, lhs, rhs, { buffer = event.buf, desc = "LSP: " .. info })
end
map("n", "gr", require("telescope.builtin").lsp_references, "References")
map("n", "gd", require("telescope.builtin").lsp_definitions, "Definition")
map({ "n", "i" }, "<f1>", vim.lsp.buf.hover, "Hover")
map({ "n", "i" }, "<f2>", vim.lsp.buf.rename, "Rename")
map({ "n", "i" }, "<C-f>", vim.lsp.buf.format, "Format")
map("n", "<leader>ca", vim.lsp.buf.code_action, "Code action")
-- Highlight the word your cursor is on
-- local client = vim.lsp.get_client_by_id(event.data.client_id)
--
-- if client and client.server_capabilities.documentHighlightProvider then
-- vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
-- buffer = event.buf,
-- callback = vim.lsp.buf.document_highlight,
-- })
--
-- vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
-- buffer = event.buf,
-- callback = vim.lsp.buf.clear_references,
-- })
-- end
end,
})
end,
}

View File

@ -0,0 +1,8 @@
return {
"echasnovski/mini.completion",
event = "InsertEnter",
opts = {
set_vim_settings = false,
},
config = true,
}

View File

@ -0,0 +1,18 @@
return {
"echasnovski/mini.surround",
event = { "BufReadPost", "BufNewFile" },
opts = {
mappings = {
add = 'gsa',
delete = 'gsd',
find = 'gsf',
find_left = 'gsF',
highlight = 'gsh',
replace = 'gsr',
update_n_lines = 'gsn',
suffix_last = '',
suffix_next = '',
},
},
config = true,
}

View File

@ -0,0 +1,14 @@
return {
"mg979/vim-visual-multi",
keys = {
{ "<C-d>", mode = { "n", "x" }, desc = "Multicursor (word)" },
{ "<C-Up>", mode = { "n", "x" }, desc = "Multicursor (next line)" },
{ "<C-Down>", mode = { "n", "x" }, desc = "Multicursor (previous line)" },
},
init = function()
vim.g.VM_maps = {
["Find Under"] = "<C-d>",
["Find Subword Under"] = "<C-d>",
}
end,
}

View File

@ -0,0 +1,17 @@
return {
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
},
opts = {
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
},
config = true,
}

View File

@ -0,0 +1,11 @@
return {
"rcarriga/nvim-notify",
event = "VeryLazy",
opts = {
background_colour = "#000000",
fps = 60,
render = "compact",
timeout = 0,
},
config = true,
}

View File

@ -0,0 +1,73 @@
local function on_attach(bufnr)
local api = require("nvim-tree.api")
-- default mappings
api.config.mappings.default_on_attach(bufnr)
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- navigation
vim.keymap.set("n", "<C-Up>", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "<C-Left>", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "<C-Down>", api.tree.change_root_to_node, opts("Enter"))
vim.keymap.set("n", "<C-Right>", api.tree.change_root_to_node, opts("Enter"))
-- open folders with a single click
vim.keymap.set("n", "<LeftRelease>", function()
vim.defer_fn(function ()
local win = vim.api.nvim_get_current_win()
local view = require("nvim-tree.view")
if view.get_winnr() ~= win then return end
api.node.open.edit()
api.tree.focus()
end, 10)
end, opts("Open folder/file"))
end
return {
"nvim-tree/nvim-tree.lua",
event = "VeryLazy",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
keys = {
{ "<leader>e", function() require("nvim-tree.api").tree.toggle() end, desc = "Toggle files" },
},
opts = {
filesystem_watchers = {
enable = true,
},
filters = {
dotfiles = false,
},
on_attach = on_attach,
renderer = {
root_folder_label = false,
highlight_git = true,
icons = {
show = {
git = false,
},
glyphs = {
git = {
unstaged = "",
untracked = "",
deleted = "",
},
},
},
},
sync_root_with_cwd = true,
update_focused_file = {
enable = true,
update_root = false,
},
view = {
width = 30,
},
},
config = true,
}