chore(neovim):

- Keymap: remove <tab> to switch buffer
- Completion: Remove mini.completion plugins - conflicting
- Completion: Use luasnip buffer for completion
- Lua: Use lazydev for better nvim lua diagnostics
This commit is contained in:
Pratik Tripathy
2024-12-16 21:46:06 +05:30
parent cb7053fdce
commit 20b3597501
5 changed files with 26 additions and 8 deletions

View File

@@ -41,12 +41,6 @@ vim.keymap.set("i", ".", ".<C-g>u", { desc = "Auto add undo breakpoints on '.'"
vim.keymap.set("i", ";", ";<C-g>u", { desc = "Auto add undo breakpoints on ';'" })
vim.keymap.set("i", "\r", "\r<C-g>u", { desc = "Auto add undo breakpoints on new lines" })
-- Traverse Buffer
if require("config.util").is_not_vscode() then
vim.keymap.set("n", "<Tab>", "<cmd>bnext<CR>", { desc = "Switch to next buffer" })
vim.keymap.set("n", "<S-Tab>", "<cmd>bprevious<CR>", { desc = "Switch to previous buffer" })
end
-- Save file
vim.keymap.set({ "i", "x", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" })
vim.keymap.set({ "i", "x", "n", "s" }, "<C-q>", "<cmd>wqa<cr><esc>", { desc = "Save all files and Quit Neovim" })

View File

@@ -100,8 +100,8 @@ return {
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
{ { name = "buffer" } },
},
sorting = defaults.sorting,
})

View File

@@ -160,7 +160,7 @@ return {
require("mini.comment").setup()
require("mini.pairs").setup()
require("mini.completion").setup()
-- require("mini.completion").setup()
end,
},

View File

@@ -194,6 +194,7 @@ return {
-- Add other tools here that you want Mason to install for you
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
"shfmt",
"stylua",
"codespell",
"bash-language-server",
@@ -205,6 +206,7 @@ return {
})
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
---@diagnostic disable-next-line: missing-fields
require("mason-lspconfig").setup({
handlers = {
function(server_name)

View File

@@ -106,4 +106,26 @@ return {
},
},
},
{
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
},
{
"hrsh7th/nvim-cmp",
opts = function(_, opts)
opts.sources = opts.sources or {}
table.insert(opts.sources, {
name = "lazydev",
group_index = 0, -- set group index to 0 to skip loading LuaLS completions
})
end,
},
}