fixed config and plugins

This commit is contained in:
λmolinae 2025-01-22 10:36:00 -06:00
parent 4f6a4c571d
commit aaa91a6169
12 changed files with 125 additions and 142 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
.luarc.json
lazy-lock.json

View file

@ -1,36 +1,29 @@
-- Set up nvim-cmp.
local cmp = require'cmp'
require("luasnip.loaders.from_vscode").lazy_load()
local cmp = require'cmp'
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
-- { name = 'nvim_lsp' },
{ name = 'luasnip' }, -- For luasnip users.
}, {
{ name = 'buffer' },
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' }, -- For luasnip users.
}, {
{ name = 'buffer' },
-- { name = 'path' },
-- { name = 'cmdline' },
})
})
})
-- 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' }
}
})

View file

@ -1,2 +0,0 @@
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup({})

View file

@ -1,9 +0,0 @@
require("mason").setup({
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = ""
}
}
})

View file

@ -1,41 +0,0 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the listed parsers MUST always be installed)
ensure_installed = { "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,
-- List of parsers to ignore installing (or "all")
ignore_install = { "javascript" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
disable = { "c", "rust" },
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
-- 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

@ -2,18 +2,31 @@ return {
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp"
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-path",
"hrsh7th/cmp-buffer"
},
opts = function()
require "config.plugins.cmp"
end,
},
{
"hrsh7th/cmp-nvim-lsp",
dependencies = {},
config = function ()
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require('lspconfig').clangd.setup {
capabilities = capabilities,
}
end,
},
{
"L3MON4D3/LuaSnip",
dependencies = {
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets"
dependencies = {
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets"
},
opts = {}
},
}
}

View file

@ -1,34 +1,36 @@
return {
{
"neovim/nvim-lspconfig",
opts = {
require("mason").setup({
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = ""
}
}
})
}
},
{
"williamboman/mason.nvim",
opts = function()
require "config.plugins.mason"
dependencies= {},
config = function()
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup({})
vim.keymap.set('n', 'K', vim.lsp.buf.hover, {})
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
vim.keymap.set({'n', 'v'}, '<space>ca', vim.lsp.buf.code_action, {})
end,
},
{
"williamboman/mason-lspconfig.nvim",
dependencies = {
"williamboman/mason.nvim",
"neovim/nvim-lspconfig"
},
"williamboman/mason.nvim",
dependencies = {},
opts = {
require("mason-lspconfig").setup({
ensure_installed = { "lua_ls" },
})
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = ""
}
}
}
},
{
"williamboman/mason-lspconfig.nvim",
dependencies = {},
config = function()
require("mason-lspconfig").setup {
ensure_installed = { "lua_ls" },
}
end,
}
}

View file

@ -1,21 +0,0 @@
return {
{
"williamboman/mason.nvim",
dependencies = {},
opts = function()
require "config.plugins.mason"
end,
},
{
"williamboman/mason-lspconfig.nvim",
dependencies = {
"williamboman/mason.nvim",
"neovim/nvim-lspconfig"
},
opts = {
require("mason-lspconfig").setup({
ensure_installed = { "lua_ls" },
})
}
},
}

15
lua/plugins/nonels.lua Normal file
View file

@ -0,0 +1,15 @@
return {
{
"nvimtools/none-ls.nvim",
config = function()
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.stylua,
-- null_ls.builtins.completion.spell,
},
})
vim.keymap.set("n", "<space>gf", vim.lsp.buf.format, {})
end,
},
}

24
lua/plugins/telescope.lua Normal file
View file

@ -0,0 +1,24 @@
return {
{
"nvim-telescope/telescope.nvim",
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<C-p>', builtin.find_files, { desc = 'Telescope find files' })
vim.keymap.set('n', '<C-g>', builtin.live_grep, { desc = 'Telescope live grep' })
end,
},
{
"nvim-telescope/telescope-ui-select.nvim",
config = function()
require("telescope").setup {
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {}
}
}
}
require("telescope").load_extension("ui-select")
end,
}
}

View file

@ -0,0 +1,13 @@
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
dependencies = {},
opts = {
auto_install = true,
ensure_installed = { "lua" },
highlight = { enable = true },
indent = { enable = true }
}
}
}

View file

@ -20,11 +20,6 @@ return {
{
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPost", "BufNewFile" },
opts = function()
return require "config.plugins.treesitter"
end,
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
opts = {}
},
}