Improve hiding/showing statusline via config

This commit is contained in:
Akianonymus
2021-08-20 14:52:27 +05:30
committed by siduck76
parent dbf0b56059
commit 1f6dbed26b
4 changed files with 42 additions and 10 deletions

View File

@@ -181,6 +181,28 @@ M.file = function(mode, filepath, content)
return data
end
-- hide statusline
-- tables fetched from load_config function
M.hide_statusline = function(values)
local hidden = require("utils").load_config().ui.statusline.hidden
local shown = require("utils").load_config().ui.statusline.shown
local api = vim.api
local buftype = api.nvim_buf_get_option("%", "ft")
-- shown table from config has the highest priority
if vim.tbl_contains(shown, buftype) then
api.nvim_set_option("laststatus", 2)
return
end
if vim.tbl_contains(hidden, buftype) then
api.nvim_set_option("laststatus", 0)
return
else
api.nvim_set_option("laststatus", 2)
end
end
-- return a table of available themes
M.list_themes = function(return_type)
local themes = {}