New: NVIM Config
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
-- lua/plugins/bufferline.lua
|
||||
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
mode = "buffers", -- show buffers, not tabs
|
||||
diagnostics = "nvim_lsp",
|
||||
show_buffer_close_icons = false,
|
||||
show_close_icon = false,
|
||||
separator_style = "thin",
|
||||
always_show_bufferline = true,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
-- lua/plugins/cmp.lua
|
||||
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
-- Setup nvim-cmp.
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body) -- Use LuaSnip to expand snippets
|
||||
end,
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-k>'] = cmp.mapping.select_prev_item(), -- Move up on suggestion list
|
||||
['<C-j>'] = cmp.mapping.select_next_item(), -- Move down on suggestion list
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4), -- Scroll docs up
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4), -- Scroll docs down
|
||||
['<C-Space>'] = cmp.mapping.complete(), -- Trigger completion menu
|
||||
['<C-e>'] = cmp.mapping.abort(), -- Close completion window
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Enter to confirm selection
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' }, -- LSP suggestions (your language servers)
|
||||
{ name = 'luasnip' }, -- Snippets suggestions
|
||||
{ name = 'buffer' }, -- Words from open buffers
|
||||
{ name = 'path' }, -- File paths
|
||||
}),
|
||||
})
|
||||
@@ -0,0 +1,14 @@
|
||||
-- lua/plugins/colorscheme.lua
|
||||
|
||||
|
||||
|
||||
require('github-theme').setup({
|
||||
})
|
||||
|
||||
vim.cmd("colorscheme github_dark_default")
|
||||
|
||||
-- Optional: set contrast, italic comments, etc
|
||||
vim.g.gruvbox_contrast_dark = "hard" -- options: "soft", "medium", "hard"
|
||||
vim.g.gruvbox_invert_selection = "0"
|
||||
vim.g.gruvbox_italic = 1
|
||||
vim.g.gruvbox_bold = 1
|
||||
@@ -0,0 +1,52 @@
|
||||
-- Modern LSP setup for Neovim 0.11+
|
||||
-- Compatible with LazyVim and nvim-lspconfig >= v0.2.1
|
||||
|
||||
-- Load Mason to manage LSP servers
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = { "lua_ls", "ts_ls", "pyright", "clangd" },
|
||||
})
|
||||
|
||||
-- New Neovim 0.11 API for configuring LSPs
|
||||
local lsp = vim.lsp
|
||||
local configs = lsp.configs
|
||||
local util = require("lspconfig.util")
|
||||
|
||||
-- Function that runs when an LSP attaches
|
||||
local on_attach = function(client, bufnr)
|
||||
local opts = { buffer = bufnr, noremap = true, silent = true }
|
||||
local map = vim.keymap.set
|
||||
map("n", "gd", vim.lsp.buf.definition, opts, { desc = "Go to definition" })
|
||||
map("n", "K", vim.lsp.buf.hover, opts, { desc = "Hover documentation" })
|
||||
map("n", "<leader>rn", vim.lsp.buf.rename, opts, { desc = "Rename symbol" })
|
||||
map("n", "<leader>ca", vim.lsp.buf.code_action, opts, { desc = "Code action" })
|
||||
map("n", "gr", vim.lsp.buf.references, opts, { desc = "Go to references" })
|
||||
map("n", "<leader>e", vim.diagnostic.open_float, opts, { desc = "Show diagnostics" })
|
||||
end
|
||||
|
||||
-- Default capabilities (for autocompletion)
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
-- Configure LSP servers
|
||||
local servers = {
|
||||
lua_ls = { cmd = { "lua-language-server" } },
|
||||
ts_ls = { cmd = { "typescript-language-server", "--stdio" } },
|
||||
pyright = { cmd = { "pyright-langserver", "--stdio" } },
|
||||
clangd = {
|
||||
cmd = { "clangd" },
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
init_options = {
|
||||
clangdFileStatus = true,
|
||||
fallbackFlags = { "-style={UseTab: ForIndentation}" },
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
for name, config in pairs(servers) do
|
||||
vim.lsp.config[name] = vim.tbl_extend("force", {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}, config)
|
||||
vim.lsp.start(vim.lsp.config[name])
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
-- lua/plugins/lualine.lua
|
||||
|
||||
|
||||
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = "auto", -- this auto-syncs with your colorscheme
|
||||
icons_enabled = true,
|
||||
section_separators = '',
|
||||
component_separators = '',
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user