From 8138b7c761fba73f66b97cc877d61dff173bcccb Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 28 May 2026 13:26:53 +0800 Subject: [PATCH] Update Cw keymaps --- lua/keymaps.lua | 13 +++++++------ lua/options.lua | 5 ++++- lua/pack.lua | 4 ++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 836d712..62e7765 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -3,12 +3,9 @@ vim.g.mapleader = " " local map = vim.keymap.set map("x", "p", [[_dP]], { desc = "Paste over selection without losing yanked text" }) - map("n", "", ":nohl", { desc = "Clear search highlighting", silent = true }) - map("v", "<", "", ">gv", { desc = "Indent and keep selection" }) - map("n", "J", "mzJ`z", { desc = "Join lines without moving cursor" }) map( @@ -37,6 +34,12 @@ map("n", "", "%y+", { desc = "Copy whole file" }) map("t", "", "", { desc = "Escape termainl" }) map("n", "tt", ":term", { desc = "Open new terminal" }) +-- window navigation +map("n", "", "h", { desc = "Switch to left window" }) +map("n", "", "j", { desc = "Switch to down window" }) +map("n", "", "k", { desc = "Switch to up window" }) +map("n", "", "l", { desc = "Switch to right window" }) + -- tabs map("n", "tc", ":tabclose", { desc = "Close current tab" }) map("n", "tn", ":tabnew", { desc = "New tab" }) @@ -49,14 +52,13 @@ map("n", "yp", function() vim.fn.setreg("+", path) vim.notify("Copied relative path: " .. path, vim.log.levels.INFO) end, { desc = "Yank relative file path" }) - map("n", "yP", function() local path = vim.fn.expand("%:p") vim.fn.setreg("+", path) vim.notify("Copied absolute path: " .. path, vim.log.levels.INFO) end, { desc = "Yank absolute file path" }) --- buffer +-- buffers map("n", "x", function() local buf = vim.api.nvim_get_current_buf() if vim.bo[buf].modified then @@ -75,7 +77,6 @@ map("n", "x", function() end end, { desc = "Close current buffer" }) map("n", "bn", "enew", { desc = "Buffer new" }) - map("n", "bo", function() local current = vim.api.nvim_get_current_buf() local skipped_ft = { "NvimTree", "oil", "aerial" } diff --git a/lua/options.lua b/lua/options.lua index 3e6c579..d3a6edd 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -30,13 +30,16 @@ vim.opt.completeopt = "menuone,noselect,fuzzy,nosort" vim.opt.shortmess:append("c") vim.opt.clipboard:append("unnamedplus") vim.opt.isfname:append("@-@") -vim.opt.guicursor = "" vim.opt.scrolloff = 8 vim.opt.colorcolumn = "0" vim.opt.signcolumn = "yes" vim.opt.termguicolors = true +vim.api.nvim_set_hl(0, "MiniDiffSignAdd", { link = "DiffAdd" }) +vim.api.nvim_set_hl(0, "MiniDiffSignChange", { link = "DiffChange" }) +vim.api.nvim_set_hl(0, "MiniDiffSignDelete", { link = "DiffDelete" }) + vim.api.nvim_create_autocmd("TextYankPost", { desc = "Highlight when yanking (copying) text", callback = function() diff --git a/lua/pack.lua b/lua/pack.lua index ec5cc5c..823f2c6 100644 --- a/lua/pack.lua +++ b/lua/pack.lua @@ -126,6 +126,10 @@ end) lazy.on_event("diff", "BufReadPost", "*", function() require("mini.diff").setup({ source = require("mini.diff").gen_source.git({ index = false }), + view = { + style = "sign", + signs = { add = "│", change = "│", delete = "│" }, + }, mappings = { apply = "gs", textobject = "",