BREAKING Change for statusline_separator & tabufline overriders
moved statusline & tabufline into a new plugin to keep the base config clean and fix issues like (#1307)
This commit is contained in:
parent
fa68c66454
commit
74f2efca9f
14 changed files with 53 additions and 627 deletions
|
@ -20,19 +20,6 @@ M.ui = {
|
|||
theme_toggle = { "onedark", "one_light" },
|
||||
theme = "onedark", -- default theme
|
||||
transparency = false,
|
||||
|
||||
statusline = {
|
||||
separator_style = "default", -- default/round/block/arrow
|
||||
config = "%!v:lua.require('ui.statusline').run()",
|
||||
override = {},
|
||||
},
|
||||
|
||||
-- lazyload it when there are 1+ buffers
|
||||
tabufline = {
|
||||
enabled = true,
|
||||
lazyload = true,
|
||||
override = {},
|
||||
},
|
||||
}
|
||||
|
||||
M.plugins = {
|
||||
|
|
|
@ -44,8 +44,10 @@ autocmd("BufEnter", {
|
|||
command = "set fo-=c fo-=r fo-=o",
|
||||
})
|
||||
|
||||
-- store listed buffers in tab local var
|
||||
vim.t.bufs = vim.api.nvim_list_bufs()
|
||||
|
||||
-- autocmds for tabufline -> store bufnrs on bufadd, bufenter events
|
||||
-- thx to https://github.com/ii14 & stores buffer per tab -> table
|
||||
autocmd({ "BufAdd", "BufEnter" }, {
|
||||
callback = function(args)
|
||||
|
@ -79,12 +81,3 @@ autocmd("BufDelete", {
|
|||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local tabufline_opts = require("core.utils").load_config().ui.tabufline
|
||||
|
||||
if tabufline_opts.enabled and tabufline_opts.lazyload then
|
||||
require("core.lazy_load").tabufline()
|
||||
elseif tabufline_opts.enabled then
|
||||
vim.opt.showtabline = 2
|
||||
vim.opt.tabline = "%!v:lua.require'ui.tabline'.run()"
|
||||
end
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
local M = {}
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
-- This must be used for plugins that need to be loaded just after a file
|
||||
-- ex : treesitter, lspconfig etc
|
||||
M.lazy_load = function(tb)
|
||||
autocmd(tb.events, {
|
||||
pattern = "*",
|
||||
|
@ -107,18 +109,4 @@ M.gitsigns = function()
|
|||
})
|
||||
end
|
||||
|
||||
M.tabufline = function()
|
||||
autocmd({ "BufNewFile", "BufRead", "TabEnter" }, {
|
||||
pattern = "*",
|
||||
group = vim.api.nvim_create_augroup("TabuflineLazyLoad", {}),
|
||||
callback = function()
|
||||
if #vim.fn.getbufinfo { buflisted = 1 } >= 2 then
|
||||
vim.opt.showtabline = 2
|
||||
vim.opt.tabline = "%!v:lua.require'ui.tabline'.run()"
|
||||
vim.api.nvim_del_augroup_by_name "TabuflineLazyLoad"
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -12,7 +12,6 @@ g.did_load_filetypes = 0
|
|||
g.do_filetype_lua = 1
|
||||
|
||||
opt.laststatus = 3 -- global statusline
|
||||
opt.statusline = config.ui.statusline.config
|
||||
opt.showmode = false
|
||||
|
||||
opt.title = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue