overhaul of some dotfiles
This commit is contained in:
@@ -1,24 +1,19 @@
|
||||
-- This file needs to have same structure as nvconfig.lua
|
||||
-- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua
|
||||
-- Please read that file to know all available options :(
|
||||
|
||||
---@type ChadrcConfig
|
||||
local M = {}
|
||||
|
||||
M.base46 = {
|
||||
theme = "onedark",
|
||||
|
||||
-- hl_override = {
|
||||
-- Comment = { italic = true },
|
||||
-- ["@comment"] = { italic = true },
|
||||
-- },
|
||||
theme = "onedark",
|
||||
}
|
||||
|
||||
-- M.nvdash = { load_on_startup = true }
|
||||
-- M.ui = {
|
||||
-- tabufline = {
|
||||
-- lazyload = false
|
||||
-- }
|
||||
-- }
|
||||
-- Enable the startup dashboard
|
||||
M.nvdash = {
|
||||
load_on_startup = true,
|
||||
}
|
||||
|
||||
M.ui = {
|
||||
tabufline = {
|
||||
lazyload = false,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
@@ -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" })
|
||||
|
||||
@@ -1,10 +1,79 @@
|
||||
require "nvchad.mappings"
|
||||
|
||||
-- add yours here
|
||||
|
||||
local map = vim.keymap.set
|
||||
|
||||
-- Quick command mode
|
||||
map("n", ";", ":", { desc = "CMD enter command mode" })
|
||||
map("i", "jk", "<ESC>")
|
||||
map("i", "jk", "<ESC>", { desc = "Escape insert mode" })
|
||||
|
||||
-- map({ "n", "i", "v" }, "<C-s>", "<cmd> w <cr>")
|
||||
-- Save with Ctrl+S
|
||||
map({ "n", "i", "v" }, "<C-s>", "<cmd>w<cr>", { desc = "Save file" })
|
||||
|
||||
-- ── Git ──────────────────────────────────────────────────────────────────────
|
||||
map("n", "<leader>gg", "<cmd>LazyGit<cr>", { desc = "Open LazyGit" })
|
||||
|
||||
-- ── Diagnostics (Trouble) ────────────────────────────────────────────────────
|
||||
map("n", "<leader>xx", "<cmd>Trouble diagnostics toggle<cr>", { desc = "Workspace diagnostics" })
|
||||
map("n", "<leader>xb", "<cmd>Trouble diagnostics toggle filter.buf=0<cr>", { desc = "Buffer diagnostics" })
|
||||
map("n", "<leader>xs", "<cmd>Trouble symbols toggle focus=false<cr>", { desc = "Document symbols" })
|
||||
map("n", "<leader>xl", "<cmd>Trouble lsp toggle focus=false win.position=right<cr>", { desc = "LSP references" })
|
||||
map("n", "<leader>xq", "<cmd>Trouble qflist toggle<cr>", { desc = "Quickfix list" })
|
||||
|
||||
-- ── DAP ──────────────────────────────────────────────────────────────────────
|
||||
map("n", "<leader>db", "<cmd>DapToggleBreakpoint<cr>", { desc = "Toggle breakpoint" })
|
||||
map("n", "<leader>dB", function()
|
||||
require("dap").set_breakpoint(vim.fn.input "Condition: ")
|
||||
end, { desc = "Conditional breakpoint" })
|
||||
map("n", "<leader>dc", "<cmd>DapContinue<cr>", { desc = "Continue" })
|
||||
map("n", "<leader>di", "<cmd>DapStepInto<cr>", { desc = "Step into" })
|
||||
map("n", "<leader>do", "<cmd>DapStepOver<cr>", { desc = "Step over" })
|
||||
map("n", "<leader>dO", "<cmd>DapStepOut<cr>", { desc = "Step out" })
|
||||
map("n", "<leader>dt", "<cmd>DapTerminate<cr>", { desc = "Terminate" })
|
||||
map("n", "<leader>du", function() require("dapui").toggle() end, { desc = "Toggle DAP UI" })
|
||||
map("n", "<leader>dr", function() require("dap").repl.open() end,{ desc = "Open REPL" })
|
||||
map("n", "<leader>dgt", function() require("dap-go").debug_test() end, { desc = "Debug Go test" })
|
||||
map("n", "<leader>dgl", function() require("dap-go").debug_last_test() end, { desc = "Debug last Go test" })
|
||||
|
||||
-- ── Terminal ──────────────────────────────────────────────────────────────────
|
||||
map("n", "<leader>tf", "<cmd>ToggleTerm direction=float<cr>", { desc = "Float terminal" })
|
||||
map("n", "<leader>th", "<cmd>ToggleTerm direction=horizontal<cr>", { desc = "Horizontal terminal" })
|
||||
map("n", "<leader>tv", "<cmd>ToggleTerm direction=vertical<cr>", { desc = "Vertical terminal" })
|
||||
|
||||
-- ── TODO comments ─────────────────────────────────────────────────────────────
|
||||
map("n", "<leader>ft", "<cmd>TodoTelescope<cr>", { desc = "Find TODOs" })
|
||||
map("n", "]t", function() require("todo-comments").jump_next() end, { desc = "Next TODO" })
|
||||
map("n", "[t", function() require("todo-comments").jump_prev() end, { desc = "Prev TODO" })
|
||||
|
||||
-- ── Harpoon ───────────────────────────────────────────────────────────────────
|
||||
map("n", "<leader>ha", function() require("harpoon"):list():add() end, { desc = "Add file" })
|
||||
map("n", "<leader>hh", function()
|
||||
local h = require "harpoon"
|
||||
h.ui:toggle_quick_menu(h:list())
|
||||
end, { desc = "Toggle menu" })
|
||||
map("n", "<leader>h1", function() require("harpoon"):list():select(1) end, { desc = "File 1" })
|
||||
map("n", "<leader>h2", function() require("harpoon"):list():select(2) end, { desc = "File 2" })
|
||||
map("n", "<leader>h3", function() require("harpoon"):list():select(3) end, { desc = "File 3" })
|
||||
map("n", "<leader>h4", function() require("harpoon"):list():select(4) end, { desc = "File 4" })
|
||||
-- cycle through harpoon list
|
||||
map("n", "<leader>hp", function() require("harpoon"):list():prev() end, { desc = "Prev file" })
|
||||
map("n", "<leader>hn", function() require("harpoon"):list():next() end, { desc = "Next file" })
|
||||
|
||||
-- ── Oil ───────────────────────────────────────────────────────────────────────
|
||||
map("n", "-", "<cmd>Oil<cr>", { desc = "Open parent dir (Oil)" })
|
||||
map("n", "<leader>oo", "<cmd>Oil --float<cr>", { desc = "Oil (float)" })
|
||||
|
||||
-- ── which-key group labels ────────────────────────────────────────────────────
|
||||
vim.schedule(function()
|
||||
local ok, wk = pcall(require, "which-key")
|
||||
if not ok then return end
|
||||
wk.add {
|
||||
{ "<leader>d", group = "Debug" },
|
||||
{ "<leader>dg", group = "Go" },
|
||||
{ "<leader>x", group = "Diagnostics" },
|
||||
{ "<leader>t", group = "Terminal" },
|
||||
{ "<leader>g", group = "Git" },
|
||||
{ "<leader>h", group = "Harpoon" },
|
||||
{ "<leader>o", group = "Oil" },
|
||||
{ "<leader>f", group = "Find" },
|
||||
}
|
||||
end)
|
||||
|
||||
@@ -1,6 +1,23 @@
|
||||
require "nvchad.options"
|
||||
|
||||
-- add yours here!
|
||||
local o = vim.opt
|
||||
|
||||
-- local o = vim.o
|
||||
-- o.cursorlineopt ='both' -- to enable cursorline!
|
||||
o.relativenumber = true -- relative line numbers for fast navigation
|
||||
o.scrolloff = 8 -- keep 8 lines visible above/below cursor
|
||||
o.sidescrolloff = 8
|
||||
o.wrap = false -- no line wrapping
|
||||
o.undofile = true -- persist undo history across sessions
|
||||
o.splitbelow = true -- horizontal splits open below
|
||||
o.splitright = true -- vertical splits open to the right
|
||||
o.colorcolumn = "120" -- column ruler at 120 chars
|
||||
o.cursorline = true -- highlight current line
|
||||
|
||||
-- Go uses real tabs; everything else uses 4-space soft tabs
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "go",
|
||||
callback = function()
|
||||
vim.opt_local.expandtab = false
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -1,11 +1,22 @@
|
||||
return {
|
||||
-- Treesitter: syntax highlighting + code understanding
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
-- event = 'BufWritePre', -- uncomment for format on save
|
||||
opts = require "configs.conform",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"vim", "lua", "vimdoc",
|
||||
"go", "gomod", "gowork", "gosum",
|
||||
"c_sharp",
|
||||
"yaml",
|
||||
"bash",
|
||||
"json", "jsonc",
|
||||
"toml",
|
||||
"markdown", "markdown_inline",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- These are some examples, uncomment them if you want to see them work!
|
||||
-- LSP servers
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
@@ -13,16 +24,107 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
-- test new blink
|
||||
-- { import = "nvchad.blink.lazyspec" },
|
||||
-- Formatting (with format-on-save)
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
event = "BufWritePre",
|
||||
opts = require "configs.conform",
|
||||
},
|
||||
|
||||
-- {
|
||||
-- "nvim-treesitter/nvim-treesitter",
|
||||
-- opts = {
|
||||
-- ensure_installed = {
|
||||
-- "vim", "lua", "vimdoc",
|
||||
-- "html", "css"
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- Mason: auto-install LSPs, formatters, and DAP adapters
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
-- LSPs
|
||||
"gopls",
|
||||
"omnisharp",
|
||||
"yaml-language-server",
|
||||
"bash-language-server",
|
||||
-- Formatters / linters
|
||||
"goimports",
|
||||
"csharpier",
|
||||
"prettier",
|
||||
"shfmt",
|
||||
"stylua",
|
||||
-- DAP adapters
|
||||
"delve", -- Go debugger
|
||||
"netcoredbg", -- .NET debugger
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Diagnostics panel
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
cmd = "Trouble",
|
||||
opts = { use_diagnostic_signs = true },
|
||||
},
|
||||
|
||||
-- Floating terminal
|
||||
{
|
||||
"akinsho/toggleterm.nvim",
|
||||
version = "*",
|
||||
cmd = "ToggleTerm",
|
||||
keys = { [[<C-\>]] },
|
||||
opts = {
|
||||
open_mapping = [[<C-\>]],
|
||||
direction = "float",
|
||||
float_opts = { border = "curved" },
|
||||
},
|
||||
},
|
||||
|
||||
-- Lazygit inside Neovim
|
||||
{
|
||||
"kdheepak/lazygit.nvim",
|
||||
cmd = "LazyGit",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
},
|
||||
|
||||
-- DAP core + UI
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"nvim-neotest/nvim-nio", -- required by dap-ui
|
||||
"leoluz/nvim-dap-go",
|
||||
},
|
||||
config = function()
|
||||
require "configs.dap"
|
||||
end,
|
||||
},
|
||||
|
||||
-- Highlight TODO/FIXME/HACK/NOTE comments
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
event = "BufReadPost",
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- Harpoon2: quick-jump between pinned files per project
|
||||
{
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- Oil: edit the filesystem like a buffer
|
||||
{
|
||||
"stevearc/oil.nvim",
|
||||
lazy = false,
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
opts = {
|
||||
-- Keep nvim-tree as the default explorer; oil opens on demand via `-`
|
||||
default_file_explorer = false,
|
||||
columns = { "icon", "permissions", "size", "mtime" },
|
||||
view_options = { show_hidden = true },
|
||||
-- Don't clobber window-navigation keys
|
||||
keymaps = {
|
||||
["<C-h>"] = false,
|
||||
["<C-l>"] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user