overhaul of some dotfiles
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
local options = {
|
||||
return {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
-- css = { "prettier" },
|
||||
-- html = { "prettier" },
|
||||
go = { "goimports", "gofmt" },
|
||||
cs = { "csharpier" },
|
||||
yaml = { "prettier" },
|
||||
json = { "prettier" },
|
||||
jsonc = { "prettier" },
|
||||
sh = { "shfmt" },
|
||||
bash = { "shfmt" },
|
||||
},
|
||||
|
||||
-- format_on_save = {
|
||||
-- -- These options will be passed to conform.format()
|
||||
-- timeout_ms = 500,
|
||||
-- lsp_fallback = true,
|
||||
-- },
|
||||
format_on_save = {
|
||||
timeout_ms = 1000,
|
||||
lsp_fallback = true,
|
||||
},
|
||||
}
|
||||
|
||||
return options
|
||||
|
||||
92
nvim/lua/configs/dap.lua
Normal file
92
nvim/lua/configs/dap.lua
Normal file
@@ -0,0 +1,92 @@
|
||||
local dap = require "dap"
|
||||
local dapui = require "dapui"
|
||||
|
||||
-- DAP UI setup
|
||||
dapui.setup {
|
||||
icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" },
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
{ id = "scopes", size = 0.35 },
|
||||
{ id = "breakpoints", size = 0.15 },
|
||||
{ id = "stacks", size = 0.25 },
|
||||
{ id = "watches", size = 0.25 },
|
||||
},
|
||||
size = 45,
|
||||
position = "left",
|
||||
},
|
||||
{
|
||||
elements = {
|
||||
{ id = "repl", size = 0.5 },
|
||||
{ id = "console", size = 0.5 },
|
||||
},
|
||||
size = 12,
|
||||
position = "bottom",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Auto open/close UI with debug session
|
||||
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
|
||||
|
||||
-- Go: powered by nvim-dap-go (wraps delve)
|
||||
require("dap-go").setup {
|
||||
dap_configurations = {
|
||||
{
|
||||
type = "go",
|
||||
name = "Debug file",
|
||||
request = "launch",
|
||||
program = "${file}",
|
||||
},
|
||||
{
|
||||
type = "go",
|
||||
name = "Debug package",
|
||||
request = "launch",
|
||||
program = "${fileDirname}",
|
||||
},
|
||||
{
|
||||
type = "go",
|
||||
name = "Attach to process",
|
||||
mode = "local",
|
||||
request = "attach",
|
||||
processId = require("dap.utils").pick_process,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- C# / .NET: netcoredbg
|
||||
dap.adapters.coreclr = {
|
||||
type = "executable",
|
||||
command = vim.fn.stdpath "data" .. "/mason/bin/netcoredbg",
|
||||
args = { "--interpreter=vscode" },
|
||||
}
|
||||
|
||||
dap.configurations.cs = {
|
||||
{
|
||||
type = "coreclr",
|
||||
name = "Launch .NET",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input("Path to dll: ", vim.fn.getcwd() .. "/bin/Debug/", "file")
|
||||
end,
|
||||
},
|
||||
{
|
||||
type = "coreclr",
|
||||
name = "Attach .NET",
|
||||
request = "attach",
|
||||
processId = require("dap.utils").pick_process,
|
||||
},
|
||||
}
|
||||
|
||||
-- Signs
|
||||
vim.fn.sign_define("DapBreakpoint", { text = "●", texthl = "DiagnosticError", linehl = "", numhl = "" })
|
||||
vim.fn.sign_define("DapBreakpointCondition", { text = "◆", texthl = "DiagnosticWarn", linehl = "", numhl = "" })
|
||||
vim.fn.sign_define("DapStopped", { text = "▶", texthl = "DiagnosticOk", linehl = "DapStoppedLine", numhl = "" })
|
||||
@@ -1,6 +1,48 @@
|
||||
-- NvChad sets default capabilities (nvim-cmp) and on_attach via vim.lsp.config("*", ...)
|
||||
require("nvchad.configs.lspconfig").defaults()
|
||||
|
||||
local servers = { "html", "cssls" }
|
||||
vim.lsp.enable(servers)
|
||||
-- Go
|
||||
vim.lsp.config("gopls", {
|
||||
settings = {
|
||||
gopls = {
|
||||
gofumpt = true,
|
||||
usePlaceholders = true,
|
||||
staticcheck = true,
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
shadow = true,
|
||||
nilness = true,
|
||||
},
|
||||
hints = {
|
||||
assignVariableTypes = true,
|
||||
compositeLiteralFields = true,
|
||||
functionTypeParameters = true,
|
||||
parameterNames = true,
|
||||
rangeVariableTypes = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- read :h vim.lsp.config for changing options of lsp servers
|
||||
-- YAML
|
||||
vim.lsp.config("yamlls", {
|
||||
settings = {
|
||||
yaml = {
|
||||
validate = true,
|
||||
schemaStore = {
|
||||
enable = true,
|
||||
url = "https://www.schemastore.org/api/json/catalog.json",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- C# / OmniSharp
|
||||
vim.lsp.config("omnisharp", {
|
||||
enable_roslyn_analyzers = true,
|
||||
organize_imports_on_format = true,
|
||||
enable_import_completion = true,
|
||||
})
|
||||
|
||||
-- Enable all servers (Mason puts their binaries on PATH automatically)
|
||||
vim.lsp.enable({ "gopls", "yamlls", "bashls", "omnisharp" })
|
||||
|
||||
Reference in New Issue
Block a user