feat nvim: 在nvim內的Terminal用 nvim Readme.md 開啟檔案,會在當前nvim以新Buffer開啟

This commit is contained in:
Yuan Chiu 2025-05-31 17:54:51 +08:00
parent 9b1920eaf1
commit 89a83ecf06
Signed by: yuan
GPG Key ID: 50FBE4156404B98D

View File

@ -15,7 +15,9 @@ return {
end end
require("toggleterm").setup { require("toggleterm").setup {
open_mapping = [[<C-\>]], open_mapping = [[<C-\>]], -- 設定開關快速鍵
-- on_open時以Neotree當Offset
on_open = function(_) on_open = function(_)
if is_neo_tree_open() then if is_neo_tree_open() then
vim.defer_fn(function() vim.defer_fn(function()
@ -26,6 +28,7 @@ return {
end, 100) end, 100)
end end
end, end,
hide_numbers = true, hide_numbers = true,
shade_filetypes = {}, shade_filetypes = {},
shade_terminals = true, shade_terminals = true,
@ -48,4 +51,21 @@ return {
vim.api.nvim_set_keymap('t', '<A-Esc>', [[<C-\><C-n>]], { noremap = true, silent = true }) vim.api.nvim_set_keymap('t', '<A-Esc>', [[<C-\><C-n>]], { noremap = true, silent = true })
end, end,
}, },
-- 在nvim內的Terminal用 `nvim Readme.md` 開啟檔案會在當前nvim以新Buffer開啟
{
"willothy/flatten.nvim",
-- config = true,
-- or pass configuration with
opts = {
window = {
open = "alternate",
diff = "tab_vsplit",
focus = "first",
},
},
-- Ensure that it runs first to minimize delay when opening file from terminal
lazy = false,
priority = 1001,
},
} }