nvim: 大整理tab buffer架構與功能
This commit is contained in:
parent
c232b7b043
commit
41fd5b1f71
@ -1,5 +1,5 @@
|
||||
-- 這個檔案是用來設定 Neovim 的鍵盤快捷鍵
|
||||
|
||||
-- Tab切換
|
||||
vim.api.nvim_set_keymap('n', '<C-]>', '<cmd>tabnext<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<C-[>', '<cmd>tabprevious<CR>', { noremap = true, silent = true })
|
||||
-- vim.api.nvim_set_keymap('n', '<C-]>', '<cmd>tabnext<CR>', { noremap = true, silent = true })
|
||||
-- vim.api.nvim_set_keymap('n', '<C-[>', '<cmd>tabprevious<CR>', { noremap = true, silent = true })
|
||||
|
@ -40,6 +40,7 @@ require("lazy").setup({
|
||||
-- },
|
||||
-- 自動載入 plugins 資料夾中的所有插件
|
||||
{ import = "plugins" },
|
||||
{ import = "plugins.tab" },
|
||||
|
||||
-- 手動引入 o-plugins 資料夾中的插件
|
||||
-- require("o-plugins.nvim-listchars"),
|
||||
|
@ -1,18 +0,0 @@
|
||||
if true then return {} end -- 因為會與tabby衝突,先停用
|
||||
|
||||
return {
|
||||
{'romgrk/barbar.nvim',
|
||||
dependencies = {
|
||||
'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
|
||||
'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
|
||||
},
|
||||
init = function() vim.g.barbar_auto_setup = false end,
|
||||
opts = {
|
||||
-- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default:
|
||||
-- animation = true,
|
||||
-- insert_at_start = true,
|
||||
-- …etc.
|
||||
},
|
||||
version = '^1.0.0', -- optional: only update when a new 1.x version is released
|
||||
},
|
||||
}
|
@ -45,7 +45,7 @@ return {
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {}
|
||||
extensions = {'neo-tree', 'toggleterm'}
|
||||
}
|
||||
end,
|
||||
-- config = function(_, opts)
|
||||
|
32
dot_config/exact_nvim/exact_lua/exact_plugins/tab/barbar.lua
Normal file
32
dot_config/exact_nvim/exact_lua/exact_plugins/tab/barbar.lua
Normal file
@ -0,0 +1,32 @@
|
||||
-- if true then return {} end -- 停用
|
||||
|
||||
return {
|
||||
{'romgrk/barbar.nvim',
|
||||
version = '^1.0.0', -- optional: only update when a new 1.x version is released
|
||||
dependencies = {
|
||||
'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
|
||||
'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
|
||||
},
|
||||
init = function() vim.g.barbar_auto_setup = false end,
|
||||
-- opts = {
|
||||
-- -- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default:
|
||||
-- -- animation = false,
|
||||
-- -- insert_at_start = true,
|
||||
-- -- …etc.
|
||||
-- },
|
||||
config = function(_, opts)
|
||||
require'bufferline'.setup {
|
||||
-- animation = false, -- 禁用動畫效果
|
||||
sidebar_filetypes = {
|
||||
['neo-tree'] = {event = 'BufWipeout'},
|
||||
},
|
||||
}
|
||||
|
||||
-- 設定快速鍵
|
||||
-- vim.api.nvim_set_keymap('t', '<A-Esc>', [[<C-\><C-n>]], { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<C-]>', '<cmd>BufferNext<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<C-[>', '<cmd>BufferPrevious<CR>', { noremap = true, silent = true })
|
||||
|
||||
end,
|
||||
},
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
if true then return {} end -- 停用
|
||||
|
||||
-- 查看說明:
|
||||
-- nvim +"help bufferline" +only
|
||||
|
||||
return {
|
||||
{
|
||||
'akinsho/bufferline.nvim',
|
||||
version = "*",
|
||||
dependencies = 'nvim-tree/nvim-web-devicons',
|
||||
config = function()
|
||||
vim.opt.termguicolors = true
|
||||
require("bufferline").setup{
|
||||
options = {
|
||||
mode = "buffers",
|
||||
custom_filter = function(buf_number)
|
||||
local buf_ft = vim.bo[buf_number].filetype
|
||||
if buf_ft == "toggleterm" then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
click_callback = function(buf_number)
|
||||
local buf_ft = vim.bo[buf_number].filetype
|
||||
if buf_ft == "toggleterm" then
|
||||
-- 如果是 toggleterm 的 Buffer,阻止切換
|
||||
print("Cannot switch to terminal buffer!")
|
||||
return
|
||||
end
|
||||
-- 否則切換到目標 Buffer
|
||||
vim.api.nvim_set_current_buf(buf_number)
|
||||
end,
|
||||
-- custom_filter = function(buf_number)
|
||||
-- -- 過濾掉 toggleterm 的終端 Buffer
|
||||
-- local buf_name = vim.fn.bufname(buf_number)
|
||||
-- if buf_name:match("term://") then
|
||||
-- return false
|
||||
-- end
|
||||
-- return true
|
||||
-- end,
|
||||
-- offsets = {
|
||||
-- {
|
||||
-- filetype = "neo-tree",
|
||||
-- text = function()
|
||||
-- return vim.fn.getcwd()
|
||||
-- end,
|
||||
-- highlight = "Directory",
|
||||
-- text_align = "left"
|
||||
-- }
|
||||
-- }
|
||||
}
|
||||
}
|
||||
end,
|
||||
}
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
if true then return {} end -- 因為barbar會與tabby衝突,停用
|
||||
|
||||
return {
|
||||
{
|
||||
'nanozuki/tabby.nvim',
|
@ -35,6 +35,7 @@ return {
|
||||
direction = 'horizontal',
|
||||
close_on_exit = true,
|
||||
shell = vim.o.shell,
|
||||
|
||||
}
|
||||
|
||||
-- 添加第二個快捷鍵映射
|
||||
|
Loading…
x
Reference in New Issue
Block a user