Add debugger for python and reorder linting logic
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.base46 = {
|
M.base46 = {
|
||||||
theme = "monekai",
|
theme = "github_dark",
|
||||||
|
|
||||||
-- hl_override = {
|
-- hl_override = {
|
||||||
-- Comment = { italic = true },
|
-- Comment = { italic = true },
|
||||||
|
|||||||
23
lua/configs/lint.lua
Normal file
23
lua/configs/lint.lua
Normal file
@@ -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", "<leader>ld", function()
|
||||||
|
lint.try_lint()
|
||||||
|
end, { desc = "Trigger linting for current file" })
|
||||||
@@ -66,4 +66,66 @@ map("n", "<leader>qd", function()
|
|||||||
require("persistence").stop()
|
require("persistence").stop()
|
||||||
end, { desc = "Stop persistence" })
|
end, { desc = "Stop persistence" })
|
||||||
|
|
||||||
-- tab related stuff
|
-- debug related stuff
|
||||||
|
local dap = require "dap"
|
||||||
|
|
||||||
|
map("n", "<leader>db", function()
|
||||||
|
dap.toggle_breakpoint()
|
||||||
|
end, { desc = "Toggle breakpoint" })
|
||||||
|
|
||||||
|
map("n", "<leader>dc", function()
|
||||||
|
dap.continue()
|
||||||
|
end, { desc = "Continue" })
|
||||||
|
|
||||||
|
map("n", "<leader>dr", function()
|
||||||
|
dap.repl.open()
|
||||||
|
end, { desc = "Open REPL" })
|
||||||
|
|
||||||
|
map("n", "<leader>ds", function()
|
||||||
|
dap.step_over()
|
||||||
|
end, { desc = "Step over" })
|
||||||
|
|
||||||
|
map("n", "<leader>di", function()
|
||||||
|
dap.step_into()
|
||||||
|
end, { desc = "Step into" })
|
||||||
|
|
||||||
|
map("n", "<leader>do", function()
|
||||||
|
dap.step_out()
|
||||||
|
end, { desc = "Step out" })
|
||||||
|
|
||||||
|
map("n", "<leader>dT", function()
|
||||||
|
dap.terminate()
|
||||||
|
end, { desc = "Terminate" })
|
||||||
|
|
||||||
|
map("n", "<leader>dl", function()
|
||||||
|
dap.run_last()
|
||||||
|
end, { desc = "Run Last" })
|
||||||
|
|
||||||
|
map("n", "<leader>dC", function()
|
||||||
|
dap.run_to_cursor()
|
||||||
|
end, { desc = "Run to Cursor" })
|
||||||
|
|
||||||
|
-- dapui
|
||||||
|
|
||||||
|
local dapui = require "dapui"
|
||||||
|
local widgets = require "dap.ui.widgets"
|
||||||
|
|
||||||
|
map("n", "<leader>du", function()
|
||||||
|
dapui.toggle()
|
||||||
|
end, { desc = "Toggle UI" })
|
||||||
|
|
||||||
|
map({ "n", "v" }, "<Leader>dh", function()
|
||||||
|
widgets.hover()
|
||||||
|
end, { desc = "Hover" })
|
||||||
|
|
||||||
|
map({ "n", "v" }, "<Leader>dp", function()
|
||||||
|
widgets.preview()
|
||||||
|
end, { desc = "Preview" })
|
||||||
|
|
||||||
|
map("n", "<Leader>df", function()
|
||||||
|
widgets.centered_float(widgets.frames)
|
||||||
|
end, { desc = "Frames" })
|
||||||
|
|
||||||
|
map("n", "<Leader>ds", function()
|
||||||
|
widgets.centered_float(widgets.scopes)
|
||||||
|
end, { desc = "Scopes" })
|
||||||
|
|||||||
@@ -18,3 +18,11 @@ vim.api.nvim_create_autocmd("textyankpost", {
|
|||||||
pattern = "*",
|
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' })
|
||||||
|
|||||||
@@ -15,69 +15,112 @@ return {
|
|||||||
end,
|
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",
|
"mfussenegger/nvim-lint",
|
||||||
lazy = true,
|
lazy = true,
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
config = function()
|
config = function()
|
||||||
local lint = require "lint"
|
require "configs.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", "<leader>ld", function()
|
|
||||||
lint.try_lint()
|
|
||||||
end, { desc = "Trigger linting for current file" })
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- {
|
{
|
||||||
-- "nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
-- opts = {
|
opts = {
|
||||||
-- ensure_installed = {
|
ensure_installed = {
|
||||||
-- "vim", "lua", "vimdoc",
|
"vim",
|
||||||
-- "html", "css"
|
"lua",
|
||||||
-- },
|
"python",
|
||||||
-- },
|
"markdown",
|
||||||
-- },
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter-context",
|
"nvim-treesitter/nvim-treesitter-context",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
config = function()
|
config = function()
|
||||||
require"treesitter-context".setup{
|
require("treesitter-context").setup {
|
||||||
enable = true,
|
enable = true,
|
||||||
max_lines = 0, -- No limit
|
max_lines = 0, -- No limit
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"rktjmp/paperplanes.nvim",
|
|
||||||
opts = {
|
|
||||||
provider = "dpaste.org",
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"folke/persistence.nvim",
|
"rktjmp/paperplanes.nvim",
|
||||||
event = "BufReadPre", -- this will only start session saving when an actual file was opened
|
lazy = false,
|
||||||
opts = {
|
config = function()
|
||||||
-- add any custom options here
|
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",
|
"NvChad/nvcommunity",
|
||||||
@@ -89,7 +132,7 @@ return {
|
|||||||
cmd = "Copilot",
|
cmd = "Copilot",
|
||||||
event = "InsertEnter",
|
event = "InsertEnter",
|
||||||
config = function()
|
config = function()
|
||||||
require("copilot").setup({
|
require("copilot").setup {
|
||||||
suggestion = {
|
suggestion = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
auto_trigger = true,
|
auto_trigger = true,
|
||||||
@@ -104,7 +147,7 @@ return {
|
|||||||
dismiss = "<M-d>",
|
dismiss = "<M-d>",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user