-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbars.lua
More file actions
42 lines (34 loc) · 974 Bytes
/
Copy pathbars.lua
File metadata and controls
42 lines (34 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--[[
# 🍫 bars.nvim
A *fancy* `bars & lines` plugin for `Neovim`.
[Github](https://github.com/OXY2DEV/bars.nvim)
[Usage](https://github.com/OXY2DEV/bars.nvim/wiki)
]]
local bars = {};
--[[ Executes an `action`. ]]
---@param action bars.command
---@param on bars.target[]
---@param ... any
bars.exec = function (action, on, ...)
local modules = { "statusline", "statuscolumn", "winbar", "tabline" };
on = on or modules;
for _, mod_name in ipairs(modules) do
if vim.list_contains(on, mod_name) then
local could_load, module = pcall(require, "bars." .. mod_name);
if could_load and module then
pcall(module[action], module, ...)
end
end
end
end
---@param config? bars.config
bars.setup = function (config)
---@diagnostic disable-next-line: param-type-mismatch
for k, v in pairs(config) do
local could_load, submodule = pcall(require, "bars." .. k);
if could_load and submodule then
pcall(submodule.setup, v);
end
end
end
return bars;