From 401d1effd31f5fc1e5e1fe916ed81daa71521934 Mon Sep 17 00:00:00 2001 From: Yuan Chiu Date: Tue, 29 Apr 2025 05:42:28 +0800 Subject: [PATCH] feat nvim: lualine, tabby, noice --- dot_config/nvim/lua/plugins/barbar.lua | 18 +++++ dot_config/nvim/lua/plugins/lualine.lua | 51 +++++++++++++++ dot_config/nvim/lua/plugins/noice.lua | 87 +++++++++++++++++++++++++ dot_config/nvim/lua/plugins/tabby.lua | 61 +++++++++++++++++ 4 files changed, 217 insertions(+) create mode 100644 dot_config/nvim/lua/plugins/barbar.lua create mode 100644 dot_config/nvim/lua/plugins/lualine.lua create mode 100644 dot_config/nvim/lua/plugins/noice.lua create mode 100644 dot_config/nvim/lua/plugins/tabby.lua diff --git a/dot_config/nvim/lua/plugins/barbar.lua b/dot_config/nvim/lua/plugins/barbar.lua new file mode 100644 index 0000000..0a5a20b --- /dev/null +++ b/dot_config/nvim/lua/plugins/barbar.lua @@ -0,0 +1,18 @@ +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 + }, +} diff --git a/dot_config/nvim/lua/plugins/lualine.lua b/dot_config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..baf2805 --- /dev/null +++ b/dot_config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,51 @@ +-- if true then return {} end -- 暫時停用 + +return { + { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('lualine').setup ({ + options = { + icons_enabled = true, + theme = 'onedark', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + always_show_tabline = true, + globalstatus = false, + refresh = { + statusline = 100, + tabline = 100, + winbar = 100, + } + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} + }) + end, + }, +} diff --git a/dot_config/nvim/lua/plugins/noice.lua b/dot_config/nvim/lua/plugins/noice.lua new file mode 100644 index 0000000..0058537 --- /dev/null +++ b/dot_config/nvim/lua/plugins/noice.lua @@ -0,0 +1,87 @@ +-- if true then return {} end -- 暫時停用 + +return { + { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + -- add any options here + }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + "MunifTanjim/nui.nvim", + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + "rcarriga/nvim-notify", + }, + config = function(_, opts) + + require("noice").setup({ + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp + }, + }, + -- you can enable a preset for easier configuration + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + + -- Optional: add any additional configuration here + views = { + cmdline_popup = { + border = { + style = "rounded", -- 邊框樣式,可選 "none", "single", "double", "rounded", "solid", "shadow" + padding = { 1, 1 }, -- 邊框內的填充(上、右、下、左) + }, + win_options = { + winhighlight = "NormalFloat:NormalFloat,FloatBorder:FloatBorder", -- 高亮設定 + }, + }, + popupmenu = { + border = { + -- noice.nvim 支援以下邊框樣式: + -- * `"none"`:無邊框。 + -- * `"single"`:單線邊框。 + -- * `"double"`:雙線邊框。 + -- * `"rounded"`:圓角邊框。 + -- * `"solid"`:實心邊框。 + -- * `"shadow"`:陰影效果。 + style = "rounded", -- 這裡可以設定不同的樣式 + pshadowadding = { 1, 1 }, -- 調整內部填充 + }, + }, + }, + win_options = { + winhighlight = { + Normal = "NormalFloat", + FloatBorder = "FloatBorder", + winblend = 10, -- 增加透明度,模擬陰影效果 + winhighlight = "NormalFloat:NormalFloat,FloatBorder:FloatBorder", + }, + } + }) + end, + }, + + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { "regex" }, -- 確保安裝 regex 支援 + highlight = { + enable = true, -- 啟用高亮 + }, + }) + end, + } +} diff --git a/dot_config/nvim/lua/plugins/tabby.lua b/dot_config/nvim/lua/plugins/tabby.lua new file mode 100644 index 0000000..4c72e8c --- /dev/null +++ b/dot_config/nvim/lua/plugins/tabby.lua @@ -0,0 +1,61 @@ +return { + { + 'nanozuki/tabby.nvim', + -- event = 'VimEnter', -- if you want lazy load, see below + dependencies = 'nvim-tree/nvim-web-devicons', + config = function() + vim.o.showtabline = 2 -- always show tabline + + -- configs... + local theme = { + fill = 'TabLineFill', + -- Also you can do this: fill = { fg='#f2e9de', bg='#907aa9', style='italic' } + head = 'TabLine', + current_tab = 'TabLineSel', + tab = 'TabLine', + win = 'TabLine', + tail = 'TabLine', + } + require('tabby').setup({ + line = function(line) + return { + { + { '  ', hl = theme.head }, + line.sep('', theme.head, theme.fill), + }, + line.tabs().foreach(function(tab) + local hl = tab.is_current() and theme.current_tab or theme.tab + return { + line.sep('', hl, theme.fill), + tab.is_current() and '' or '󰆣', + tab.number(), + tab.name(), + tab.close_btn(''), + line.sep('', hl, theme.fill), + hl = hl, + margin = ' ', + } + end), + line.spacer(), + line.wins_in_tab(line.api.get_current_tab()).foreach(function(win) + return { + line.sep('', theme.win, theme.fill), + win.is_current() and '' or '', + win.buf_name(), + line.sep('', theme.win, theme.fill), + hl = theme.win, + margin = ' ', + } + end), + { + line.sep('', theme.tail, theme.fill), + { '  ', hl = theme.tail }, + }, + hl = theme.fill, + } + end, + -- option = {}, -- setup modules' option, + }) + end, + } +}