Skip to content

Commit

Permalink
feat: Add switch in init for statusline select.
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKJeff16 committed Jun 23, 2024
1 parent 4879141 commit b20bbbd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ local WK = Maps.wk --- `which-key` backend
local maps_t = Types.user.maps ---@see UserSubTypes.maps

local exists = Check.exists.module ---@see User.Check.Existance.module
local is_nil = Check.value.is_nil ---@see User.Check.Value.is_nil
local is_tbl = Check.value.is_tbl ---@see User.Check.Value.is_tbl
local is_str = Check.value.is_str ---@see User.Check.Value.is_str
local is_fun = Check.value.is_fun ---@see User.Check.Value.is_fun
Expand Down Expand Up @@ -290,6 +291,11 @@ local Names = {

Kmap.t('<Esc>', '<C-\\><C-n>')

if is_nil(use_statusline) or not vim.tbl_contains({ 'lualine', 'galaxyline' }, use_statusline) then
---@type 'lualine'|'galaxyline'
_G.use_statusline = 'lualine'
end

--- List of manually-callable plugins.
_G.Pkg = require('lazy_cfg')

Expand Down
21 changes: 21 additions & 0 deletions lua/lazy_cfg/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ local in_console = Check.in_console
local desc = kmap.desc
local map_dict = Maps.map_dict

--- Statusline selector
if is_nil(use_statusline) or not vim.tbl_contains({ 'lualine', 'galaxyline' }, use_statusline) then
_G.use_statusline = 'galaxyline'
end

--- Set installation dir for `Lazy`.
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'

Expand Down Expand Up @@ -687,6 +692,22 @@ M.UI = {
vim.opt.showmode = false
end,
config = source('lazy_cfg.lualine'),
cond = use_statusline == 'lualine',
enabled = not in_console(),
},
{
'glepnir/galaxyline.nvim',
name = 'GalaxyLine',
version = false,
dependencies = { 'web-devicons' },
init = function()
vim.opt.ls = 2
vim.opt.stal = 2
vim.opt.showmode = false
vim.opt.termguicolors = not in_console()
end,
config = source('lazy_cfg.galaxyline'),
cond = use_statusline == 'galaxyline',
enabled = not in_console(),
},
--- Tabline
Expand Down

0 comments on commit b20bbbd

Please sign in to comment.