File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -571,4 +571,32 @@ function M.is_executable(absolute_path)
571
571
end
572
572
end
573
573
574
+ --- List of all option info/values
575
+ --- @param opts vim.api.keyset.option passed directly to vim.api.nvim_get_option_info2 and vim.api.nvim_get_option_value
576
+ --- @param was_set boolean filter was_set
577
+ --- @return { info : vim.api.keyset.get_option_info , val : any } []
578
+ function M .enumerate_options (opts , was_set )
579
+ local res = {}
580
+
581
+ local infos = vim .tbl_filter (function (info )
582
+ if opts .buf and info .scope ~= " buf" then
583
+ return false
584
+ elseif opts .win and info .scope ~= " win" then
585
+ return false
586
+ else
587
+ return true
588
+ end
589
+ end , vim .api .nvim_get_all_options_info ())
590
+
591
+ for _ , info in vim .spairs (infos ) do
592
+ local _ , info2 = pcall (vim .api .nvim_get_option_info2 , info .name , opts )
593
+ if not was_set or info2 .was_set then
594
+ local val = pcall (vim .api .nvim_get_option_value , info .name , opts )
595
+ table.insert (res , { info = info2 , val = val })
596
+ end
597
+ end
598
+
599
+ return res
600
+ end
601
+
574
602
return M
You can’t perform that action at this time.
0 commit comments