From 89322b376a48b4b6d2c89e68f3b692f399a2d439 Mon Sep 17 00:00:00 2001 From: pika Date: Sat, 5 Apr 2025 00:19:19 +0200 Subject: [PATCH] wip --- lua/pika/core/keymaps.lua | 18 ++++++++++++++++-- lua/pika/plugins/custom.lua | 7 +++++++ lua/pika/plugins/ui.lua | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 lua/pika/plugins/custom.lua diff --git a/lua/pika/core/keymaps.lua b/lua/pika/core/keymaps.lua index 57203c8..1ecd19c 100644 --- a/lua/pika/core/keymaps.lua +++ b/lua/pika/core/keymaps.lua @@ -51,9 +51,23 @@ map("n", "q", vim.cmd.q) map("n", "s", vim.cmd.w) map("n", "", vim.cmd.w) --- ─< rename word under cursor >─────────────────────────────────────────────────────────── -map("n", "R", [[:%s/\<\>//gI]]) +-- Visual mode: Indent selected lines +map("v", "", ">gv", { desc = "Indent and keep selection" }) +map("v", "", "sv", "v", { desc = "Split window vertically" }) -- split window vertically map("n", "sh", "s", { desc = "Split window horizontally" }) -- split window horizontally + +-- ──────────────────────────────< rename word under cursor >────────────────────────────── +-- map("n", "R", [[:%s/\<\>//gI]]) +-- ──────────────────────< Enhanced word renaming in current buffer >────────────────────── +-- -- Minimal working version +vim.keymap.set({ "n", "x" }, "R", function() + local text = vim.fn.mode() == "n" and vim.fn.expand("") or vim.fn.trim(vim.fn.getreg('"')) + vim.ui.input({ prompt = "Replace: ", default = text }, function(input) + if input and input ~= text then + vim.cmd(("keeppatterns %%s/%s/%s/g"):format(vim.pesc(text), vim.pesc(input))) + end + end) +end, { desc = "Rename in buffer" }) diff --git a/lua/pika/plugins/custom.lua b/lua/pika/plugins/custom.lua new file mode 100644 index 0000000..2f2d350 --- /dev/null +++ b/lua/pika/plugins/custom.lua @@ -0,0 +1,7 @@ +return { + dir = "~/.config/nvim/lua/pika/plugins/custom/terminals.nvim", + opts = { + visible_lines = 3, + }, + vim.keymap.set("n", "td", ""), +} diff --git a/lua/pika/plugins/ui.lua b/lua/pika/plugins/ui.lua index 797645d..5236ba4 100644 --- a/lua/pika/plugins/ui.lua +++ b/lua/pika/plugins/ui.lua @@ -171,6 +171,7 @@ return { -- char = "│", -- tab_char = "│", }, + scope = { enabled = true }, }, },