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
|
local augroup = vim.api.nvim_create_augroup
|
||||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
local autocmd = vim.api.nvim_create_autocmd
|
||||||
-- Add any additional autocmds here
|
|
||||||
|
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
|
local map = vim.keymap.set
|
||||||
|
|
||||||
-- map("n", ";", ":", { desc = "CMD enter command mode" })
|
-- map("n", ";", ":", { desc = "CMD enter command mode" })
|
||||||
|
|
@ -52,10 +47,17 @@ map("n", "<leader>P", function()
|
||||||
require("powershell").toggle_term()
|
require("powershell").toggle_term()
|
||||||
end, { noremap = true })
|
end, { noremap = true })
|
||||||
|
|
||||||
-- Obsidian
|
|
||||||
map("", "<leader>of", "<cmd> ObsidianFollowLink <CR>", { desc = "Follow Link" })
|
|
||||||
map("", "<leader>ol", "<cmd> ObsidianLinks <CR>", { desc = "Show All Links" })
|
|
||||||
|
|
||||||
-- CodeCopmanion
|
-- CodeCopmanion
|
||||||
map("", "<leader>Ca", "<cmd>CodeCompanionActions <CR>", { desc = "CodeCompanion Actions" })
|
map("", "<leader>Ca", "<cmd>CodeCompanionActions <CR>", { desc = "CodeCompanion Actions" })
|
||||||
map("", "<leader>Cc", "<cmd>CodeCompanionChat <CR>", { desc = "CodeCompanion Chat" })
|
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
|
vim.api.nvim_set_option_value("colorcolumn", "70", {})
|
||||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
vim.api.nvim_set_option_value("textwidth", 70, {})
|
||||||
-- Add any additional options here
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
return {
|
|
||||||
-- -- the opts function can also be used to change the default opts:
|
|
||||||
-- {
|
|
||||||
-- "nvim-lualine/lualine.nvim",
|
|
||||||
-- event = "VeryLazy",
|
|
||||||
-- opts = function(_, opts)
|
|
||||||
-- table.insert(opts.sections.lualine_x, "😄")
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- -- or you can return new options to override all the defaults
|
|
||||||
-- {
|
|
||||||
-- "nvim-lualine/lualine.nvim",
|
|
||||||
-- event = "VeryLazy",
|
|
||||||
-- opts = function()
|
|
||||||
-- return {
|
|
||||||
-- --[[add your custom lualine config here]]
|
|
||||||
-- }
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
--
|
|
||||||
-- -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
|
|
||||||
-- { import = "lazyvim.plugins.extras.lang.json" },
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue