diff --git a/lua/chadrc.lua b/lua/chadrc.lua index a3ae634..6f6a16e 100644 --- a/lua/chadrc.lua +++ b/lua/chadrc.lua @@ -6,7 +6,7 @@ local M = {} M.base46 = { - theme = "monekai", + theme = "github_dark", -- hl_override = { -- Comment = { italic = true }, diff --git a/lua/configs/lint.lua b/lua/configs/lint.lua new file mode 100644 index 0000000..1a23def --- /dev/null +++ b/lua/configs/lint.lua @@ -0,0 +1,23 @@ +local lint = require "lint" + +lint.linters_by_ft = { + python = { "ruff" }, + yaml = { "yamllint" }, + lua = { "selene" }, +} + +local ns = lint.get_namespace "ruff" +vim.diagnostic.config({ virtual_text = false, underline = false }, ns) + +local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) + +-- vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { +-- group = lint_augroup, +-- callback = function() +-- lint.try_lint() +-- end, +-- }) + +vim.keymap.set("n", "ld", function() + lint.try_lint() +end, { desc = "Trigger linting for current file" }) diff --git a/lua/mappings.lua b/lua/mappings.lua index e768b3d..9f5abe1 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -66,4 +66,66 @@ map("n", "qd", function() require("persistence").stop() end, { desc = "Stop persistence" }) --- tab related stuff +-- debug related stuff +local dap = require "dap" + +map("n", "db", function() + dap.toggle_breakpoint() +end, { desc = "Toggle breakpoint" }) + +map("n", "dc", function() + dap.continue() +end, { desc = "Continue" }) + +map("n", "dr", function() + dap.repl.open() +end, { desc = "Open REPL" }) + +map("n", "ds", function() + dap.step_over() +end, { desc = "Step over" }) + +map("n", "di", function() + dap.step_into() +end, { desc = "Step into" }) + +map("n", "do", function() + dap.step_out() +end, { desc = "Step out" }) + +map("n", "dT", function() + dap.terminate() +end, { desc = "Terminate" }) + +map("n", "dl", function() + dap.run_last() +end, { desc = "Run Last" }) + +map("n", "dC", function() + dap.run_to_cursor() +end, { desc = "Run to Cursor" }) + +-- dapui + +local dapui = require "dapui" +local widgets = require "dap.ui.widgets" + +map("n", "du", function() + dapui.toggle() +end, { desc = "Toggle UI" }) + +map({ "n", "v" }, "dh", function() + widgets.hover() +end, { desc = "Hover" }) + +map({ "n", "v" }, "dp", function() + widgets.preview() +end, { desc = "Preview" }) + +map("n", "df", function() + widgets.centered_float(widgets.frames) +end, { desc = "Frames" }) + +map("n", "ds", function() + widgets.centered_float(widgets.scopes) +end, { desc = "Scopes" }) diff --git a/lua/options.lua b/lua/options.lua index a7630c8..2c0f37f 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -18,3 +18,11 @@ vim.api.nvim_create_autocmd("textyankpost", { pattern = "*", }) +require "dap" + +local sign = vim.fn.sign_define + +sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = ""}) +sign("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = ""}) +sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = ""}) +sign('DapStopped', { text='', texthl='DapStopped', linehl='DapStopped', numhl= 'DapStopped' }) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 80c9c8a..1d26315 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -15,69 +15,112 @@ return { end, }, + { + "mfussenegger/nvim-dap", + lazy = true, + }, + + { + "jay-babu/mason-nvim-dap.nvim", + opts = { + handlers = {}, + automatic_installations = { + exclude = { + "python", + }, + }, + ensure_installed = { + "python", + }, + }, + dependencies = { + "mfussenegger/nvim-dap", + "williamboman/mason.nvim", + }, + }, + + { + "mfussenegger/nvim-dap-python", + lazy = true, + config = function() + local python = vim.fn.expand "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python" + require("dap-python").setup(python) + end, + dependencies = { + "mfussenegger/nvim-dap", + }, + }, + + { + "theHamsta/nvim-dap-virtual-text", + config = true, + dependencies = { + "mfussenegger/nvim-dap", + }, + }, + + { + "rcarriga/nvim-dap-ui", + config = true, + dependencies = { + "mfussenegger/nvim-dap", + "mfussenegger/nvim-dap-python", + "nvim-neotest/nvim-nio", + "theHamsta/nvim-dap-virtual-text", + }, + }, + { "mfussenegger/nvim-lint", lazy = true, event = { "BufReadPre", "BufNewFile" }, config = function() - local lint = require "lint" - - lint.linters_by_ft = { - python = { "ruff" }, - yaml = { "yamllint" }, - lua = { "selene" }, - } - - local ns = lint.get_namespace "ruff" - vim.diagnostic.config({ virtual_text = false, underline = false }, ns) - - local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) - - vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, { - group = lint_augroup, - callback = function() - lint.try_lint() - end, - }) - - vim.keymap.set("n", "ld", function() - lint.try_lint() - end, { desc = "Trigger linting for current file" }) + require "configs.lint" end, }, - -- { - -- "nvim-treesitter/nvim-treesitter", - -- opts = { - -- ensure_installed = { - -- "vim", "lua", "vimdoc", - -- "html", "css" - -- }, - -- }, - -- }, + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "vim", + "lua", + "python", + "markdown", + }, + }, + }, + { "nvim-treesitter/nvim-treesitter-context", lazy = false, config = function() - require"treesitter-context".setup{ + require("treesitter-context").setup { enable = true, max_lines = 0, -- No limit } - end, + end, }, - { - "rktjmp/paperplanes.nvim", - opts = { - provider = "dpaste.org", - }, { - "folke/persistence.nvim", - event = "BufReadPre", -- this will only start session saving when an actual file was opened - opts = { - -- add any custom options here - } - } }, + "rktjmp/paperplanes.nvim", + lazy = false, + config = function() + require("paperplanes").setup { + provider = "dpaste.org", + } + end, + }, + + { + { + "folke/persistence.nvim", + event = "BufReadPre", -- this will only start session saving when an actual file was opened + opts = { + -- add any custom options here + }, + }, + }, { "NvChad/nvcommunity", @@ -89,7 +132,7 @@ return { cmd = "Copilot", event = "InsertEnter", config = function() - require("copilot").setup({ + require("copilot").setup { suggestion = { enabled = true, auto_trigger = true, @@ -104,7 +147,7 @@ return { dismiss = "", }, }, - }) + } end, }, },