chore: Remove neovim clutter
This commit is contained in:
parent
61072b816a
commit
96e0da6deb
17 changed files with 111 additions and 794 deletions
|
|
@ -142,6 +142,11 @@ require("neoscroll.config").set_mappings(t)
|
|||
-- trouble
|
||||
map("n", "<leader>t", "<cmd>TroubleToggle<CR>", term_opts)
|
||||
|
||||
-- format
|
||||
map({ "n", "v" }, "<F4>", function()
|
||||
Util.format({ force = true })
|
||||
end, { desc = "Format" })
|
||||
|
||||
-- better yank
|
||||
function Better_yank(opts)
|
||||
local current_line = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
|
|
|
|||
|
|
@ -1,45 +1,47 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
-- bootstrap lazy.nvim
|
||||
-- stylua: ignore
|
||||
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable",
|
||||
lazypath })
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
{ import = "lazyvim.plugins.extras.lang.rust" },
|
||||
{ import = "lazyvim.plugins.extras.lang.java" },
|
||||
{ import = "lazyvim.plugins.extras.lang.clangd" },
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
{ import = "lazyvim.plugins.extras.lang.python" },
|
||||
{ import = "lazyvim.plugins.extras.lang.markdown" },
|
||||
{ import = "lazyvim.plugins.extras.lang.cmake" },
|
||||
{ import = "lazyvim.plugins.extras.lang.omnisharp" },
|
||||
{ import = "lazyvim.plugins.extras.lang.tailwind" },
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
{ import = "lazyvim.plugins.extras.util.dot" },
|
||||
{ import = "lazyvim.plugins.extras.test.core" },
|
||||
{ import = "lazyvim.plugins.extras.ui.alpha" },
|
||||
{ import = "plugins.plugins" },
|
||||
{ import = "lazyvim.plugins.extras.dap.core" },
|
||||
{ import = "plugins" },
|
||||
-- import any extras modules here
|
||||
-- { import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
-- { import = "lazyvim.plugins.extras.lang.json" },
|
||||
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
|
||||
-- import/override with your plugins
|
||||
{ import = "plugins.plugins" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
-- If you
|
||||
lazy = false,
|
||||
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
||||
-- have outdated releases, which may break your Neovim install.
|
||||
version = false, -- always use the latest git commit
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
lazy = true,
|
||||
version = false,
|
||||
},
|
||||
install = { colorscheme = { "tokyonight", "catppuccin-mocha" } },
|
||||
checker = { enabled = true, notify = false },
|
||||
change_detection = { enabled = true, notify = false }, --know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||
change_detection = { enabled = true, notify = false },
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ function M.get()
|
|||
{ "<leader>cl", "<cmd>LspInfo<cr>", desc = "Lsp Info" },
|
||||
{ "<leader>ca", "<cmd>Telescope lsp_definitions<cr>", desc = "Goto Definition", has = "definition" },
|
||||
{ "<leader>cs", "<cmd>Telescope lsp_references<cr>", desc = "References" },
|
||||
{ "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" },
|
||||
{ "<leader>cA", vim.lsp.buf.declaration, desc = "Goto Declaration" },
|
||||
{ "<leader>cf", "<cmd>Telescope lsp_implementations<cr>", desc = "Goto Implementation" },
|
||||
{ "<leader>cd", "<cmd>Telescope lsp_type_definitions<cr>", desc = "Goto Type Definition" },
|
||||
{ "<leader>ce", vim.lsp.buf.hover, desc = "Hover" },
|
||||
|
|
@ -27,8 +27,8 @@ function M.get()
|
|||
{ "[e", M.diagnostic_goto(false, "ERROR"), desc = "Prev Error" },
|
||||
{ "]w", M.diagnostic_goto(true, "WARN"), desc = "Next Warning" },
|
||||
{ "[w", M.diagnostic_goto(false, "WARN"), desc = "Prev Warning" },
|
||||
{ "<F4>", format, desc = "Format Document", has = "formatting" },
|
||||
-- { "<leader>cf", format, desc = "Format Range", mode = "v", has = "documentRangeFormatting" },
|
||||
{ "<F4>", format, desc = "Format Range", mode = "v", has = "documentRangeFormatting" },
|
||||
{ "<leader>cr", ":IncRename ", desc = "FUCK", has = "rename" },
|
||||
{
|
||||
"<leader>cq",
|
||||
function()
|
||||
|
|
@ -68,20 +68,6 @@ function M.get()
|
|||
has = "codeAction",
|
||||
},
|
||||
}
|
||||
if require("lazyvim.util").has("inc-rename.nvim") then
|
||||
M._keys[#M._keys + 1] = {
|
||||
"<leader>cr",
|
||||
function()
|
||||
require("inc_rename")
|
||||
return ":IncRename " .. vim.fn.expand("<cword>")
|
||||
end,
|
||||
expr = true,
|
||||
desc = "Rename",
|
||||
has = "rename",
|
||||
}
|
||||
else
|
||||
M._keys[#M._keys + 1] = { "<leader>cr", vim.lsp.buf.rename, desc = "Rename", has = "rename" }
|
||||
end
|
||||
end
|
||||
return M._keys
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ vim.g.neovide_refresh_rate_idle = 5
|
|||
vim.g.neovide_hide_mouse_when_typing = true
|
||||
vim.g.mkdp_browser = "/usr/bin/firefox"
|
||||
vim.g.mkdp_auto_start = 1
|
||||
vim.g.autoformat = false
|
||||
for k, v in pairs(options) do
|
||||
vim.opt[k] = v
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,301 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
keys = {},
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
dapui.setup(opts)
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open({})
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close({})
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close({})
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"node2",
|
||||
"python",
|
||||
"javadbg",
|
||||
"javatest",
|
||||
"codelldb",
|
||||
"firefox",
|
||||
"bash",
|
||||
"delve",
|
||||
"coreclr",
|
||||
},
|
||||
automatic_installation = true,
|
||||
automatic_setup = true,
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("mason-nvim-dap").setup(opts)
|
||||
-- require("mason-nvim-dap").setup_handlers({
|
||||
-- javadbg = function() end,
|
||||
-- })
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
dap.adapters.lldb = {
|
||||
type = "executable",
|
||||
command = "/usr/bin/lldb-vscode",
|
||||
name = "lldb",
|
||||
}
|
||||
dap.adapters.nlua = function(callback, config)
|
||||
callback({ type = "server", host = config.host or "127.0.0.1", port = config.port or 8086 })
|
||||
end
|
||||
dap.adapters.bashdb = {
|
||||
type = "executable",
|
||||
command = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/bash-debug-adapter",
|
||||
name = "bashdb",
|
||||
}
|
||||
dap.adapters.coreclr = {
|
||||
type = "executable",
|
||||
command = "netcoredbg",
|
||||
args = { "--interpreter=vscode" },
|
||||
}
|
||||
|
||||
local rust_dap = Get_git_root().cwd
|
||||
local filename = ""
|
||||
for w in rust_dap:gmatch("([^/]+)") do
|
||||
filename = w
|
||||
end
|
||||
filename = filename:gsub("-", "_")
|
||||
filename = string.lower(filename)
|
||||
|
||||
dap.configurations.rust = {
|
||||
{
|
||||
type = "lldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return rust_dap .. "/target/debug/" .. filename
|
||||
end,
|
||||
--program = '${fileDirname}/${fileBasenameNoExtension}',
|
||||
cwd = "${workspaceFolder}",
|
||||
terminal = "integrated",
|
||||
initCommands = function()
|
||||
-- Find out where to look for the pretty printer Python module
|
||||
local rustc_sysroot = vim.fn.trim(vim.fn.system("rustc --print sysroot"))
|
||||
|
||||
local script_import = 'command script import "' .. rustc_sysroot .. '/lib/rustlib/etc/lldb_lookup.py"'
|
||||
local commands_file = rustc_sysroot .. "/lib/rustlib/etc/lldb_commands"
|
||||
|
||||
local commands = {}
|
||||
local file = io.open(commands_file, "r")
|
||||
if file then
|
||||
for line in file:lines() do
|
||||
table.insert(commands, line)
|
||||
end
|
||||
file:close()
|
||||
end
|
||||
table.insert(commands, 1, script_import)
|
||||
|
||||
return commands
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = "debug cpp",
|
||||
type = "lldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", Get_git_root().cwd .. "/build/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
terminal = "integrated",
|
||||
},
|
||||
}
|
||||
dap.configurations.c = dap.configurations.cpp
|
||||
|
||||
dap.configurations.python = {
|
||||
{
|
||||
type = "python", -- the type here established the link to the adapter definition: `dap.adapters.python`
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
program = "${file}", -- This configuration will launch the current file if used.
|
||||
pythonPath = function()
|
||||
local cwd = vim.fn.getcwd()
|
||||
if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
|
||||
return cwd .. "/venv/bin/python"
|
||||
elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
|
||||
return cwd .. "/.venv/bin/python"
|
||||
else
|
||||
return "/usr/bin/python"
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
dap.configurations.java = {
|
||||
{
|
||||
request = "attach",
|
||||
name = "Debug (Attach) - Remote",
|
||||
hostName = "127.0.0.1",
|
||||
port = 5005,
|
||||
},
|
||||
}
|
||||
dap.configurations.go = {
|
||||
{
|
||||
type = "delve",
|
||||
name = "Debug",
|
||||
request = "launch",
|
||||
program = "${file}",
|
||||
},
|
||||
{
|
||||
type = "delve",
|
||||
name = "Debug test", -- configuration for debugging test files
|
||||
request = "launch",
|
||||
mode = "test",
|
||||
program = "${file}",
|
||||
},
|
||||
{
|
||||
type = "delve",
|
||||
name = "Debug test (go.mod)",
|
||||
request = "launch",
|
||||
mode = "test",
|
||||
program = "./${relativeFileDirname}",
|
||||
},
|
||||
}
|
||||
dap.configurations.javascript = {
|
||||
{
|
||||
name = "Launch",
|
||||
type = "js",
|
||||
request = "launch",
|
||||
program = "${file}",
|
||||
cwd = vim.fn.getcwd(),
|
||||
sourceMaps = true,
|
||||
protocol = "inspector",
|
||||
console = "integratedTerminal",
|
||||
},
|
||||
}
|
||||
dap.configurations.typescript = {
|
||||
{
|
||||
name = "Debug with Firefox",
|
||||
type = "firefox",
|
||||
request = "launch",
|
||||
reAttach = true,
|
||||
url = "http://localhost:3000",
|
||||
webRoot = "${workspaceFolder}",
|
||||
firefoxExecutable = "/usr/bin/firefox",
|
||||
},
|
||||
}
|
||||
dap.configurations.lua = {
|
||||
{
|
||||
type = "nlua",
|
||||
request = "attach",
|
||||
name = "Attach to running Neovim instance",
|
||||
},
|
||||
}
|
||||
dap.configurations.cs = {
|
||||
{
|
||||
type = "coreclr",
|
||||
name = "launch - netcoredbg",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input("Path to dll: ", Get_git_root().cwd, "file")
|
||||
end,
|
||||
-- args = function()
|
||||
-- vim.fn.input("args: ", Get_git_root().cwd, "file")
|
||||
-- end,
|
||||
},
|
||||
}
|
||||
dap.configurations.sh = {
|
||||
{
|
||||
type = "bashdb",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
showDebugOutput = true,
|
||||
pathBashdb = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/extension/bashdb_dir/bashdb",
|
||||
pathBashdbLib = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/extension/bashdb_dir",
|
||||
trace = true,
|
||||
file = "${file}",
|
||||
program = "${file}",
|
||||
cwd = "${workspaceFolder}",
|
||||
pathCat = "cat",
|
||||
pathBash = "/bin/bash",
|
||||
pathMkfifo = "mkfifo",
|
||||
pathPkill = "pkill",
|
||||
args = {},
|
||||
env = {},
|
||||
terminalKind = "integrated",
|
||||
},
|
||||
}
|
||||
require("dapui").setup({
|
||||
icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" },
|
||||
mappings = {
|
||||
expand = { "<CR>", "<2-LeftMouse>" },
|
||||
open = "o",
|
||||
remove = "d",
|
||||
edit = "e",
|
||||
repl = "r",
|
||||
toggle = "t",
|
||||
},
|
||||
expand_lines = vim.fn.has("nvim-0.7") == 1,
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
{ id = "scopes", size = 0.25 },
|
||||
"breakpoints",
|
||||
"stacks",
|
||||
"watches",
|
||||
},
|
||||
size = 40, -- 40 columns
|
||||
position = "left",
|
||||
},
|
||||
{
|
||||
elements = {
|
||||
"repl",
|
||||
"console",
|
||||
},
|
||||
size = 0.25, -- 25% of total lines
|
||||
position = "bottom",
|
||||
},
|
||||
},
|
||||
controls = {
|
||||
enabled = true,
|
||||
element = "repl",
|
||||
icons = {
|
||||
pause = "",
|
||||
play = "",
|
||||
step_into = "",
|
||||
step_over = "",
|
||||
step_out = "",
|
||||
step_back = "",
|
||||
run_last = "↻",
|
||||
terminate = "□",
|
||||
},
|
||||
},
|
||||
floating = {
|
||||
max_height = nil, -- These can be integers or a float between 0 and 1.
|
||||
max_width = nil, -- Floats will be treated as percentage of your screen.
|
||||
border = "single", -- Border style. Can be "single", "double" or "rounded"
|
||||
mappings = {
|
||||
close = { "q", "<Esc>" },
|
||||
},
|
||||
},
|
||||
windows = { indent = 1 },
|
||||
render = {
|
||||
max_type_length = nil, -- Can be integer or nil.
|
||||
max_value_lines = 100, -- Can be integer or nil.
|
||||
},
|
||||
})
|
||||
require("nvim-dap-virtual-text").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
local M = {}
|
||||
|
||||
return M
|
||||
|
|
@ -10,11 +10,10 @@ return {
|
|||
virtual_text = { spacing = 4, source = "if_many", prefix = "●" },
|
||||
severity_sort = true,
|
||||
},
|
||||
inlay_hints = {
|
||||
enabled = true,
|
||||
},
|
||||
-- inlay_hints = {
|
||||
-- enabled = true,
|
||||
-- },
|
||||
capabilities = {},
|
||||
autoformat = false,
|
||||
format_notify = false,
|
||||
format = {
|
||||
formatting_options = nil,
|
||||
|
|
@ -147,7 +146,6 @@ return {
|
|||
opencl_ls = {},
|
||||
yamlls = {},
|
||||
lua_ls = {
|
||||
-- mason = false, -- set to false if you don't want this server to be installed with mason
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = {
|
||||
|
|
@ -166,35 +164,28 @@ return {
|
|||
end,
|
||||
},
|
||||
},
|
||||
setup = function(_, _)
|
||||
local Util = require("lazyvim.util")
|
||||
Util.lsp.on_attach(function(client, buffer)
|
||||
require("config.lsp-keymap").on_attach(client, buffer)
|
||||
end)
|
||||
|
||||
vim.cmd([[highlight LspInlayHint guibg=#1A1B26]])
|
||||
init = function()
|
||||
local keys = require("lazyvim.plugins.lsp.keymaps").get()
|
||||
local my_keys = require("config.lsp-keymap").get()
|
||||
local count = 0
|
||||
for _ in pairs(my_keys) do
|
||||
keys[#keys + 1] = my_keys[count]
|
||||
count = count + 1
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"DashieTM/null.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = { "mason.nvim" },
|
||||
"stevearc/conform.nvim",
|
||||
opts = function()
|
||||
local nls = require("null-ls")
|
||||
return {
|
||||
root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git"),
|
||||
|
||||
sources = {
|
||||
nls.builtins.formatting.fish_indent,
|
||||
nls.builtins.diagnostics.fish,
|
||||
nls.builtins.formatting.stylua,
|
||||
nls.builtins.formatting.shfmt,
|
||||
nls.builtins.diagnostics.flake8,
|
||||
nls.builtins.formatting.autopep8,
|
||||
nls.builtins.formatting.prettierd,
|
||||
nls.builtins.formatting.typst,
|
||||
local opts = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
fish = { "fish_indent" },
|
||||
sh = { "shfmt" },
|
||||
typst = { "typstfmt" },
|
||||
},
|
||||
}
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,342 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
lazy = true,
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
{ "folke/neoconf.nvim", cmd = "Neoconf", config = false, dependencies = { "nvim-lspconfig" } },
|
||||
{ "folke/neodev.nvim", opts = { experimental = { pathStrict = true } } },
|
||||
"mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"mfussenegger/nvim-jdtls",
|
||||
{
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
cond = function()
|
||||
return require("lazyvim.util").has("nvim-cmp")
|
||||
end,
|
||||
},
|
||||
{ "Hoffs/omnisharp-extended-lsp.nvim", lazy = true },
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
-- options for vim.diagnostic.config()
|
||||
diagnostics = {
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
virtual_text = { spacing = 4, source = "if_many", prefix = "●" },
|
||||
severity_sort = true,
|
||||
},
|
||||
inlay_hints = {
|
||||
enabled = true,
|
||||
},
|
||||
capabilities = {},
|
||||
autoformat = false,
|
||||
format_notify = false,
|
||||
format = {
|
||||
formatting_options = nil,
|
||||
timeout_ms = nil,
|
||||
},
|
||||
-- LSP Server Settings
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
jsonls = {},
|
||||
tailwindcss = {},
|
||||
cssls = {},
|
||||
html = {},
|
||||
clangd = {
|
||||
root_pattern = {
|
||||
".clangd",
|
||||
".clang-tidy",
|
||||
".clang-format",
|
||||
"compile_commands.json",
|
||||
"compile_flags.txt",
|
||||
"configure.ac",
|
||||
".git",
|
||||
"build/compile_commands.json",
|
||||
},
|
||||
filetypes = {
|
||||
"c",
|
||||
"cpp",
|
||||
"objc",
|
||||
"objcpp",
|
||||
"cuda",
|
||||
"proto",
|
||||
"cl",
|
||||
},
|
||||
},
|
||||
pyright = {},
|
||||
cmake = {},
|
||||
bashls = {},
|
||||
ansiblels = {},
|
||||
marksman = {},
|
||||
asm_lsp = {},
|
||||
omnisharp = {
|
||||
handlers = {
|
||||
["textDocument/definition"] = function(...)
|
||||
return require("omnisharp_extended").handler(...)
|
||||
end,
|
||||
},
|
||||
inlayHintsOptions = {
|
||||
enableForParameters = true,
|
||||
forLiteralParameters = true,
|
||||
forIndexerParameters = true,
|
||||
forObjectCreationParameters = true,
|
||||
forOtherParameters = true,
|
||||
suppressForParametersThatDifferOnlyBySuffix = false,
|
||||
suppressForParametersThatMatchMethodIntent = false,
|
||||
suppressForParametersThatMatchArgumentName = false,
|
||||
enableForTypes = true,
|
||||
forImplicitVariableTypes = true,
|
||||
forLambdaParameterTypes = true,
|
||||
forImplicitObjectCreation = true,
|
||||
},
|
||||
enable_roslyn_analyzers = true,
|
||||
organize_imports_on_format = true,
|
||||
enable_import_completion = true,
|
||||
},
|
||||
rnix = {},
|
||||
rust_analyzer = {
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
experimental = true,
|
||||
},
|
||||
},
|
||||
tsserver = {
|
||||
settings = {
|
||||
typescript = {
|
||||
inlayHints = {
|
||||
includeInlayParameterNameHints = "all",
|
||||
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
|
||||
includeInlayFunctionParameterTypeHints = true,
|
||||
includeInlayVariableTypeHints = true,
|
||||
includeInlayPropertyDeclarationTypeHints = true,
|
||||
includeInlayFunctionLikeReturnTypeHints = true,
|
||||
includeInlayEnumMemberValueHints = true,
|
||||
},
|
||||
},
|
||||
javascript = {
|
||||
inlayHints = {
|
||||
includeInlayParameterNameHints = "all",
|
||||
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
|
||||
includeInlayFunctionParameterTypeHints = true,
|
||||
includeInlayVariableTypeHints = true,
|
||||
includeInlayPropertyDeclarationTypeHints = true,
|
||||
includeInlayFunctionLikeReturnTypeHints = true,
|
||||
includeInlayEnumMemberValueHints = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
typst_lsp = {
|
||||
settings = {
|
||||
experimentalFormatterMode = "on",
|
||||
exportPdf = "onSave",
|
||||
},
|
||||
},
|
||||
texlab = {},
|
||||
ltex = {
|
||||
settings = {
|
||||
ltex = {
|
||||
checkFrequency = "save",
|
||||
},
|
||||
},
|
||||
filetypes = {
|
||||
"bib",
|
||||
"gitcommit",
|
||||
"markdown",
|
||||
"org",
|
||||
"plaintex",
|
||||
"rst",
|
||||
"rnoweb",
|
||||
"tex",
|
||||
"pandoc",
|
||||
"typst",
|
||||
"typ",
|
||||
},
|
||||
},
|
||||
gopls = {
|
||||
staticcheck = true,
|
||||
},
|
||||
sqlls = {},
|
||||
taplo = {},
|
||||
lemminx = {},
|
||||
opencl_ls = {},
|
||||
yamlls = {},
|
||||
lua_ls = {
|
||||
-- mason = false, -- set to false if you don't want this server to be installed with mason
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
jdtls = function()
|
||||
return true
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local Util = require("lazyvim.util")
|
||||
|
||||
if Util.has("neoconf.nvim") then
|
||||
local plugin = require("lazy.core.config").spec.plugins["neoconf.nvim"]
|
||||
require("neoconf").setup(require("lazy.core.plugin").values(plugin, "opts", false))
|
||||
end
|
||||
|
||||
-- setup autoformat
|
||||
Util.format.register(Util.lsp.formatter())
|
||||
|
||||
-- deprectaed options
|
||||
if opts.autoformat ~= nil then
|
||||
vim.g.autoformat = opts.autoformat
|
||||
end
|
||||
|
||||
-- setup formatting and keymaps
|
||||
Util.lsp.on_attach(function(client, buffer)
|
||||
require("config.lsp-keymap").on_attach(client, buffer)
|
||||
end)
|
||||
|
||||
local register_capability = vim.lsp.handlers["client/registerCapability"]
|
||||
|
||||
vim.lsp.handlers["client/registerCapability"] = function(err, res, ctx)
|
||||
local ret = register_capability(err, res, ctx)
|
||||
local client_id = ctx.client_id
|
||||
---@type lsp.Client
|
||||
local client = vim.lsp.get_client_by_id(client_id)
|
||||
local buffer = vim.api.nvim_get_current_buf()
|
||||
require("config.lsp-keymap").on_attach(client, buffer)
|
||||
return ret
|
||||
end
|
||||
|
||||
-- diagnostics
|
||||
for name, icon in pairs(require("lazyvim.config").icons.diagnostics) do
|
||||
name = "DiagnosticSign" .. name
|
||||
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
|
||||
end
|
||||
|
||||
local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint
|
||||
|
||||
if opts.inlay_hints.enabled and inlay_hint then
|
||||
Util.lsp.on_attach(function(client, buffer)
|
||||
if client.supports_method("textDocument/inlayHint") then
|
||||
inlay_hint(buffer, true)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then
|
||||
opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●"
|
||||
or function(diagnostic)
|
||||
local icons = require("lazyvim.config").icons.diagnostics
|
||||
for d, icon in pairs(icons) do
|
||||
if diagnostic.severity == vim.diagnostic.severity[d:upper()] then
|
||||
return icon
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
|
||||
|
||||
local servers = opts.servers
|
||||
local has_cmp, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
has_cmp and cmp_nvim_lsp.default_capabilities() or {},
|
||||
opts.capabilities or {}
|
||||
)
|
||||
|
||||
local function setup(server)
|
||||
local server_opts = vim.tbl_deep_extend("force", {
|
||||
capabilities = vim.deepcopy(capabilities),
|
||||
}, servers[server] or {})
|
||||
|
||||
if opts.setup[server] then
|
||||
if opts.setup[server](server, server_opts) then
|
||||
return
|
||||
end
|
||||
elseif opts.setup["*"] then
|
||||
if opts.setup["*"](server, server_opts) then
|
||||
return
|
||||
end
|
||||
end
|
||||
require("lspconfig")[server].setup(server_opts)
|
||||
end
|
||||
|
||||
-- get all the servers that are available through mason-lspconfig
|
||||
local have_mason, mlsp = pcall(require, "mason-lspconfig")
|
||||
local all_mslp_servers = {}
|
||||
if have_mason then
|
||||
all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package)
|
||||
end
|
||||
|
||||
local ensure_installed = {} ---@type string[]
|
||||
for server, server_opts in pairs(servers) do
|
||||
if server_opts then
|
||||
server_opts = server_opts == true and {} or server_opts
|
||||
-- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig
|
||||
if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then
|
||||
setup(server)
|
||||
else
|
||||
ensure_installed[#ensure_installed + 1] = server
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if have_mason then
|
||||
mlsp.setup({ ensure_installed = ensure_installed, handlers = { setup } })
|
||||
end
|
||||
|
||||
if Util.lsp.get_config("denols") and Util.lsp.get_config("tsserver") then
|
||||
local is_deno = require("lspconfig.util").root_pattern("deno.json", "deno.jsonc")
|
||||
Util.lsp.disable("tsserver", is_deno)
|
||||
Util.lsp.disable("denols", function(root_dir)
|
||||
return not is_deno(root_dir)
|
||||
end)
|
||||
end
|
||||
|
||||
require("lspconfig").ltex.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = Util.lsp.on_attach(function(client, buffer)
|
||||
require("config.lsp-keymap").on_attach(client, buffer)
|
||||
require("ltex_extra").setup({
|
||||
path = vim.fn.expand("~") .. "/.local/share/ltex",
|
||||
})
|
||||
end),
|
||||
})
|
||||
|
||||
vim.cmd([[highlight LspInlayHint guibg=#1A1B26]])
|
||||
end,
|
||||
},
|
||||
{
|
||||
"DashieTM/null.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = { "mason.nvim" },
|
||||
opts = function()
|
||||
local nls = require("null-ls")
|
||||
return {
|
||||
root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git"),
|
||||
|
||||
sources = {
|
||||
nls.builtins.formatting.fish_indent,
|
||||
nls.builtins.diagnostics.fish,
|
||||
nls.builtins.formatting.stylua,
|
||||
nls.builtins.formatting.shfmt,
|
||||
nls.builtins.diagnostics.flake8,
|
||||
nls.builtins.formatting.autopep8,
|
||||
nls.builtins.formatting.prettierd,
|
||||
nls.builtins.formatting.typst,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -266,4 +266,19 @@ return {
|
|||
ft = { "markdown", "tex", "typst", "typ" },
|
||||
lazy = true,
|
||||
},
|
||||
{
|
||||
"smjonas/inc-rename.nvim",
|
||||
lazy = true,
|
||||
event = "BufEnter",
|
||||
config = function()
|
||||
require("inc_rename").setup({
|
||||
cmd_name = "IncRename", -- the name of the command
|
||||
hl_group = "Substitute", -- the highlight group used for highlighting the identifier's new name
|
||||
preview_empty_name = true, -- whether an empty new name should be previewed; if false the command preview will be cancelled instead
|
||||
show_message = true, -- whether to display a `Renamed m instances in n files` message after a rename operation
|
||||
input_buffer_type = nil, -- the type of the external input buffer to use (the only supported value is currently "dressing")
|
||||
post_hook = nil, -- callback to run after renaming, receives the result table (from LSP handler) as an argument
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue