chore(nvim): folds and better cmdline

This commit is contained in:
Afonso Franco 2024-12-15 23:46:12 +00:00
parent a766f3931e
commit 556fedaa0b
Signed by: afonso
SSH key fingerprint: SHA256:gkVPzsQQJzqi21ntQBV6pXTx4bYI53rFGI4XtvCpwd4
6 changed files with 201 additions and 238 deletions

View file

@ -1,18 +1,31 @@
return {
-- Rename variable pop up
{
"stevearc/dressing.nvim",
event = "VeryLazy",
"folke/lazydev.nvim",
ft = "lua",
opts = {
input = {
override = function(conf)
conf.col = -1
conf.row = 0
return conf
end,
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } }
}
}
},
{
'nvim-java/nvim-java',
priority = 500,
config = function()
require('java').setup()
local lspconfig = require("lspconfig")
local lsp_defaults = lspconfig.util.default_config
local capabilities =
vim.tbl_deep_extend("force", lsp_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities())
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true
}
lspconfig["jdtls"].setup({
capabilities = capabilities,
})
end
},
{
"smjonas/inc-rename.nvim",
opts = {
@ -27,151 +40,17 @@ return {
},
lazy = false,
config = function()
require("refactoring").setup()
require("refactoring").setup({})
end,
},
{
"williamboman/mason.nvim",
event = "VeryLazy",
config = function()
local mason = require("mason")
vim.api.nvim_create_augroup("_mason", { clear = true })
local options = {
PATH = "skip",
ui = {
icons = {
package_pending = "",
package_installed = "󰄳 ",
package_uninstalled = "",
},
keymaps = {
toggle_server_expand = "<CR>",
install_server = "i",
update_server = "u",
check_server_version = "c",
update_all_servers = "U",
check_outdated_servers = "C",
uninstall_server = "X",
cancel_installation = "<C-c>",
},
},
max_concurrent_installers = 10,
}
mason.setup(options)
end,
},
{
"williamboman/mason-lspconfig.nvim",
event = "VeryLazy",
dependencies = {
"williamboman/mason.nvim"
},
config = function()
local mason_lspconfig = require("mason-lspconfig")
local lspconfig = require("lspconfig")
mason_lspconfig.setup({
automatic_installation = false,
})
local lsp_defaults = lspconfig.util.default_config
local capabilities =
vim.tbl_deep_extend("force", lsp_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities())
mason_lspconfig.setup_handlers({
-- This is a default handler that will be called for each installed server (also for new servers that are installed during a session)
function(server_name)
lspconfig[server_name].setup({
capabilities = capabilities,
})
end,
["gopls"] = function()
lspconfig["gopls"].setup({
capabilities = capabilities,
settings = {
gopls = {
["ui.completion.usePlaceholders"] = true,
["ui.diagnostic.staticcheck"] = true,
["ui.inlayhint.hints"] = {
assignVariablesTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true
},
}
}
})
end,
["lua_ls"] = function()
lspconfig["lua_ls"].setup({
capabilities = capabilities,
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { "vim" },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
hint = { enable = true }
},
},
})
end,
["ltex"] = function()
lspconfig["ltex"].setup({
capabilities = capabilities,
--Local on attach
on_attach = function(_, _)
-- rest of your on_attach process.
require("ltex_extra").setup()
end,
settings = {
ltex = {
language = "en-GB",
},
additionalRules = {
enablePickyRules = true,
},
},
})
end,
["basedpyright"] = function()
lspconfig["basedpyright"].setup({
capabilities = capabilities,
settings = {
verboseOutput = true,
autoImportCompletion = true,
basedpyright = {
analysis = {
typeCheckingMode = "all",
autoSearchPaths = true,
useLibraryCodeForTypes = true,
diagnosticMode = "openFilesOnly",
indexing = true,
},
},
},
})
end,
})
end
opts = {}
},
{
"neovim/nvim-lspconfig",
event = { "BufReadPost", "BufNewFile" },
dependencies = {
"williamboman/mason-lspconfig.nvim"
},
config = function()
local lspconfig = require("lspconfig")
@ -216,10 +95,83 @@ return {
end,
})
-- ADD NVIM CMP AS A CAPABILITY
local lsp_defaults = lspconfig.util.default_config
local capabilities =
vim.tbl_deep_extend("force", lsp_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities())
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true
}
lspconfig["gopls"].setup({
capabilities = capabilities,
settings = {
gopls = {
["ui.completion.usePlaceholders"] = true,
["ui.diagnostic.staticcheck"] = true,
["ui.inlayhint.hints"] = {
assignVariablesTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true
},
}
}
})
lspconfig["lua_ls"].setup({
capabilities = capabilities,
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { "vim" },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
hint = { enable = true }
},
},
})
lspconfig["ltex"].setup({
capabilities = capabilities,
--Local on attach
on_attach = function(_, _)
-- rest of your on_attach process.
require("ltex_extra").setup()
end,
settings = {
ltex = {
language = "en-GB",
},
additionalRules = {
enablePickyRules = true,
},
},
})
lspconfig["basedpyright"].setup({
capabilities = capabilities,
settings = {
verboseOutput = true,
autoImportCompletion = true,
basedpyright = {
analysis = {
typeCheckingMode = "all",
autoSearchPaths = true,
useLibraryCodeForTypes = true,
diagnosticMode = "openFilesOnly",
indexing = true,
},
},
},
})
lspconfig["hls"].setup({
capabilities = capabilities,
@ -232,15 +184,6 @@ return {
version = '^5',
lazy = false
},
{
'akinsho/flutter-tools.nvim',
lazy = false,
dependencies = {
'nvim-lua/plenary.nvim',
'stevearc/dressing.nvim', -- optional for vim.ui.select
},
config = true,
},
{
"rcarriga/nvim-dap-ui",
event = "VeryLazy",