Compare commits
No commits in common. "c829f44fed2c3029020a337d0d175264b30e706e" and "7857039d6f80490cc17cb441c312182dfd4a945f" have entirely different histories.
c829f44fed
...
7857039d6f
5 changed files with 44 additions and 201 deletions
|
@ -1 +1 @@
|
||||||
neovim lua gcc curl wget git unzip tar gzip ripgrep php composer go nodejs npm delve
|
neovim lua gcc curl wget git unzip tar gzip ripgrep php composer go nodejs npm
|
|
@ -1,25 +0,0 @@
|
||||||
return {
|
|
||||||
"leoluz/nvim-dap-go",
|
|
||||||
config = function()
|
|
||||||
|
|
||||||
require("dap-go").setup({
|
|
||||||
delve = {
|
|
||||||
cwd = require("utils.finder").find_project_dir(
|
|
||||||
"go.mod",
|
|
||||||
3,
|
|
||||||
{
|
|
||||||
"src",
|
|
||||||
"app",
|
|
||||||
"pkg"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"test"
|
|
||||||
},
|
|
||||||
true
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,75 +1,57 @@
|
||||||
return {
|
return {
|
||||||
{
|
"mfussenegger/nvim-dap",
|
||||||
"mfussenegger/nvim-dap",
|
dependencies = {
|
||||||
dependencies = {
|
"rcarriga/nvim-dap-ui",
|
||||||
"rcarriga/nvim-dap-ui",
|
"nvim-neotest/nvim-nio",
|
||||||
"nvim-neotest/nvim-nio",
|
},
|
||||||
},
|
config = function()
|
||||||
config = function()
|
-- Setup Debugging --
|
||||||
-- Setup Debugging --
|
local dap = require("dap")
|
||||||
local dap = require("dap")
|
|
||||||
|
|
||||||
-- Open UI on Debugging --
|
-- Open UI on Debugging --
|
||||||
local dapui = require("dapui")
|
local dapui = require("dapui").setup()
|
||||||
dapui.setup({
|
dap.listeners.before.attach.dapui_config = function()
|
||||||
layouts = {
|
dapui.open()
|
||||||
{
|
end
|
||||||
elements = {
|
dap.listeners.before.launch.dapui_config = function()
|
||||||
{ id = "scopes", size = 0.65 },
|
dapui.open()
|
||||||
{ id = "breakpoints", size = 0.35 },
|
end
|
||||||
},
|
dap.listeners.before.event_terminated.dapui_config = function()
|
||||||
position = "left",
|
dapui.close()
|
||||||
size = 40,
|
end
|
||||||
},
|
dap.listeners.before.event_exited.dapui_config = function()
|
||||||
{
|
dapui.close()
|
||||||
elements = {
|
end
|
||||||
{ id = "repl", size = 0.5 },
|
|
||||||
{ id = "console", size = 0.5 },
|
|
||||||
},
|
|
||||||
position = "bottom",
|
|
||||||
size = 10,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
dap.listeners.before.attach.dapui_config = function()
|
|
||||||
dapui.open()
|
|
||||||
end
|
|
||||||
dap.listeners.before.launch.dapui_config = function()
|
|
||||||
dapui.open()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Keybinding --
|
-- Keybinding --
|
||||||
vim.keymap.set("n", "<Leader>dt", dapui.toggle, { desc = "Toggle Debugger UI" })
|
vim.keymap.set("n", "<Leader>db", dap.toggle_breakpoint, { desc = "Toggle Breakpoint" })
|
||||||
vim.keymap.set("n", "<Leader>db", dap.toggle_breakpoint, { desc = "Toggle Breakpoint" })
|
vim.keymap.set("n", "<Leader>dc", dap.continue, { desc = "Debugger Continue" })
|
||||||
vim.keymap.set("n", "<Leader>dc", dap.continue, { desc = "Debugger Continue" })
|
vim.keymap.set("n", "<Leader>dx", dap.terminate, { desc = "Debugger Terminate" })
|
||||||
vim.keymap.set("n", "<Leader>dx", dap.terminate, { desc = "Debugger Terminate" })
|
vim.keymap.set("n", "<Leader>ds", dap.step_over, { desc = "Debugger Step Over" })
|
||||||
vim.keymap.set("n", "<Leader>ds", dap.step_over, { desc = "Debugger Step Over" })
|
|
||||||
|
|
||||||
-- Breakpoints --
|
-- Breakpoints --
|
||||||
vim.api.nvim_set_hl(0, "DapBreakpoint", { ctermbg = 0, fg = "#993939", bg = "#31353f" })
|
vim.api.nvim_set_hl(0, "DapBreakpoint", { ctermbg = 0, fg = "#993939", bg = "#31353f" })
|
||||||
vim.api.nvim_set_hl(0, "DapLogPoint", { ctermbg = 0, fg = "#61afef", bg = "#31353f" })
|
vim.api.nvim_set_hl(0, "DapLogPoint", { ctermbg = 0, fg = "#61afef", bg = "#31353f" })
|
||||||
vim.api.nvim_set_hl(0, "DapStopped", { ctermbg = 0, fg = "#98c379", bg = "#31353f" })
|
vim.api.nvim_set_hl(0, "DapStopped", { ctermbg = 0, fg = "#98c379", bg = "#31353f" })
|
||||||
vim.fn.sign_define(
|
vim.fn.sign_define(
|
||||||
"DapBreakpoint",
|
"DapBreakpoint",
|
||||||
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
|
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
|
||||||
)
|
)
|
||||||
vim.fn.sign_define(
|
vim.fn.sign_define(
|
||||||
"DapBreakpointCondition",
|
"DapBreakpointCondition",
|
||||||
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
|
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
|
||||||
)
|
)
|
||||||
vim.fn.sign_define(
|
vim.fn.sign_define(
|
||||||
"DapBreakpointRejected",
|
"DapBreakpointRejected",
|
||||||
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
|
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
|
||||||
)
|
)
|
||||||
vim.fn.sign_define(
|
vim.fn.sign_define(
|
||||||
"DapLogPoint",
|
"DapLogPoint",
|
||||||
{ text = "", texthl = "DapLogPoint", linehl = "DapLogPoint", numhl = "DapLogPoint" }
|
{ text = "", texthl = "DapLogPoint", linehl = "DapLogPoint", numhl = "DapLogPoint" }
|
||||||
)
|
)
|
||||||
vim.fn.sign_define(
|
vim.fn.sign_define(
|
||||||
"DapStopped",
|
"DapStopped",
|
||||||
{ text = "", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" }
|
{ text = "", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" }
|
||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
},
|
|
||||||
require("plugins.editor.debugger.debugger_go"),
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ return {
|
||||||
null_ls.builtins.diagnostics.twigcs,
|
null_ls.builtins.diagnostics.twigcs,
|
||||||
|
|
||||||
-- JavaScript & Typescript
|
-- JavaScript & Typescript
|
||||||
--null_ls.builtins.formatting.eslint_d,
|
null_ls.builtins.formatting.eslint_d,
|
||||||
|
|
||||||
-- Lua --
|
-- Lua --
|
||||||
null_ls.builtins.formatting.stylua,
|
null_ls.builtins.formatting.stylua,
|
||||||
|
|
|
@ -1,114 +0,0 @@
|
||||||
local Finder = {}
|
|
||||||
|
|
||||||
Finder = {}
|
|
||||||
|
|
||||||
local function is_ignored(entry, ignore_dot_dirs, ignored_dirs)
|
|
||||||
if entry == ".." or entry == "." then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
if ignore_dot_dirs and string.match(entry, "^%.") then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, dir in ipairs(ignored_dirs) do
|
|
||||||
if entry == dir or string.find(entry, dir, 1, true) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
local function read_dir(dir)
|
|
||||||
local handle = io.popen('ls -a "' .. dir .. '"')
|
|
||||||
if not handle then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
local result = handle:read("*a")
|
|
||||||
handle:close()
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
local function is_dir(path)
|
|
||||||
local f = io.open(path, "r")
|
|
||||||
if f == nil then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
local _, _, code = f:read(1)
|
|
||||||
f:close()
|
|
||||||
return code == 21
|
|
||||||
end
|
|
||||||
|
|
||||||
local function find_path_recursive(_dir, options)
|
|
||||||
-- Check max Depth
|
|
||||||
if options.current_depth > options.max_depth then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local entries = read_dir(_dir)
|
|
||||||
if entries == nil then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
for entry in string.gmatch(entries, "[^\r\n]+") do
|
|
||||||
-- Check Ignored
|
|
||||||
if is_ignored(entry, options.ignore_dot_dirs, options.ignored_dirs) then
|
|
||||||
goto continue
|
|
||||||
end
|
|
||||||
|
|
||||||
local full_path = _dir .. "/" .. entry
|
|
||||||
|
|
||||||
-- Check for File
|
|
||||||
if entry == options.needle_file then
|
|
||||||
return full_path
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Check is Dir
|
|
||||||
if not is_dir(full_path) then
|
|
||||||
goto continue
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Recursive Call
|
|
||||||
options.current_depth = options.current_depth + 1
|
|
||||||
local result = find_path_recursive(full_path, options)
|
|
||||||
if result ~= nil then
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Cleanup
|
|
||||||
options.current_depth = options.current_depth - 1
|
|
||||||
::continue::
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_opened_folder()
|
|
||||||
local cwd = vim.fn.getcwd()
|
|
||||||
local file_path = vim.fn.expand('%:p:h')
|
|
||||||
|
|
||||||
if file_path ~= '' then
|
|
||||||
return file_path
|
|
||||||
end
|
|
||||||
return cwd
|
|
||||||
end
|
|
||||||
|
|
||||||
function Finder.find_project_dir(needle_file, max_depth, priority_dirs, ignored_dirs, ignore_dot_dirs)
|
|
||||||
local options = {
|
|
||||||
needle_file = needle_file,
|
|
||||||
max_depth = max_depth,
|
|
||||||
priority_dirs = priority_dirs,
|
|
||||||
ignored_dirs = ignored_dirs,
|
|
||||||
ignore_dot_dirs = ignore_dot_dirs,
|
|
||||||
current_depth = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
local dir = get_opened_folder()
|
|
||||||
local file = find_path_recursive(dir, options)
|
|
||||||
if file == nil then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
return file:match("(.*/)")
|
|
||||||
end
|
|
||||||
|
|
||||||
return Finder
|
|
Loading…
Reference in a new issue