Compare commits

...

4 Commits

Author SHA1 Message Date
Tristan Russell d7afbaa999
feat: Removed some settings from the treesitter config. 2025-11-27 20:48:01 -05:00
Tristan Russell 30c69e43ec
feat: Added basic none-ls 2025-11-27 20:38:31 -05:00
Tristan Russell 702183612a
feat: Added luasnip completions
chore: Moved completion configuration to its own file
2025-11-27 20:37:00 -05:00
Tristan Russell 521c3c332d
feat: Added nvim-lspconfig for automatic LSP configuration
feat: Configured LSPs to use nvim-lspconfig instead of manually configuring each one.
2025-11-27 20:28:29 -05:00
5 changed files with 111 additions and 66 deletions

72
after/plugin/cmp.lua Normal file
View File

@ -0,0 +1,72 @@
local cmp = require("cmp")
cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
--vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
end,
},
window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
['<C-Space>'] = cmp.mapping.complete(),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' }, -- For luasnip users.
{ name = 'buffer' },
{
name = 'path',
option = {
pathMappings = {
['@'] = '${folder}/src',
-- ['/'] = '${folder}/src/public/',
-- ['~@'] = '${folder}/src',
-- ['/images'] = '${folder}/src/images',
-- ['/components'] = '${folder}/src/components',
},
},
},
}),
completion = {
completeopt = 'menu,menuone,noinsert',
},
})
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources(
{
{ name = 'path' }
},
{
{
name = 'cmdline',
option = {
ignore_cmds = { 'Man', '!' }
}
}
})
})
-- Set up lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
--require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
-- capabilities = capabilities
--}

View File

@ -1,34 +1,5 @@
require("mason").setup()
local cmp = require('cmp')
local cmp_select = {behavior = cmp.SelectBehavior.Select}
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
['<C-Space>'] = cmp.mapping.complete(),
}),
sources = cmp.config.sources(
{
{ name = 'nvim_lsp' },
{ name = 'luasnip' }
},
{
{ name = 'buffer' },
{ name = 'path' },
{ name = 'cmdline' }
}),
completion = {
completeopt = 'menu,menuone,noinsert',
},
})
vim.lsp.enable("lua_ls")
vim.lsp.config("lua_ls", {
on_init = function(client)
@ -56,38 +27,34 @@ vim.lsp.config("lua_ls", {
}
})
vim.lsp.enable("clangd")
vim.lsp.config("clangd", {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
cmd = {
"clangd",
"--background-index",
"--clang-tidy",
"--completion-style=detailed",
"--all-scopes-completion",
}
--vim.lsp.enable("clangd")
vim.lsp.enable("rust_analyzer")
vim.lsp.config("rust_analyzer", {
cmd = { "~/.local/share/nvim/mason/bin/rust-analyzer" },
})
vim.lsp.enable("pyright")
vim.lsp.config("pyright", {})
vim.lsp.config("pyright", {
cmd = { "~/.local/share/nvim/mason/bin/pyright-langserver", "--stdio" },
})
vim.lsp.enable("html")
vim.lsp.config("html", {})
vim.lsp.enable("angularls")
vim.lsp.config("angularls", {})
vim.lsp.config("html", {
cmd = { "~/.local/share/nvim/mason/packages/html-lsp/node_modules/.bin/vscode-html-language-server", "--stdio" },
})
--vim.lsp.enable("angularls")
--vim.lsp.config("angularls", {
-- cmd = { "ngserver", "--stdio", "--tsProbeLocations", "../..,?/node_modules", "--ngProbeLocations", "../../@angular/language-server/node_modules,?/node_modules/@angular/language-server/node_modules", "--angularCoreVersion", "" },
--})
vim.lsp.enable("ts_ls")
vim.lsp.config("ts_ls", {
cmd = { "/usr/lib/node_modules/typescript-language-server/lib/cli.mjs", "--stdio" },
filetypes = { "javascript", "typescript", "javascriptreact", "typescriptreact" },
init_options = {
plugins = {},
},
on_attach = function(client, bufnr)
client.server_capabilities.documentFormattingProvider = false -- Optional
end
cmd = { "~/.local/share/nvim/mason/packages/typescript-language-server/node_modules/typescript-language-server/lib/cli.mjs", "--stdio" },
})
vim.lsp.enable("java-language-server")
vim.lsp.config("java-language-server", {
cmd = {"java-language-server"}
vim.lsp.enable("jdtls")
vim.lsp.config("jdtls", {
cmd = { vim.fn.expand("~/.local/share/nvim/mason/bin/jdtls") },
})

9
after/plugin/null.lua Normal file
View File

@ -0,0 +1,9 @@
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.stylua,
null_ls.builtins.completion.spell,
--require("none-ls.diagnostics.eslint"), -- requires none-ls-extras.nvim
},
})

View File

@ -1,21 +1,9 @@
require 'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the listed parsers MUST always be installed)
ensure_installed = { "javascript", "typescript", "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}

View File

@ -34,6 +34,15 @@ require("lazy").setup({
{ -- Formatter, Linter, etc bridge??
'nvimtools/none-ls.nvim'
},
{ -- LSP Configuration tool
'neovim/nvim-lspconfig'
},
{ -- Snippet engine?
"L3MON4D3/LuaSnip",
version = "v2.4", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
-- install jsregexp (optional!).
build = "make install_jsregexp"
},
{ -- Code completion
'hrsh7th/nvim-cmp'
},