refactor neovim: 調整chezmoi apply到nvim的結構

This commit is contained in:
2025-04-30 11:05:04 +08:00
parent 9240f60445
commit d8768c6363
26 changed files with 0 additions and 17 deletions

View File

@@ -0,0 +1,37 @@
-- 這個檔案是用來設定 Neovim 的鍵盤快捷鍵
local map = vim.keymap.set
-- konsole終端限制
-- Esc 會送成 Ctrl+[
-- Ctrl+Enter 鍵會被視為 Ctrl+M (對策: 多增加相同功能的Ctrl+Alt+Enter)
-- <A-S-CR>
-- Ctrl+s 儲存
map("n", "<C-s>", "<cmd>write<CR>", { noremap = true, silent = true, desc = "Save file" })
map("i", "<C-s>", "<Esc><cmd>write<CR>a", { noremap = true, silent = true, desc = "Save file in insert mode" })
-- Tab切換
-- 現在由barbar控制先停用
-- vim.api.nvim_set_keymap('n', '<A-l>', '<cmd>tabnext<CR>', { noremap = true, silent = true })
-- vim.api.nvim_set_keymap('n', '<A-h>', '<cmd>tabprevious<CR>', { noremap = true, silent = true })
-- vim.api.nvim_set_keymap('n', '<A-RIGHT>', '<cmd>tabnext<CR>', { noremap = true, silent = true })
-- vim.api.nvim_set_keymap('n', '<A-LEFT>', '<cmd>tabprevious<CR>', { noremap = true, silent = true })
-- Move to window using the <ctrl> hjkl keys
map("n", "<C-h>", "<C-w>h", { desc = "Go to Left Window", remap = true })
map("n", "<C-j>", "<C-w>j", { desc = "Go to Lower Window", remap = true })
map("n", "<C-k>", "<C-w>k", { desc = "Go to Upper Window", remap = true })
map("n", "<C-l>", "<C-w>l", { desc = "Go to Right Window", remap = true })
map("n", "<C-Left>", "<C-w>h", { desc = "Go to Left Window", remap = true })
map("n", "<C-Down>", "<C-w>j", { desc = "Go to Lower Window", remap = true })
map("n", "<C-Up>", "<C-w>k", { desc = "Go to Upper Window", remap = true })
map("n", "<C-Right>", "<C-w>l", { desc = "Go to Right Window", remap = true })
-- Clear search, diff update and redraw
-- taken from runtime/lua/_editor.lua
-- 原始vim會佔用 <C-l> 快速鍵,導致上述跳窗鍵盤無法靈活此用,故將此按鍵改為 <leader>ur
map(
"n",
"<leader>ur",
"<Cmd>nohlsearch<Bar>diffupdate<Bar>normal! <C-L><CR>",
{ desc = "Redraw / Clear hlsearch / Diff Update" }
)