update
This commit is contained in:
parent
06a0839578
commit
d1caa253db
6 changed files with 43 additions and 39 deletions
|
|
@ -1,3 +1,30 @@
|
|||
-- Autocmds are automatically loaded on the VeryLazy event
|
||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||
-- Add any additional autocmds here
|
||||
local augroup = vim.api.nvim_create_augroup
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
augroup("go_fmt", { clear = true })
|
||||
|
||||
autocmd("FileType", {
|
||||
group = "go_fmt",
|
||||
pattern = "go",
|
||||
callback = function()
|
||||
vim.api.nvim_buf_set_keymap(
|
||||
0,
|
||||
"n",
|
||||
"<leader>F",
|
||||
":lua FormatGoCurrentLine()<CR>",
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
end,
|
||||
})
|
||||
|
||||
function FormatGoCurrentLine()
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
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)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
--
|
||||
|
||||
local map = vim.keymap.set
|
||||
|
||||
-- map("n", ";", ":", { desc = "CMD enter command mode" })
|
||||
|
|
@ -52,10 +47,17 @@ map("n", "<leader>P", function()
|
|||
require("powershell").toggle_term()
|
||||
end, { noremap = true })
|
||||
|
||||
-- Obsidian
|
||||
map("", "<leader>of", "<cmd> ObsidianFollowLink <CR>", { desc = "Follow Link" })
|
||||
map("", "<leader>ol", "<cmd> ObsidianLinks <CR>", { desc = "Show All Links" })
|
||||
|
||||
-- CodeCopmanion
|
||||
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>rt", ":VtrSendLinesToRunner<CR>", {
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = "Send selected text to tmux pane",
|
||||
})
|
||||
|
||||
map("", "<leader>rp", ":VtrAttachToPane<CR>", { noremap = true, silent = true, desc = "Attach to tmux pane" })
|
||||
|
|
|
|||
|
|
@ -1,3 +1,2 @@
|
|||
-- Options are automatically loaded before lazy.nvim startup
|
||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||
-- Add any additional options here
|
||||
vim.api.nvim_set_option_value("colorcolumn", "70", {})
|
||||
vim.api.nvim_set_option_value("textwidth", 70, {})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue