From f2399d44f90bf94f520c89249e65051bdf6faa9b Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Wed, 30 Apr 2025 07:13:46 +0800 Subject: [PATCH] =?UTF-8?q?feat=20nvim:=20=E8=B7=B3=E7=AA=97=E9=8D=B5?= =?UTF-8?q?=E7=9B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exact_lua/exact_config/keymaps_nvim.lua | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dot_config/exact_nvim/exact_lua/exact_config/keymaps_nvim.lua b/dot_config/exact_nvim/exact_lua/exact_config/keymaps_nvim.lua index 2d04f6d..5a7d47e 100644 --- a/dot_config/exact_nvim/exact_lua/exact_config/keymaps_nvim.lua +++ b/dot_config/exact_nvim/exact_lua/exact_config/keymaps_nvim.lua @@ -1,4 +1,5 @@ -- 這個檔案是用來設定 Neovim 的鍵盤快捷鍵 +local map = vim.keymap.set -- Tab切換 -- vim.api.nvim_set_keymap('n', '', 'tabnext', { noremap = true, silent = true }) @@ -6,3 +7,22 @@ -- vim.api.nvim_set_keymap('n', '', 'tabnext', { noremap = true, silent = true }) -- vim.api.nvim_set_keymap('n', '', 'tabprevious', { noremap = true, silent = true }) +-- Move to window using the hjkl keys +map("n", "", "h", { desc = "Go to Left Window", remap = true }) +map("n", "", "j", { desc = "Go to Lower Window", remap = true }) +map("n", "", "k", { desc = "Go to Upper Window", remap = true }) +map("n", "", "l", { desc = "Go to Right Window", remap = true }) +map("n", "", "h", { desc = "Go to Left Window", remap = true }) +map("n", "", "j", { desc = "Go to Lower Window", remap = true }) +map("n", "", "k", { desc = "Go to Upper Window", remap = true }) +map("n", "", "l", { desc = "Go to Right Window", remap = true }) + +-- Clear search, diff update and redraw +-- taken from runtime/lua/_editor.lua +-- 原始vim會佔用 快速鍵,導致上述跳窗鍵盤無法靈活此用,故將此按鍵改為 ur +map( + "n", + "ur", + "nohlsearchdiffupdatenormal! ", + { desc = "Redraw / Clear hlsearch / Diff Update" } +)