split lualine and bufferline into two files

This commit is contained in:
leafee98 2024-05-09 11:58:42 +08:00
parent 4420707128
commit d953596443
3 changed files with 79 additions and 80 deletions

View file

@ -1,80 +0,0 @@
local function my_location()
local line = vim.fn.line(".")
local line_cnt = vim.fn.line("$")
local col = vim.fn.virtcol(".")
local col_cnt = vim.fn.virtcol("$") - 1
return string.format("%3d(%d):%d(%d)", line, line_cnt, col, col_cnt)
end
return {
{
"akinsho/bufferline.nvim",
enabled = custom.full_feature,
main = "bufferline",
event = "VeryLazy",
keys = {
{ "]b", "<cmd>BufferLineCycleNext<cr>" },
{ "[b", "<cmd>BufferLineCyclePrev<cr>" },
{ ">b", "<cmd>BufferLineMoveNext<cr>" },
{ "<b", "<cmd>BufferLineMovePrev<cr>" },
},
opts = {
options = {
numbers = "ordinal",
diagnostics = "nvim_lsp",
diagnostics_indicator = function(count, level, diagnostics_dict, context)
local icon = level:match("error") and "" or ""
return " " .. icon .. count
end,
separator_style = "thick",
offsets = {
{
filetype = "neo-tree",
text = "neo-tree",
text_align = "center",
separator = true,
},
},
persist_buffer_sort = false,
}
},
},
{
"nvim-lualine/lualine.nvim",
enabled = custom.full_feature,
dependencies = {
"nvim-tree/nvim-web-devicons",
"dokwork/lualine-ex",
"nvim-lua/plenary.nvim",
},
main = "lualine",
event = "VeryLazy",
opts = {
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "ex.lsp.single", "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding" , "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { my_location },
},
inactive_sections = {
lualine_a = { },
lualine_b = { },
lualine_c = { "filename" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { my_location },
},
options = {
disabled_filetypes = {
statusline = {"NvimTree"},
winbar = {},
},
},
},
init = function(_)
vim.o.mousemoveevent = true
end,
},
}

View file

@ -0,0 +1,32 @@
return {
"akinsho/bufferline.nvim",
enabled = custom.full_feature,
main = "bufferline",
event = "VeryLazy",
keys = {
{ "]b", "<cmd>BufferLineCycleNext<cr>" },
{ "[b", "<cmd>BufferLineCyclePrev<cr>" },
{ ">b", "<cmd>BufferLineMoveNext<cr>" },
{ "<b", "<cmd>BufferLineMovePrev<cr>" },
},
opts = {
options = {
numbers = "ordinal",
diagnostics = "nvim_lsp",
diagnostics_indicator = function(count, level, diagnostics_dict, context)
local icon = level:match("error") and "" or ""
return " " .. icon .. count
end,
separator_style = "thick",
offsets = {
{
filetype = "neo-tree",
text = "neo-tree",
text_align = "center",
separator = true,
},
},
persist_buffer_sort = false,
}
},
}

47
lua/plugins/lualine.lua Normal file
View file

@ -0,0 +1,47 @@
local function my_location()
local line = vim.fn.line(".")
local line_cnt = vim.fn.line("$")
local col = vim.fn.virtcol(".")
local col_cnt = vim.fn.virtcol("$") - 1
return string.format("%3d(%d):%d(%d)", line, line_cnt, col, col_cnt)
end
return {
"nvim-lualine/lualine.nvim",
enabled = custom.full_feature,
dependencies = {
"nvim-tree/nvim-web-devicons",
"dokwork/lualine-ex",
"nvim-lua/plenary.nvim",
},
main = "lualine",
event = "VeryLazy",
opts = {
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "ex.lsp.single", "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding" , "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { my_location },
},
inactive_sections = {
lualine_a = { },
lualine_b = { },
lualine_c = { "filename" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { my_location },
},
options = {
disabled_filetypes = {
statusline = {"NvimTree"},
winbar = {},
},
},
extensions = { "lazy", "neo-tree", "quickfix" }
},
init = function(_)
vim.o.mousemoveevent = true
end,
}