mirror of
https://github.com/stevearc/aerial.nvim
synced 2024-09-16 14:34:08 +02:00
Set default fold level when link_tree_to_folds = true
This commit is contained in:
parent
cffb2a4fd6
commit
e641878818
3 changed files with 15 additions and 4 deletions
|
@ -1,2 +1,3 @@
|
|||
column_width = 100
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
|
|
|
@ -100,9 +100,13 @@ local function get_option(opt)
|
|||
if ret == nil then
|
||||
ret = (vim.g.aerial or {})[opt]
|
||||
end
|
||||
-- People are used to using 0 for v:false in vimscript
|
||||
if ret == 0 and (type(default_options[opt]) == "boolean" or addl_bool_opts[opt]) then
|
||||
ret = false
|
||||
-- People are used to using 1/0 for v:true/v:false in vimscript
|
||||
if type(default_options[opt]) == "boolean" or addl_bool_opts[opt] then
|
||||
if ret == 0 then
|
||||
ret = false
|
||||
elseif ret == 1 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if ret == nil then
|
||||
return default_options[opt]
|
||||
|
|
|
@ -68,11 +68,17 @@ M.maybe_set_foldmethod = function(bufnr)
|
|||
for _, winid in ipairs(winids) do
|
||||
local fdm = vim.api.nvim_win_get_option(winid, "foldmethod")
|
||||
local fde = vim.api.nvim_win_get_option(winid, "foldexpr")
|
||||
if manage_folds == true or manage_folds == 1 or (manage_folds == "auto" and fdm == "manual") then
|
||||
if
|
||||
not util.is_managing_folds(winid)
|
||||
and (manage_folds == true or (manage_folds == "auto" and fdm == "manual"))
|
||||
then
|
||||
vim.api.nvim_win_set_var(winid, prev_fdm, fdm)
|
||||
vim.api.nvim_win_set_var(winid, prev_fde, fde)
|
||||
vim.api.nvim_win_set_option(winid, "foldmethod", "expr")
|
||||
vim.api.nvim_win_set_option(winid, "foldexpr", "aerial#foldexpr()")
|
||||
if config.link_tree_to_folds then
|
||||
vim.api.nvim_win_set_option(winid, "foldlevel", 99)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue