1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-22 18:38:00 +00:00

[neovim] Update confs from upstream

This commit is contained in:
Daniel Carrillo 2022-10-08 12:44:11 +02:00
parent 1712274793
commit f211112451
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16
10 changed files with 125 additions and 72 deletions

View File

@ -6,7 +6,21 @@ end
npairs.setup({
check_ts = true, -- treesitter integration
disable_filetype = { "TelescopePrompt" },
disable_filetype = { "TelescopePrompt", "neo-tree" },
ts_config = {
lua = { "string", "source" },
},
fast_wrap = {
map = "<M-e>",
chars = { "{", "[", "(", '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
offset = 0, -- Offset from pattern match
end_key = "$",
keys = "qwertyuiopzxcvbnmasdfghjkl",
check_comma = true,
highlight = "PmenuSel",
highlight_grey = "LineNr",
},
})
local cmp_autopairs = require("nvim-autopairs.completion.cmp")

View File

@ -1,4 +1,4 @@
local status_ok, autosave = pcall(require, "autosave")
local status_ok, autosave = pcall(require, "auto-save")
if not status_ok then
return
end

View File

@ -3,20 +3,4 @@ if not status_ok then
return
end
comment.setup({
pre_hook = function(ctx)
local U = require("Comment.utils")
local location = nil
if ctx.ctype == U.ctype.block then
location = require("ts_context_commentstring.utils").get_cursor_location()
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
location = require("ts_context_commentstring.utils").get_visual_start_location()
end
return require("ts_context_commentstring.internal").calculate_commentstring({
key = ctx.ctype == U.ctype.line and "__default" or "__multiline",
location = location,
})
end,
})
comment.setup({})

View File

@ -11,6 +11,23 @@ gitsigns.setup({
topdelete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
changedelete = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
},
signcolumn = true,
watch_gitdir = {
interval = 1000,
follow_files = true,
},
attach_to_untracked = true,
sign_priority = 6,
update_debounce = 100,
status_formatter = nil,
preview_config = {
border = "single",
style = "minimal",
relative = "cursor",
row = 0,
col = 1,
},
on_attach = function(bufnr)
local gs = package.loaded.gitsigns

View File

@ -1,4 +1,8 @@
vim.g.Illuminate_ftblacklist = { "neo-tree" }
local status_ok, illuminate = pcall(require, "illuminate")
if not status_ok then
return
end
vim.api.nvim_set_keymap("n", "<a-n>", '<cmd>lua require"illuminate".next_reference{wrap=true}<cr>', { noremap = true })
vim.api.nvim_set_keymap(
"n",
@ -6,3 +10,23 @@ vim.api.nvim_set_keymap(
'<cmd>lua require"illuminate".next_reference{reverse=true,wrap=true}<cr>',
{ noremap = true }
)
illuminate.configure({
providers = {
"lsp",
"treesitter",
"regex",
},
delay = 200,
filetypes_denylist = {
"neo-tree",
"packer",
"Trouble",
"TelescopePrompt",
},
filetypes_allowlist = {},
modes_denylist = {},
modes_allowlist = {},
providers_regex_syntax_denylist = {},
providers_regex_syntax_allowlist = {},
under_cursor = true,
})

View File

@ -3,6 +3,6 @@ if not status_ok then
return
end
require("user.lsp.lsp-installer")
require("user.lsp.mason")
require("user.lsp.handlers").setup()
require("user.lsp.null-ls")

View File

@ -1,46 +0,0 @@
local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer")
if not status_ok then
return
end
local servers = {
"sumneko_lua",
-- "cssls",
-- "html",
-- "tsserver",
"gopls",
-- "grammarly",
"golangci_lint_ls",
"pyright",
"bashls",
"jsonls",
"yamlls",
}
lsp_installer.setup()
local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
if not lspconfig_status_ok then
return
end
local opts = {}
for _, server in pairs(servers) do
opts = {
on_attach = require("user.lsp.handlers").on_attach,
capabilities = require("user.lsp.handlers").capabilities,
}
if server == "sumneko_lua" then
local sumneko_opts = require("user.lsp.settings.sumneko_lua")
opts = vim.tbl_deep_extend("force", sumneko_opts, opts)
end
if server == "pyright" then
local pyright_opts = require("user.lsp.settings.pyright")
opts = vim.tbl_deep_extend("force", pyright_opts, opts)
end
lspconfig[server].setup(opts)
end

View File

@ -0,0 +1,53 @@
local servers = {
"sumneko_lua",
"cssls",
"html",
"gopls",
"tsserver",
"pyright",
"bashls",
"jsonls",
"yamlls",
}
local settings = {
ui = {
border = "none",
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
},
log_level = vim.log.levels.INFO,
max_concurrent_installers = 4,
}
require("mason").setup(settings)
require("mason-lspconfig").setup({
ensure_installed = servers,
automatic_installation = true,
})
local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
if not lspconfig_status_ok then
return
end
local opts = {}
for _, server in pairs(servers) do
opts = {
on_attach = require("user.lsp.handlers").on_attach,
capabilities = require("user.lsp.handlers").capabilities,
}
server = vim.split(server, "@")[1]
local require_ok, conf_opts = pcall(require, "user.lsp.settings." .. server)
if require_ok then
opts = vim.tbl_deep_extend("force", conf_opts, opts)
end
lspconfig[server].setup(opts)
end

View File

@ -81,7 +81,8 @@ return packer.startup(function(use)
-- LSP
use({ "neovim/nvim-lspconfig", commit = "9d4b8d393aad0e6e9227e2d67629aa99e56b994a" })
use({ "williamboman/nvim-lsp-installer", commit = "23820a878a5c2415bfd3b971d1fe3c79e4dd6763" })
use({ "williamboman/mason.nvim", commit = "c2002d7a6b5a72ba02388548cfaf420b864fbc12" })
use({ "williamboman/mason-lspconfig.nvim", commit = "0051870dd728f4988110a1b2d47f4a4510213e31" })
use({ "jose-elias-alvarez/null-ls.nvim", commit = "6a98411e70fad6928f7311eeade4b1753cb83524" })
use({ "RRethy/vim-illuminate", commit = "0603e75fc4ecde1ee5a1b2fc8106ed6704f34d14" })
use({ "folke/trouble.nvim", commit = "929315ea5f146f1ce0e784c76c943ece6f36d786" })

View File

@ -4,14 +4,20 @@ if not status_ok then
end
configs.setup({
ensure_installed = "all", -- one of "all" or a list of languages
ignore_install = { "" }, -- List of parsers to ignore installing
ensure_installed = { "lua", "markdown", "markdown_inline", "bash", "python", "go", "gomod", "gowork" },
ignore_install = { "" },
sync_install = false,
highlight = {
enable = true, -- false will disable the whole extension
disable = { "css" }, -- list of language that will be disabled
enable = true,
disable = { "css" },
},
autopairs = {
enable = true,
},
indent = { enable = true, disable = { "python", "css" } },
context_commentstring = {
enable = true,
enable_autocmd = false,
},
})