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

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

View File

@ -6,4 +6,4 @@ return {
{ "S", function() require("flash").treesitter() end, mode = { "n", "o", "x" }, desc = "Flash Treesitter" },
},
config = true,
}
}

View File

@ -2,4 +2,4 @@ return {
"lewis6991/gitsigns.nvim",
event = "BufReadPre",
config = true,
}
}

View File

@ -1,103 +0,0 @@
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

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

View File

@ -1,18 +0,0 @@
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

@ -1,14 +0,0 @@
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

@ -1,17 +0,0 @@
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

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

View File

@ -1,20 +1,14 @@
return {
"nvim-telescope/telescope.nvim",
event = "VeryLazy",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-project.nvim",
-- "nvim-telescope/telescope-ui-select.nvim",
},
keys = {
{"<C-Tab>", "<cmd>Telescope buffers<cr>", desc = "Buffers"},
{"<leader>f", "<cmd>Telescope find_files<cr>", desc = "Find files"},
{"<leader>h", "<cmd>Telescope help_tags<cr>", desc = "Help"},
{"<leader>p", "<cmd>Telescope project<cr>", desc = "Projects"},
{"<leader>r", "<cmd>Telescope oldfiles<cr>", desc = "Recent files"},
{"<leader>w", "<cmd>Telescope grep_string<cr>", desc = "Word"},
{"<leader>ds", "<cmd>Telescope lsp_document_symbols<cr>", desc = "Document symbols"},
{"<leader>ws", "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", desc = "Workspace symbols"},
},
config = function()
require("telescope").setup({
@ -36,14 +30,7 @@ return {
sync_with_nvim_tree = true,
theme = "dropdown",
},
-- ["ui-select"] = {
-- require("telescope.themes").get_dropdown(),
-- },
},
})
require("telescope").load_extension("project")
require("telescope").load_extension("notify")
-- require("telescope").load_extension("ui-select")
end,
}

View File

@ -1,73 +0,0 @@
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,
}

View File

@ -4,30 +4,10 @@ return {
build = ":TSUpdate",
opts = {
ensure_installed = {
-- basics
"bash",
"json",
"markdown",
"markdown_inline",
"lua",
"regex",
"vim",
-- go
"go",
"gomod",
"gowork",
"gosum",
-- web dev
"html",
"css",
"javascript",
"typescript",
"svelte",
-- game dev
"gdscript",
},
highlight = { enable = true },
indent = { enable = true },