Refactor plugins

- Add marks.nvim
- Use mason to setup LSP
  - config lua_ls for neovim config
- Disable treesitter
- Remove scroll plugin
- Remove mini-animate
This commit is contained in:
leafee98 2024-08-22 22:54:58 +08:00
parent 4a656ab848
commit e777101523
7 changed files with 91 additions and 41 deletions

View file

@ -29,7 +29,7 @@ vim.g.maplocalleader = " "
vim.keymap.set("n", "\\\\", "<cmd>split<cr>", { silent = true }) vim.keymap.set("n", "\\\\", "<cmd>split<cr>", { silent = true })
vim.keymap.set("n", "||", "<cmd>vsplit<cr>", { silent = true }) vim.keymap.set("n", "||", "<cmd>vsplit<cr>", { silent = true })
vim.keymap.set("n", "\\q", "<cmd>wincmd q<cr>", { silent = true }) vim.keymap.set("n", "<leader>q", "<cmd>wincmd q<cr>", { silent = true })
vim.keymap.set("n", "<C-h>", "<cmd>wincmd h<cr>", { silent = true }) vim.keymap.set("n", "<C-h>", "<cmd>wincmd h<cr>", { silent = true })
vim.keymap.set("n", "<C-j>", "<cmd>wincmd j<cr>", { silent = true }) vim.keymap.set("n", "<C-j>", "<cmd>wincmd j<cr>", { silent = true })
vim.keymap.set("n", "<C-k>", "<cmd>wincmd k<cr>", { silent = true }) vim.keymap.set("n", "<C-k>", "<cmd>wincmd k<cr>", { silent = true })

View file

@ -18,22 +18,23 @@ return {
}, },
}, },
}, },
{
"NMAC427/guess-indent.nvim",
},
{
"chentoast/marks.nvim",
opts = {
builtin_marks = { ".", "<", ">", "^" },
mappings = {
next = "]m",
prev = "[m",
},
},
},
{ {
"famiu/bufdelete.nvim", "famiu/bufdelete.nvim",
keys = { keys = {
{ "<leader>c", "<cmd>Bdelete<cr>", mode = "n" }, { "<leader>c", "<cmd>Bdelete<cr>", mode = "n" },
}, },
}, },
{
"dstein64/nvim-scrollview",
enabled = custom.full_feature,
event = "VeryLazy",
opts = {
excluded_filetypes = { "NvimTree" },
current_only = false,
base = "right",
signs_on_startup = { "all" },
diagnostics_severities = { vim.diagnostic.severity.ERROR }
},
}
} }

View file

@ -1,5 +1,6 @@
return { return {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
enabled = false,
name = "nvim-treesitter", name = "nvim-treesitter",
event = "VeryLazy", event = "VeryLazy",
build = ":TSUpdate", build = ":TSUpdate",

View file

@ -36,6 +36,29 @@ function setup_keymap_lsp()
}) })
end end
local lua_ls_opts = {
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { "vim" },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
},
}
return { return {
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
@ -47,21 +70,32 @@ return {
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline", "hrsh7th/cmp-cmdline",
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"mfussenegger/nvim-lint",
"mhartington/formatter.nvim",
}, },
event = { "BufReadPre", "BufNewFile", "VeryLazy" }, event = { "BufReadPre", "BufNewFile", "VeryLazy" },
cmd = { "LspInfo", "LspInstall", "LspUninstall" }, cmd = { "LspInfo", "LspInstall", "LspUninstall" },
config = function (_, opts) config = function (_, opts)
local capabilities = require("cmp_nvim_lsp").default_capabilities() local mason = require("mason")
local mason_lsp = require("mason-lspconfig")
local servers = { "clangd", "rust_analyzer", "pyright", "gopls", "quick_lint_js" }
for _, lsp in ipairs(servers) do
require("lspconfig")[lsp].setup{
capabilities = capabilities,
}
end
local luasnip = require("luasnip") local luasnip = require("luasnip")
local cmp = require("cmp") local cmp = require("cmp")
mason.setup()
mason_lsp.setup()
mason_lsp.setup_handlers {
function (server_name) -- default handler (optional)
require("lspconfig")[server_name].setup {}
end,
["lua_ls"] = function ()
require("lspconfig")["lua_ls"].setup(lua_ls_opts)
end
}
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)

View file

@ -1,3 +0,0 @@
return {
"NMAC427/guess-indent.nvim",
}

View file

@ -1,8 +0,0 @@
return {
"echasnovski/mini.animate",
main = "mini.animate",
opt = {},
config = function()
require("mini.animate").setup()
end,
}

View file

@ -3,13 +3,38 @@ return {
event = "VeryLazy", event = "VeryLazy",
opts = { ignored_filetypes = { "nofile", "quickfix", "qf", "prompt" }, ignored_buftypes = { "nofile" } }, opts = { ignored_filetypes = { "nofile", "quickfix", "qf", "prompt" }, ignored_buftypes = { "nofile" } },
keys = { keys = {
{ "<c-h>", function() require("smart-splits").move_cursor_left() end, desc = "Move to left split" }, {
{ "<c-j>", function() require("smart-splits").move_cursor_down() end, desc = "Move to below split" }, "<c-h>",
{ "<c-k>", function() require("smart-splits").move_cursor_up() end, desc = "Move to above split" }, function() require("smart-splits").move_cursor_left() end,
{ "<c-l>", function() require("smart-splits").move_cursor_right() end, desc = "Move to right split" }, desc = "Move to left split"
{ "<c-up>", function() require("smart-splits").resize_up() end, desc = "Resize split up" }, },
{ "<c-down>", function() require("smart-splits").resize_down() end, desc = "Resize split down" }, {
{ "<c-left>", function() require("smart-splits").resize_left() end, desc = "Resize split left" }, "<c-j>", function() require("smart-splits").move_cursor_down() end,
{ "<c-right>", function() require("smart-splits").resize_right() end, desc = "Resize split right" }, desc = "Move to below split"
},
{
"<c-k>", function() require("smart-splits").move_cursor_up() end,
desc = "Move to above split"
},
{
"<c-l>", function() require("smart-splits").move_cursor_right() end,
desc = "Move to right split"
},
{
"<c-up>", function() require("smart-splits").resize_up() end,
desc = "Resize split up"
},
{
"<c-down>", function() require("smart-splits").resize_down() end,
desc = "Resize split down"
},
{
"<c-left>", function() require("smart-splits").resize_left() end,
desc = "Resize split left"
},
{
"<c-right>", function() require("smart-splits").resize_right() end,
desc = "Resize split right"
},
}, },
} }