feat: update to nvim 0.10

This commit is contained in:
Lucas Barbieri 2024-08-30 00:25:01 -03:00
parent c3509e44d8
commit e1b14db831
5 changed files with 111 additions and 86 deletions

View File

@ -31,6 +31,7 @@ require('lazy').setup({
-- Automatically install LSPs to stdpath for neovim -- Automatically install LSPs to stdpath for neovim
{ 'williamboman/mason.nvim', config = true }, { 'williamboman/mason.nvim', config = true },
'williamboman/mason-lspconfig.nvim', 'williamboman/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
{ {
'j-hui/fidget.nvim', 'j-hui/fidget.nvim',
@ -46,7 +47,18 @@ require('lazy').setup({
}, },
}, },
'folke/neodev.nvim', {
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
},
},
},
}, },
}, },
@ -136,9 +148,9 @@ vim.wo.number = true
-- Enable mouse mode -- Enable mouse mode
vim.o.mouse = 'a' vim.o.mouse = 'a'
-- Sync clipboard between OS and Neovim. vim.schedule(function()
-- See `:help 'clipboard'` vim.opt.clipboard = 'unnamedplus'
vim.o.clipboard = 'unnamedplus' end)
-- Enable break indent -- Enable break indent
vim.o.breakindent = true vim.o.breakindent = true
@ -386,32 +398,37 @@ local servers = {
}, },
} }
-- Setup neovim lua configuration
require('neodev').setup()
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers -- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.snippetSupport = true
-- Ensure the servers above are installed require('mason').setup()
local mason_lspconfig = require 'mason-lspconfig'
mason_lspconfig.setup { local ensure_installed = vim.tbl_keys(servers or {})
ensure_installed = vim.tbl_keys(servers), vim.list_extend(ensure_installed, {
} 'stylua',
'black',
'prettierd',
'gofumpt',
'goimports-reviser',
'golines',
'golangci-lint',
})
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
mason_lspconfig.setup_handlers { require('mason-lspconfig').setup {
handlers = {
function(server_name) function(server_name)
require('lspconfig')[server_name].setup { local server = servers[server_name] or {}
capabilities = capabilities, server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
on_attach = on_attach, require('lspconfig')[server_name].setup(server)
settings = servers[server_name], end,
filetypes = (servers[server_name] or {}).filetypes, },
}
end
} }
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
local mason_registry = require('mason-registry') local mason_registry = require('mason-registry')
@ -438,5 +455,17 @@ lspconfig.volar.setup {
}, },
}, },
} }
lspconfig.rust_analyzer.setup {
capabilities = capabilities,
on_attach = on_attach,
settings = {
['rust_analyzer'] = {
cargo = {
allFeatures = true,
}
}
}
}
-- this is for my personal config, i cant bother seeing every TJ's default and changing it to my own -- this is for my personal config, i cant bother seeing every TJ's default and changing it to my own
require("jabuxas") require("jabuxas")

View File

@ -62,35 +62,35 @@ return {
}, },
preselect = cmp.PreselectMode.None, preselect = cmp.PreselectMode.None,
completion = { completion = {
completeopt = "noselect,menuone,menu" completeopt = "menu,menuone,noinsert"
},
sorting = {
-- TODO: Would be cool to add stuff like "See variable names before method names" in rust, or something like that.
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
-- copied from cmp-under, but I don't think I need the plugin for this.
-- I might add some more of my own.
function(entry1, entry2)
local _, entry1_under = entry1.completion_item.label:find("^_+")
local _, entry2_under = entry2.completion_item.label:find("^_+")
entry1_under = entry1_under or 0
entry2_under = entry2_under or 0
if entry1_under > entry2_under then
return false
elseif entry1_under < entry2_under then
return true
end
end,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
}, },
-- sorting = {
-- -- TODO: Would be cool to add stuff like "See variable names before method names" in rust, or something like that.
-- comparators = {
-- cmp.config.compare.offset,
-- cmp.config.compare.exact,
-- cmp.config.compare.score,
--
-- -- copied from cmp-under, but I don't think I need the plugin for this.
-- -- I might add some more of my own.
-- function(entry1, entry2)
-- local _, entry1_under = entry1.completion_item.label:find("^_+")
-- local _, entry2_under = entry2.completion_item.label:find("^_+")
-- entry1_under = entry1_under or 0
-- entry2_under = entry2_under or 0
-- if entry1_under > entry2_under then
-- return false
-- elseif entry1_under < entry2_under then
-- return true
-- end
-- end,
--
-- cmp.config.compare.kind,
-- cmp.config.compare.sort_text,
-- cmp.config.compare.length,
-- cmp.config.compare.order,
-- },
-- },
mapping = cmp.mapping.preset.insert { mapping = cmp.mapping.preset.insert {
['<C-p>'] = cmp.mapping.select_next_item(), ['<C-p>'] = cmp.mapping.select_next_item(),
['<C-n>'] = cmp.mapping.select_prev_item(), ['<C-n>'] = cmp.mapping.select_prev_item(),
@ -121,30 +121,34 @@ return {
end, { 'i', 's' }), end, { 'i', 's' }),
}, },
sources = { sources = {
{
name = 'lazydev',
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
group_index = 0,
},
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = "orgmode" },
{ name = 'luasnip' }, { name = 'luasnip' },
{ name = 'path' }, { name = 'path' },
{ name = 'buffer' }, { name = 'buffer' },
}, },
formatting = { -- formatting = {
fields = { "abbr", "menu", "kind" }, -- fields = { "abbr", "menu", "kind" },
format = require('lspkind').cmp_format({ -- format = require('lspkind').cmp_format({
mode = 'symbol_text', -- show only symbol annotations -- mode = 'symbol_text', -- show only symbol annotations
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) -- maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
-- can also be a function to dynamically calculate max width such as -- -- can also be a function to dynamically calculate max width such as
-- maxwidth = function() return math.floor(0.45 * vim.o.columns) end, -- -- maxwidth = function() return math.floor(0.45 * vim.o.columns) end,
ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) -- ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
show_labelDetails = true, -- show labelDetails in menu. Disabled by default -- show_labelDetails = true, -- show labelDetails in menu. Disabled by default
--
-- The function below will be called before any actual modifications from lspkind -- -- The function below will be called before any actual modifications from lspkind
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) -- -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
}) -- })
}, -- },
window = { -- window = {
completion = cmp.config.window.bordered(winhighlight), -- completion = cmp.config.window.bordered(winhighlight),
documentation = cmp.config.window.bordered(winhighlight), -- documentation = cmp.config.window.bordered(winhighlight),
}, -- },
experimental = { experimental = {
ghost_text = true, ghost_text = true,

View File

@ -117,20 +117,16 @@ elseif fileContent == "solarized" then
'maxmx03/solarized.nvim', 'maxmx03/solarized.nvim',
lazy = false, lazy = false,
priority = 1000, priority = 1000,
config = function() ---@type solarized.config
vim.o.background = 'dark' opts = {
vim.o.termguicolors = true palette = 'solarized',
styles = {
require('solarized').setup({ comments = { italic = true, bold = false }
enables = {
bufferline = true,
cmp = true
}, },
pallete = "solarized", },
theme = "neo", config = function(_, opts)
transparent = true, vim.o.termguicolors = true
}) require('solarized').setup(opts)
vim.cmd.colorscheme 'solarized' vim.cmd.colorscheme 'solarized'
end, end,
} }

View File

@ -11,9 +11,6 @@ return {
require("null-ls").builtins.formatting.goimports_reviser, require("null-ls").builtins.formatting.goimports_reviser,
require("null-ls").builtins.formatting.golines, require("null-ls").builtins.formatting.golines,
require("null-ls").builtins.diagnostics.golangci_lint, require("null-ls").builtins.diagnostics.golangci_lint,
require("null-ls").builtins.formatting.google_java_format,
require("null-ls").builtins.formatting.nixpkgs_fmt,
require("null-ls").builtins.formatting.textidote,
} }
} }
end end

View File

@ -3,7 +3,6 @@ vim.opt.mouse = "a"
vim.opt.nu = true vim.opt.nu = true
vim.opt.relativenumber = true vim.opt.relativenumber = true
vim.opt.clipboard:append({ "unnamedplus" })
vim.opt.tabstop = 4 vim.opt.tabstop = 4
vim.opt.softtabstop = 4 vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4 vim.opt.shiftwidth = 4