From 8ab1376bf9d78b59acf9fda505ef92ac568749a0 Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Tue, 29 Apr 2025 19:08:44 +0800 Subject: [PATCH] =?UTF-8?q?nvim:=20=E9=87=8D=E5=AE=9A=E7=BE=A9=20:q=20?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E7=82=BA=E5=83=85=E9=97=9C=E9=96=89=E7=95=B6?= =?UTF-8?q?=E5=89=8D=20Buffer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exact_lua/exact_plugins/tab/barbar.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dot_config/exact_nvim/exact_lua/exact_plugins/tab/barbar.lua b/dot_config/exact_nvim/exact_lua/exact_plugins/tab/barbar.lua index 77ddf91..4e41af9 100644 --- a/dot_config/exact_nvim/exact_lua/exact_plugins/tab/barbar.lua +++ b/dot_config/exact_nvim/exact_lua/exact_plugins/tab/barbar.lua @@ -22,11 +22,21 @@ return { }, } + -- 重定義 :q 命令為僅關閉當前 Buffer + vim.api.nvim_create_user_command('Q', function() + vim.cmd('BufferClose') -- 使用 barbar.nvim 的 BufferClose 呀命 + end, {}) + + -- 重定義 :wq 命令為保存後僅關閉當前 Buffer + vim.api.nvim_create_user_command('WQ', function() + vim.cmd('write') -- 保存文件 + vim.cmd('BufferClose') -- 使用 barbar.nvim 的 BufferClose 命令 + end, {}) + -- 設定快速鍵 -- vim.api.nvim_set_keymap('t', '', [[]], { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', 'BufferNext', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '', 'BufferPrevious', { noremap = true, silent = true }) - end, }, }