feat: update to nvim 0.10
This commit is contained in:
parent
c3509e44d8
commit
e1b14db831
73
init.lua
73
init.lua
@ -31,6 +31,7 @@ require('lazy').setup({
|
||||
-- Automatically install LSPs to stdpath for neovim
|
||||
{ 'williamboman/mason.nvim', config = true },
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'WhoIsSethDaniel/mason-tool-installer.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
|
||||
vim.o.mouse = 'a'
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.o.clipboard = 'unnamedplus'
|
||||
vim.schedule(function()
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
end)
|
||||
|
||||
-- Enable break indent
|
||||
vim.o.breakindent = true
|
||||
@ -386,31 +398,36 @@ local servers = {
|
||||
},
|
||||
}
|
||||
|
||||
-- Setup neovim lua configuration
|
||||
require('neodev').setup()
|
||||
|
||||
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
||||
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
|
||||
|
||||
-- Ensure the servers above are installed
|
||||
local mason_lspconfig = require 'mason-lspconfig'
|
||||
require('mason').setup()
|
||||
|
||||
mason_lspconfig.setup {
|
||||
ensure_installed = vim.tbl_keys(servers),
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
'stylua',
|
||||
'black',
|
||||
'prettierd',
|
||||
'gofumpt',
|
||||
'goimports-reviser',
|
||||
'golines',
|
||||
'golangci-lint',
|
||||
})
|
||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||
|
||||
require('mason-lspconfig').setup {
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
||||
require('lspconfig')[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
mason_lspconfig.setup_handlers {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = servers[server_name],
|
||||
filetypes = (servers[server_name] or {}).filetypes,
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
@ -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
|
||||
require("jabuxas")
|
||||
|
@ -62,35 +62,35 @@ return {
|
||||
},
|
||||
preselect = cmp.PreselectMode.None,
|
||||
completion = {
|
||||
completeopt = "noselect,menuone,menu"
|
||||
},
|
||||
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,
|
||||
},
|
||||
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,
|
||||
-- },
|
||||
-- },
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-p>'] = cmp.mapping.select_next_item(),
|
||||
['<C-n>'] = cmp.mapping.select_prev_item(),
|
||||
@ -121,30 +121,34 @@ return {
|
||||
end, { 'i', 's' }),
|
||||
},
|
||||
sources = {
|
||||
{
|
||||
name = 'lazydev',
|
||||
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
||||
group_index = 0,
|
||||
},
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = "orgmode" },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
{ name = 'buffer' },
|
||||
},
|
||||
formatting = {
|
||||
fields = { "abbr", "menu", "kind" },
|
||||
format = require('lspkind').cmp_format({
|
||||
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)
|
||||
-- can also be a function to dynamically calculate max width such as
|
||||
-- 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)
|
||||
show_labelDetails = true, -- show labelDetails in menu. Disabled by default
|
||||
|
||||
-- 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))
|
||||
})
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(winhighlight),
|
||||
documentation = cmp.config.window.bordered(winhighlight),
|
||||
},
|
||||
-- formatting = {
|
||||
-- fields = { "abbr", "menu", "kind" },
|
||||
-- format = require('lspkind').cmp_format({
|
||||
-- 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)
|
||||
-- -- can also be a function to dynamically calculate max width such as
|
||||
-- -- 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)
|
||||
-- show_labelDetails = true, -- show labelDetails in menu. Disabled by default
|
||||
--
|
||||
-- -- 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))
|
||||
-- })
|
||||
-- },
|
||||
-- window = {
|
||||
-- completion = cmp.config.window.bordered(winhighlight),
|
||||
-- documentation = cmp.config.window.bordered(winhighlight),
|
||||
-- },
|
||||
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
|
@ -117,20 +117,16 @@ elseif fileContent == "solarized" then
|
||||
'maxmx03/solarized.nvim',
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.o.background = 'dark'
|
||||
---@type solarized.config
|
||||
opts = {
|
||||
palette = 'solarized',
|
||||
styles = {
|
||||
comments = { italic = true, bold = false }
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
vim.o.termguicolors = true
|
||||
|
||||
require('solarized').setup({
|
||||
enables = {
|
||||
bufferline = true,
|
||||
cmp = true
|
||||
},
|
||||
pallete = "solarized",
|
||||
theme = "neo",
|
||||
transparent = true,
|
||||
})
|
||||
|
||||
require('solarized').setup(opts)
|
||||
vim.cmd.colorscheme 'solarized'
|
||||
end,
|
||||
}
|
||||
|
@ -11,9 +11,6 @@ return {
|
||||
require("null-ls").builtins.formatting.goimports_reviser,
|
||||
require("null-ls").builtins.formatting.golines,
|
||||
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
|
||||
|
@ -3,7 +3,6 @@ vim.opt.mouse = "a"
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.opt.clipboard:append({ "unnamedplus" })
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
|
Loading…
Reference in New Issue
Block a user