mirror of
https://github.com/macocianradu/setup.git
synced 2026-07-16 10:38:46 +00:00
Compare commits
5 Commits
99a9f3ae12
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 3fe4aa1205 | |||
| c6739ea0da | |||
| 1b406704ad | |||
| aeab462a8b | |||
| 7ba072972f |
@@ -10,6 +10,7 @@ dap.listeners.after.event_exited["dapui_config"] = function() dapui.close() end
|
|||||||
local dotnet = require("dap.dap-dotnet")
|
local dotnet = require("dap.dap-dotnet")
|
||||||
local odoo = require("dap.dap-odoo")
|
local odoo = require("dap.dap-odoo")
|
||||||
local haskell = require("dap.dap-haskell")
|
local haskell = require("dap.dap-haskell")
|
||||||
|
local go = require("dap.dap-go")
|
||||||
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>5", function()
|
vim.keymap.set("n", "<leader>5", function()
|
||||||
@@ -18,6 +19,10 @@ vim.keymap.set("n", "<leader>5", function()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
local ft = vim.bo.filetype
|
local ft = vim.bo.filetype
|
||||||
|
if ft == "go" then
|
||||||
|
go.debug_go()
|
||||||
|
return
|
||||||
|
end
|
||||||
if ft == "cs" or ft == "fsharp" or ft == "vb" then
|
if ft == "cs" or ft == "fsharp" or ft == "vb" then
|
||||||
dotnet.debug_dotnet_from_sln()
|
dotnet.debug_dotnet_from_sln()
|
||||||
return
|
return
|
||||||
@@ -39,7 +44,9 @@ vim.keymap.set("n", "<leader>b", function() dap.toggle_breakpoint() end)
|
|||||||
vim.keymap.set("n", "<leader>B", function() dap.set_breakpoint(vim.fn.input("Breakpoint condition: ")) end)
|
vim.keymap.set("n", "<leader>B", function() dap.set_breakpoint(vim.fn.input("Breakpoint condition: ")) end)
|
||||||
vim.keymap.set("n", "<leader>qd", function() dap.terminate() end)
|
vim.keymap.set("n", "<leader>qd", function() dap.terminate() end)
|
||||||
vim.keymap.set("n", "<leader>rd", function() dap.restart() end)
|
vim.keymap.set("n", "<leader>rd", function() dap.restart() end)
|
||||||
vim.keymap.set("n", "<leader>dt", odoo.run_odoo_test_at_cursor, { desc = "Debug Odoo Test unde Cursor" })
|
vim.keymap.set("n", "<leader>dt", function()
|
||||||
|
odoo.run_odoo_test_at_cursor()
|
||||||
|
end, { desc = "Debug Test under Cursor" })
|
||||||
|
|
||||||
dap.configurations.python = {
|
dap.configurations.python = {
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ local angular_cmd = {
|
|||||||
'--tsProbeLocations',
|
'--tsProbeLocations',
|
||||||
project_library_path,
|
project_library_path,
|
||||||
'--ngProbeLocations',
|
'--ngProbeLocations',
|
||||||
project_library_path .. '@angular/language-server'
|
project_library_path .. '/@angular/language-server'
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.lsp.config("ts_ls", {})
|
vim.lsp.config("ts_ls", {})
|
||||||
@@ -23,6 +23,7 @@ vim.lsp.config("angularls", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
vim.lsp.config("ruff", {})
|
vim.lsp.config("ruff", {})
|
||||||
|
vim.lsp.config("gopls", {})
|
||||||
vim.lsp.config("cssls", {})
|
vim.lsp.config("cssls", {})
|
||||||
vim.lsp.config("lua_ls", {})
|
vim.lsp.config("lua_ls", {})
|
||||||
vim.lsp.config("hls", {})
|
vim.lsp.config("hls", {})
|
||||||
@@ -41,15 +42,21 @@ vim.lsp.config("eslint", {
|
|||||||
root_markers = { ".eslintrc", ".eslintrc.json", ".eslintrc.js", "package.json", ".git" },
|
root_markers = { ".eslintrc", ".eslintrc.json", ".eslintrc.js", "package.json", ".git" },
|
||||||
filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte" },
|
filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "svelte" },
|
||||||
settings = {
|
settings = {
|
||||||
validate = "on",
|
eslint = {
|
||||||
packageManager = "npm",
|
validate = "on",
|
||||||
workingDirectory = { mode = "auto" },
|
packageManager = "npm",
|
||||||
debug = true,
|
workingDirectory = { mode = "auto" },
|
||||||
format = true,
|
debug = true,
|
||||||
|
format = { enable = true },
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
client.server_capabilities.documentFormattingProvider = true
|
||||||
|
client.server_capabilities.documentRangeFormattingProvider = true
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.lsp.enable({ "angularls", "odoo_ls", "hls", "ruff", "eslint", "cssls", "lua_ls", "lemminx", "qmlls" })
|
vim.lsp.enable({ "angularls", "ts_ls", "odoo_ls", "hls", "ruff", "eslint", "cssls", "lua_ls", "lemminx", "qmlls", "gopls" })
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
group = vim.api.nvim_create_augroup('user_lsp_attach', { clear = true }),
|
group = vim.api.nvim_create_augroup('user_lsp_attach', { clear = true }),
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
local neoscroll = require('neoscroll')
|
local neoscroll = require('neoscroll')
|
||||||
neoscroll.setup({
|
neoscroll.setup({
|
||||||
easing = 'quadratic',
|
easing = 'quadratic',
|
||||||
|
mappings = {
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local keymap = {
|
local keymap = {
|
||||||
@@ -8,8 +10,6 @@ local keymap = {
|
|||||||
['<C-d>'] = function() neoscroll.ctrl_d({ duration = 125 }) end,
|
['<C-d>'] = function() neoscroll.ctrl_d({ duration = 125 }) end,
|
||||||
['<C-b>'] = function() neoscroll.ctrl_b({ duration = 200 }) end,
|
['<C-b>'] = function() neoscroll.ctrl_b({ duration = 200 }) end,
|
||||||
['<C-f>'] = function() neoscroll.ctrl_f({ duration = 200 }) end,
|
['<C-f>'] = function() neoscroll.ctrl_f({ duration = 200 }) end,
|
||||||
['<C-y>'] = function() neoscroll.scroll(-0.1, { move_cursor = false, duration = 60 }) end,
|
|
||||||
['<C-e>'] = function() neoscroll.scroll(0.1, { move_cursor = false, duration = 60 }) end,
|
|
||||||
['zt'] = function() neoscroll.zt({ half_win_duration = 125 }) end,
|
['zt'] = function() neoscroll.zt({ half_win_duration = 125 }) end,
|
||||||
['zz'] = function() neoscroll.zz({ half_win_duration = 125 }) end,
|
['zz'] = function() neoscroll.zz({ half_win_duration = 125 }) end,
|
||||||
['zb'] = function() neoscroll.zb({ half_win_duration = 125 }) end,
|
['zb'] = function() neoscroll.zb({ half_win_duration = 125 }) end,
|
||||||
|
|||||||
@@ -1,2 +1,74 @@
|
|||||||
vim.keymap.set("n", "<leader>tl", "<cmd>TidalLaunch<cr>")
|
vim.keymap.set("n", "<leader>tl", "<cmd>TidalLaunch<cr>")
|
||||||
vim.keymap.set("n", "<leader>tq", "<cmd>TidalQuit<cr>")
|
vim.keymap.set("n", "<leader>tq", "<cmd>TidalQuit<cr>")
|
||||||
|
|
||||||
|
local scd = os.getenv("HOME") .. "/.local/share/tidal/BootSuperDirt.scd"
|
||||||
|
|
||||||
|
local function superdirt_running()
|
||||||
|
local id = vim.g.superdirt_job
|
||||||
|
return id and id > 0 and vim.fn.jobwait({ id }, 0)[1] == -1
|
||||||
|
end
|
||||||
|
|
||||||
|
local function log_buf()
|
||||||
|
local b = vim.g.superdirt_buf
|
||||||
|
if not (b and vim.api.nvim_buf_is_valid(b)) then
|
||||||
|
b = vim.api.nvim_create_buf(false, true)
|
||||||
|
vim.api.nvim_buf_set_name(b, "SuperDirt")
|
||||||
|
vim.g.superdirt_buf = b
|
||||||
|
end
|
||||||
|
return b
|
||||||
|
end
|
||||||
|
|
||||||
|
local function append(_, data)
|
||||||
|
if not data then return end
|
||||||
|
vim.schedule(function()
|
||||||
|
local lines = {}
|
||||||
|
for _, l in ipairs(data) do
|
||||||
|
l = l:gsub("\r", "")
|
||||||
|
table.insert(lines, l)
|
||||||
|
if l:match("SuperDirt:%s*listening") then
|
||||||
|
vim.notify("SuperDirt ready", vim.log.levels.INFO)
|
||||||
|
elseif l:match("ERROR") then
|
||||||
|
vim.notify("SuperDirt: " .. l, vim.log.levels.ERROR)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.api.nvim_buf_set_lines(log_buf(), -1, -1, false, lines)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command("SuperDirtLog", function()
|
||||||
|
vim.cmd("botright split")
|
||||||
|
vim.api.nvim_win_set_buf(0, log_buf())
|
||||||
|
end, { desc = "Open SuperDirt output log" })
|
||||||
|
|
||||||
|
local group = vim.api.nvim_create_augroup("TidalSuperDirt", { clear = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
group = group,
|
||||||
|
pattern = "TidalLaunch",
|
||||||
|
callback = function()
|
||||||
|
if superdirt_running() then
|
||||||
|
vim.notify("SuperDirt already running", vim.log.levels.INFO)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
vim.fn.deletebufline(log_buf(), 1, "$")
|
||||||
|
vim.g.superdirt_job = vim.fn.jobstart({ "sclang", scd }, {
|
||||||
|
on_stdout = append,
|
||||||
|
on_stderr = append,
|
||||||
|
on_exit = function() vim.g.superdirt_job = nil end,
|
||||||
|
})
|
||||||
|
if vim.g.superdirt_job <= 0 then
|
||||||
|
vim.notify("Failed to start sclang (is SuperCollider installed?)", vim.log.levels.ERROR)
|
||||||
|
else
|
||||||
|
vim.notify("Booting SuperDirt... (:SuperDirtLog for output)", vim.log.levels.INFO)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("VimLeavePre", {
|
||||||
|
group = group,
|
||||||
|
callback = function()
|
||||||
|
if superdirt_running() then
|
||||||
|
vim.fn.jobstop(vim.g.superdirt_job)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
local dap = require("dap")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
-- Locate the delve binary (prefer mason, fall back to PATH).
|
||||||
|
local function dlv_command()
|
||||||
|
local mason = vim.fn.expand("$HOME/.local/share/nvim/mason/bin/dlv")
|
||||||
|
if vim.fn.filereadable(mason) == 1 then
|
||||||
|
return mason
|
||||||
|
end
|
||||||
|
return "dlv"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Adapter: run delve in DAP server mode on a free port.
|
||||||
|
dap.adapters.go = {
|
||||||
|
type = "server",
|
||||||
|
port = "${port}",
|
||||||
|
executable = {
|
||||||
|
command = dlv_command(),
|
||||||
|
args = { "dap", "-l", "127.0.0.1:${port}" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Walk upwards from the current file to find the Go module root (go.mod).
|
||||||
|
local function find_go_root()
|
||||||
|
local start = vim.fn.expand("%:p:h")
|
||||||
|
if start == "" then
|
||||||
|
start = vim.fn.getcwd()
|
||||||
|
end
|
||||||
|
local found = vim.fs.find("go.mod", { upward = true, path = start })[1]
|
||||||
|
if found then
|
||||||
|
return vim.fn.fnamemodify(found, ":h")
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Find the module root and launch a delve debug session of the whole project.
|
||||||
|
function M.debug_go()
|
||||||
|
local root = find_go_root()
|
||||||
|
if not root then
|
||||||
|
vim.notify("No go.mod found upwards from current file.", vim.log.levels.ERROR)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
dap.run({
|
||||||
|
type = "go",
|
||||||
|
request = "launch",
|
||||||
|
name = "Debug project",
|
||||||
|
program = root,
|
||||||
|
cwd = root,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -35,18 +35,11 @@ require("lazy").setup({
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"thgrund/tidal.nvim",
|
"https://codeberg.org/MrReason/tidal.nvim",
|
||||||
opts = {
|
opts = {
|
||||||
boot = {
|
boot = {
|
||||||
tidal = {
|
tidal = {
|
||||||
cmd = os.getenv("HOME") .. "/.ghcup/bin/ghci",
|
cmd = os.getenv("HOME") .. "/.ghcup/bin/ghci",
|
||||||
highlight = {
|
|
||||||
autostart = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sclang = {
|
|
||||||
enabled = true,
|
|
||||||
file = os.getenv("HOME") .. "/.local/share/tidal/BootSuperDirt.scd",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user