diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2022-05-22 10:33:01 +0200 |
|---|---|---|
| committer | Simon Hauser <simon.hauser@helsinki-systems.de> | 2022-06-30 14:01:48 +0200 |
| commit | 4482c2b551a36b4a1d27a59e0d4d53a3fdb7ccbd (patch) | |
| tree | 2d6a3b74bc4de2e41e1271eb55c4df94a990ff89 /lua/telescope/builtin | |
| parent | 440684edad0b56cb746c1f1aaef6a53aa703b2ce (diff) | |
chore: cleanup vim options (#1946)
Diffstat (limited to 'lua/telescope/builtin')
| -rw-r--r-- | lua/telescope/builtin/internal.lua | 50 |
1 files changed, 13 insertions, 37 deletions
diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua index 1f6612a..8fdde84 100644 --- a/lua/telescope/builtin/internal.lua +++ b/lua/telescope/builtin/internal.lua @@ -569,17 +569,20 @@ internal.search_history = function(opts) end internal.vim_options = function(opts) - -- Load vim options. - local vim_opts = loadfile(Path:new({ utils.data_directory(), "options", "options.lua" }):absolute())().options + local res = {} + for _, v in pairs(vim.api.nvim_get_all_options_info()) do + table.insert(res, v) + end + table.sort(res, function(left, right) + return left.name < right.name + end) pickers.new(opts, { prompt_title = "options", finder = finders.new_table { - results = vim_opts, + results = res, entry_maker = opts.entry_maker or make_entry.gen_from_vimoptions(opts), }, - -- TODO: previewer for Vim options - -- previewer = previewers.help.new(opts), sorter = conf.generic_sorter(opts), attach_mappings = function() actions.select_default:replace(function() @@ -591,41 +594,14 @@ internal.vim_options = function(opts) local esc = "" if vim.fn.mode() == "i" then - -- TODO: don't make this local esc = vim.api.nvim_replace_termcodes("<esc>", true, false, true) end - -- TODO: Make this actually work. - - -- actions.close(prompt_bufnr) - -- vim.api.nvim_win_set_var(vim.api.nvim_get_current_win(), "telescope", 1) - -- print(prompt_bufnr) - -- print(vim.fn.bufnr()) - -- vim.cmd([[ autocmd BufEnter <buffer> ++nested ++once startinsert!]]) - -- print(vim.fn.winheight(0)) - - -- local prompt_winnr = vim.fn.getbufinfo(prompt_bufnr)[1].windows[1] - -- print(prompt_winnr) - - -- local float_opts = {} - -- float_opts.relative = "editor" - -- float_opts.anchor = "sw" - -- float_opts.focusable = false - -- float_opts.style = "minimal" - -- float_opts.row = vim.api.nvim_get_option("lines") - 2 -- TODO: inc `cmdheight` and `laststatus` in this calc - -- float_opts.col = 2 - -- float_opts.height = 10 - -- float_opts.width = string.len(selection.last_set_from)+15 - -- local buf = vim.api.nvim_create_buf(false, true) - -- vim.api.nvim_buf_set_lines(buf, 0, 0, false, - -- {"default value: abcdef", "last set from: " .. selection.last_set_from}) - -- local status_win = vim.api.nvim_open_win(buf, false, float_opts) - -- -- vim.api.nvim_win_set_option(status_win, "winblend", 100) - -- vim.api.nvim_win_set_option(status_win, "winhl", "Normal:PmenuSel") - -- -- vim.api.nvim_set_current_win(status_win) - -- vim.cmd[[redraw!]] - -- vim.cmd("autocmd CmdLineLeave : ++once echom 'beep'") - vim.api.nvim_feedkeys(string.format("%s:set %s=%s", esc, selection.name, selection.current_value), "m", true) + vim.api.nvim_feedkeys( + string.format("%s:set %s=%s", esc, selection.value.name, selection.value.value), + "m", + true + ) end) return true |
