latest lsp config with mason and autocomplete
This commit is contained in:
@@ -30,30 +30,8 @@ vim.cmd("noswapfile")
|
|||||||
|
|
||||||
vim.cmd("set autoread")
|
vim.cmd("set autoread")
|
||||||
vim.cmd("set complete-=i")
|
vim.cmd("set complete-=i")
|
||||||
vim.cmd("set lazyredraw")
|
|
||||||
|
|
||||||
vim.cmd("au FileType python set fileformat=unix encoding=utf-8")
|
vim.cmd("au FileType python set fileformat=unix encoding=utf-8")
|
||||||
vim.cmd("au FileType markdown,tex set spell spelllang=en_us")
|
vim.cmd("au FileType markdown,tex set spell spelllang=en_us")
|
||||||
|
|
||||||
-- ------------------------------------------------------------------------
|
|
||||||
-- Auto‑reload buffers when files change externally
|
|
||||||
-- ------------------------------------------------------------------------
|
|
||||||
-- Ensure the option is enabled (already set above, but kept for clarity)
|
|
||||||
vim.cmd("set autoread")
|
|
||||||
|
|
||||||
-- Create a dedicated augroup to avoid duplicate autocommands if this file
|
|
||||||
-- is sourced multiple times (e.g., when using :source ~/.config/nvim/init.lua).
|
|
||||||
vim.api.nvim_create_augroup("AutoReload", { clear = true })
|
|
||||||
|
|
||||||
-- Run `checktime` for the following events:
|
|
||||||
-- * CursorHold, CursorHoldI – idle cursor, typical for auto‑check
|
|
||||||
-- * FocusGained – when you return to Neovim from another app
|
|
||||||
-- * BufEnter – when you jump to a buffer that may already be stale
|
|
||||||
vim.api.nvim_create_autocmd(
|
|
||||||
{ "CursorHold", "CursorHoldI", "FocusGained", "BufEnter" },
|
|
||||||
{
|
|
||||||
group = "AutoReload",
|
|
||||||
pattern = "*",
|
|
||||||
command = "silent! checktime",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
{
|
{
|
||||||
"black-metal-theme-neovim": { "branch": "main", "commit": "6d0207871387077f40d5396ab1ae90520e688d36" },
|
"black-metal-theme-neovim": { "branch": "main", "commit": "6d0207871387077f40d5396ab1ae90520e688d36" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "3b3571b4dadbcb464804466e9872e7246c316af7" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
|
||||||
|
"mini.completion": { "branch": "main", "commit": "7c5edfc0e479dd4edd898cc9ddd1920d8c1ce420" },
|
||||||
|
"mini.nvim": { "branch": "main", "commit": "6bd3a01aaf7d248aea1b78aacdd5d44bffa002c1" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "07f4e93de92e8d4ea7ab99602e3a8c9ac0fb778a" },
|
"nvim-lspconfig": { "branch": "master", "commit": "07f4e93de92e8d4ea7ab99602e3a8c9ac0fb778a" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||||
|
|||||||
@@ -31,5 +31,5 @@ require("lazy").setup({
|
|||||||
-- colorscheme that will be used when installing plugins.
|
-- colorscheme that will be used when installing plugins.
|
||||||
-- install = { colorscheme = { "habamax" } },
|
-- install = { colorscheme = { "habamax" } },
|
||||||
-- automatically check for plugin updates
|
-- automatically check for plugin updates
|
||||||
checker = { enabled = true },
|
-- checker = { enabled = true },
|
||||||
})
|
})
|
||||||
|
|||||||
54
.config/nvim/lua/plugins/mason.lua
Normal file
54
.config/nvim/lua/plugins/mason.lua
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
return {
|
||||||
|
"mason-org/mason-lspconfig.nvim",
|
||||||
|
dependencies = {
|
||||||
|
{"mason-org/mason.nvim"},
|
||||||
|
{'neovim/nvim-lspconfig'},
|
||||||
|
|
||||||
|
{'nvim-mini/mini.nvim'},
|
||||||
|
{'nvim-mini/mini.completion'},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("mason").setup()
|
||||||
|
require("mason-lspconfig").setup {}
|
||||||
|
|
||||||
|
-- NOTE: this is meant to be backwards compatible with Neovim v0.9
|
||||||
|
---
|
||||||
|
-- Autocompletion
|
||||||
|
---
|
||||||
|
|
||||||
|
require('mini.snippets').setup()
|
||||||
|
require('mini.completion').setup()
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Language server configuration
|
||||||
|
---
|
||||||
|
|
||||||
|
-- These keymaps are the defaults in Neovim v0.10
|
||||||
|
if vim.fn.has('nvim-0.11') == 0 then
|
||||||
|
-- NOTE: vim.diagnostic.goto_* methods are deprecated in v0.11
|
||||||
|
-- that's why we put these under a conditional block
|
||||||
|
vim.keymap.set('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>')
|
||||||
|
vim.keymap.set('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>')
|
||||||
|
vim.keymap.set('n', '<C-w>d', '<cmd>lua vim.diagnostic.open_float()<cr>')
|
||||||
|
vim.keymap.set('n', '<C-w><C-d>', '<cmd>lua vim.diagnostic.open_float()<cr>')
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
callback = function(event)
|
||||||
|
local bufmap = function(mode, rhs, lhs)
|
||||||
|
vim.keymap.set(mode, rhs, lhs, {buffer = event.buf})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- These keymaps are the defaults in Neovim v0.11
|
||||||
|
bufmap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>')
|
||||||
|
bufmap('n', 'grr', '<cmd>lua vim.lsp.buf.references()<cr>')
|
||||||
|
bufmap('n', 'gri', '<cmd>lua vim.lsp.buf.implementation()<cr>')
|
||||||
|
bufmap('n', 'grn', '<cmd>lua vim.lsp.buf.rename()<cr>')
|
||||||
|
bufmap('n', 'gra', '<cmd>lua vim.lsp.buf.code_action()<cr>')
|
||||||
|
bufmap('n', 'gO', '<cmd>lua vim.lsp.buf.document_symbol()<cr>')
|
||||||
|
bufmap({'i', 's'}, '<C-s>', '<cmd>lua vim.lsp.buf.signature_help()<cr>')
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
end
|
||||||
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
-- plugins/telescope.lua:
|
|
||||||
return {
|
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
config = function()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user