Compare commits
2 Commits
cf1e2e38ed
...
08ec842f0d
| Author | SHA1 | Date | |
|---|---|---|---|
| 08ec842f0d | |||
| 67e4663479 |
@ -1,8 +1,16 @@
|
|||||||
{
|
{
|
||||||
|
"LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" },
|
||||||
"catppuccin": { "branch": "main", "commit": "beaf41a30c26fd7d6c386d383155cbd65dd554cd" },
|
"catppuccin": { "branch": "main", "commit": "beaf41a30c26fd7d6c386d383155cbd65dd554cd" },
|
||||||
|
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||||
"gruvbox.nvim": { "branch": "main", "commit": "a472496e1a4465a2dd574389dcf6cdb29af9bf1b" },
|
"gruvbox.nvim": { "branch": "main", "commit": "a472496e1a4465a2dd574389dcf6cdb29af9bf1b" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "80c0130c5f16b551865a69e832f1feadeedb5fbe" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "85bbfad83f804f11688d1ab9486b459e699292d6" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "92ee7d42320edfbb81f3cad851314ab197fa324a" },
|
||||||
|
"nvim-tree.lua": { "branch": "master", "commit": "ca8d82fff26cb12ced239713e3222f4a9dcd0da0" },
|
||||||
"nvim-treesitter": { "branch": "main", "commit": "5a7e5638e7d220575b1c22c8a2e099b52231886e" },
|
"nvim-treesitter": { "branch": "main", "commit": "5a7e5638e7d220575b1c22c8a2e099b52231886e" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "a8c2223ea6b185701090ccb1ebc7f4e41c4c9784" },
|
"telescope.nvim": { "branch": "master", "commit": "a8c2223ea6b185701090ccb1ebc7f4e41c4c9784" },
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }
|
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }
|
||||||
|
|||||||
@ -19,8 +19,10 @@ vim.opt.rtp:prepend(lazypath)
|
|||||||
-- Initialize lazy.nvim
|
-- Initialize lazy.nvim
|
||||||
local plugins = {
|
local plugins = {
|
||||||
require("plugins.colorschemes"), -- theme
|
require("plugins.colorschemes"), -- theme
|
||||||
|
require("plugins.lsp"), -- LSP
|
||||||
require("plugins.telescope"), -- fuzzy finder
|
require("plugins.telescope"), -- fuzzy finder
|
||||||
require("plugins.treesitter"), -- syntax tree
|
require("plugins.treesitter"), -- syntax tree
|
||||||
|
require("plugins.ui"), -- UI
|
||||||
}
|
}
|
||||||
|
|
||||||
require("lazy").setup(plugins)
|
require("lazy").setup(plugins)
|
||||||
|
|||||||
114
lua/plugins/lsp.lua
Normal file
114
lua/plugins/lsp.lua
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
return {
|
||||||
|
-- LSP installer
|
||||||
|
{ "williamboman/mason.nvim", config = true },
|
||||||
|
{ "williamboman/mason-lspconfig.nvim", config = true },
|
||||||
|
|
||||||
|
-- LSP configuration
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
config = function()
|
||||||
|
-- Initialize Mason
|
||||||
|
require("mason").setup()
|
||||||
|
require("mason-lspconfig").setup()
|
||||||
|
|
||||||
|
-- Lua for vim
|
||||||
|
vim.lsp.config("lua_ls", {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
globals = { "vim" }, -- recognize 'vim' as a global
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
library = vim.api.nvim_get_runtime_file("", true), -- includes Neovim runtime files
|
||||||
|
checkThirdParty = false, -- optional, avoids prompts about unknown libraries
|
||||||
|
},
|
||||||
|
telemetry = { enable = false }, -- optional, disable telemetry
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
vim.lsp.enable("lua_ls")
|
||||||
|
|
||||||
|
-- C/C++
|
||||||
|
vim.lsp.config("clangd", {})
|
||||||
|
vim.lsp.enable("clangd")
|
||||||
|
|
||||||
|
-- Rust
|
||||||
|
vim.lsp.config("rust_analyzer", {})
|
||||||
|
vim.lsp.enable("rust_analyzer")
|
||||||
|
|
||||||
|
-- Floating diagnostic on hover
|
||||||
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
|
callback = function()
|
||||||
|
vim.diagnostic.open_float(nil, { focusable = false })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Enable virtual text and signs
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = false,
|
||||||
|
signs = true,
|
||||||
|
underline = true,
|
||||||
|
update_in_insert = false,
|
||||||
|
severity_sort = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Optional: add keymaps
|
||||||
|
local keymap = vim.keymap
|
||||||
|
keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" })
|
||||||
|
keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Hover documentation" })
|
||||||
|
keymap.set("n", "gr", vim.lsp.buf.references, { desc = "References" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Completion
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local cmp = require("cmp")
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require("luasnip").lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||||
|
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
dependencies = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip" },
|
||||||
|
config = function()
|
||||||
|
local cmp = require("cmp")
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require("luasnip").lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||||
|
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
36
lua/plugins/ui.lua
Normal file
36
lua/plugins/ui.lua
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-tree/nvim-tree.lua",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons" }, -- optional, adds file icons
|
||||||
|
config = function()
|
||||||
|
require("nvim-tree").setup({
|
||||||
|
disable_netrw = true, -- disable netrw (default file explorer)
|
||||||
|
hijack_netrw = true, -- replace netrw with nvim-tree
|
||||||
|
open_on_tab = false,
|
||||||
|
hijack_cursor = false,
|
||||||
|
update_cwd = true,
|
||||||
|
diagnostics = {
|
||||||
|
enable = true,
|
||||||
|
icons = {
|
||||||
|
hint = "H",
|
||||||
|
info = "I",
|
||||||
|
warning = "W",
|
||||||
|
error = "E",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
git = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
view = {
|
||||||
|
width = 30,
|
||||||
|
side = "left",
|
||||||
|
number = false,
|
||||||
|
relativenumber = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Optional keymap to toggle the tree
|
||||||
|
vim.keymap.set("n", "<leader>e", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle file explorer" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user