This commit is contained in:
DeveloperDurp 2025-03-12 05:09:03 -05:00
parent d1caa253db
commit b8568952b4
5 changed files with 144 additions and 28 deletions

View file

@ -19,12 +19,19 @@ autocmd("FileType", {
function FormatGoCurrentLine()
local line = vim.api.nvim_get_current_line()
local formatted_line = line:gsub("%(", "(\n"):gsub(",%s*", ",\n"):gsub("%)", ",\n)")
local formatted_line =
line:gsub("%(", "(\n"):gsub(",%s*", ",\n"):gsub("%)", ",\n)")
formatted_line = formatted_line:gsub(",\n%)", "\n)")
local lines = vim.split(formatted_line, "\n")
-- Ensure the last parameter has a comma
if #lines > 2 and not lines[#lines - 1]:match(",$") then
lines[#lines - 1] = lines[#lines - 1] .. ","
end
vim.api.nvim_buf_set_lines(0, vim.fn.line(".") - 1, vim.fn.line("."), false, lines)
vim.api.nvim_buf_set_lines(
0,
vim.fn.line(".") - 1,
vim.fn.line("."),
false,
lines
)
end

View file

@ -4,28 +4,103 @@ local map = vim.keymap.set
-- map("i", "jk", "<ESC>")
-- Tmux
map("", "<C-h>", "<cmd> TmuxNavigateLeft<CR>", { desc = "window left" })
map("", "<C-l>", "<cmd> TmuxNavigateRight<CR>", { desc = "window right" })
map("", "<C-j>", "<cmd> TmuxNavigateDown<CR>", { desc = "window down" })
map(
"",
"<C-h>",
"<cmd> TmuxNavigateLeft<CR>",
{ desc = "window left" }
)
map(
"",
"<C-l>",
"<cmd> TmuxNavigateRight<CR>",
{ desc = "window right" }
)
map(
"",
"<C-j>",
"<cmd> TmuxNavigateDown<CR>",
{ desc = "window down" }
)
map("", "<C-k>", "<cmd> TmuxNavigateUp<CR>", { desc = "window up" })
-- Resize
map("", "<A-h>", "<cmd> vertical resize -5<CR>", { desc = "Resize Left" })
map("", "<A-l>", "<cmd> vertical resize +5<CR>", { desc = "Resize Right" })
map("", "<A-j>", "<cmd> horizontal resize -5<CR>", { desc = "Resize Down" })
map("", "<A-k>", "<cmd> horizontal resize +5<CR>", { desc = "Resize Up" })
map(
"",
"<A-h>",
"<cmd> vertical resize -5<CR>",
{ desc = "Resize Left" }
)
map(
"",
"<A-l>",
"<cmd> vertical resize +5<CR>",
{ desc = "Resize Right" }
)
map(
"",
"<A-j>",
"<cmd> horizontal resize -5<CR>",
{ desc = "Resize Down" }
)
map(
"",
"<A-k>",
"<cmd> horizontal resize +5<CR>",
{ desc = "Resize Up" }
)
-- Go
map("", "<leader>gsj", "<cmd> GoTagAdd json <CR>", { desc = "Add json struct tags" })
map("", "<leader>gsy", "<cmd> GoTagAdd yaml <CR>", { desc = "Add yaml struct tags" })
map("", "<leader>gse", "<cmd> GoTagAdd env <CR>", { desc = "Add env struct tags" })
map(
"",
"<leader>gsj",
"<cmd> GoTagAdd json <CR>",
{ desc = "Add json struct tags" }
)
map(
"",
"<leader>gsy",
"<cmd> GoTagAdd yaml <CR>",
{ desc = "Add yaml struct tags" }
)
map(
"",
"<leader>gse",
"<cmd> GoTagAdd env <CR>",
{ desc = "Add env struct tags" }
)
-- Dap
map("", "<leader>db", "<cmd> DapToggleBreakpoint <CR>", { desc = "Add breakpoint at line" })
map("", "<leader>dc", "<cmd> DapContinue <CR>", { desc = "Start Debugging" })
map("", "<leader>dt", "<cmd> DapTerminate <CR>", { desc = "Stop Debugging" })
map("", "<leader>dso", "<cmd> DapStepOver <CR>", { desc = "Step Over" })
map("", "<leader>dsi", "<cmd> DapStepInto <CR>", { desc = "Step Into" })
map(
"",
"<leader>db",
"<cmd> DapToggleBreakpoint <CR>",
{ desc = "Add breakpoint at line" }
)
map(
"",
"<leader>dc",
"<cmd> DapContinue <CR>",
{ desc = "Start Debugging" }
)
map(
"",
"<leader>dt",
"<cmd> DapTerminate <CR>",
{ desc = "Stop Debugging" }
)
map(
"",
"<leader>dso",
"<cmd> DapStepOver <CR>",
{ desc = "Step Over" }
)
map(
"",
"<leader>dsi",
"<cmd> DapStepInto <CR>",
{ desc = "Step Into" }
)
map("", "<leader>dst", "<cmd> DapStepOut <CR>", { desc = "Step Out" })
map("", "<leader>dus", function()
local widgets = require("dap.ui.widgets")
@ -48,11 +123,26 @@ map("n", "<leader>P", function()
end, { noremap = true })
-- CodeCopmanion
map("", "<leader>Ca", "<cmd>CodeCompanionActions <CR>", { desc = "CodeCompanion Actions" })
map("", "<leader>Cc", "<cmd>CodeCompanionChat <CR>", { desc = "CodeCompanion Chat" })
map(
"",
"<leader>Ca",
"<cmd>CodeCompanionActions <CR>",
{ desc = "CodeCompanion Actions" }
)
map(
"",
"<leader>Cc",
"<cmd>CodeCompanionChat <CR>",
{ desc = "CodeCompanion Chat" }
)
-- Custom
map("", "<leader>rw", '"hy:%s/<C-r>h//g<left><left>', { noremap = true, silent = true, desc = "Replace Word" })
map(
"",
"<leader>rw",
'"hy:%s/<C-r>h//g<left><left>',
{ noremap = true, silent = true, desc = "Replace Word" }
)
map("", "<leader>rt", ":VtrSendLinesToRunner<CR>", {
noremap = true,
@ -60,4 +150,9 @@ map("", "<leader>rt", ":VtrSendLinesToRunner<CR>", {
desc = "Send selected text to tmux pane",
})
map("", "<leader>rp", ":VtrAttachToPane<CR>", { noremap = true, silent = true, desc = "Attach to tmux pane" })
map(
"",
"<leader>rp",
":VtrAttachToPane<CR>",
{ noremap = true, silent = true, desc = "Attach to tmux pane" }
)

View file

@ -1,3 +1,3 @@
indent_type = "Spaces"
indent_width = 2
column_width = 120
column_width = 70