1

Update generated neovim config

This commit is contained in:
2024-09-22 20:41:25 +02:00
parent 1743764e48
commit aa1271c42c
1247 changed files with 26512 additions and 15067 deletions

View File

@ -985,7 +985,7 @@ end
internal.colorscheme = function(opts)
local before_background = vim.o.background
local before_color = vim.api.nvim_exec2("colorscheme", { output = true }).output
local need_restore = true
local need_restore = not not opts.enable_preview
local colors = opts.colors or { before_color }
if not vim.tbl_contains(colors, before_color) then
@ -1049,30 +1049,10 @@ internal.colorscheme = function(opts)
return
end
actions.close(prompt_bufnr)
need_restore = false
actions.close(prompt_bufnr)
vim.cmd.colorscheme(selection.value)
end)
action_set.shift_selection:enhance {
post = function()
local selection = action_state.get_selected_entry()
if selection == nil then
utils.__warn_no_selection "builtin.colorscheme"
return
end
need_restore = true
if opts.enable_preview then
vim.cmd.colorscheme(selection.value)
end
end,
}
actions.close:enhance {
post = function()
if need_restore then
vim.cmd.colorscheme(before_color)
end
end,
}
return true
end,
on_complete = {
@ -1082,8 +1062,9 @@ internal.colorscheme = function(opts)
utils.__warn_no_selection "builtin.colorscheme"
return
end
need_restore = true
vim.cmd.colorscheme(selection.value)
if opts.enable_preview then
vim.cmd.colorscheme(selection.value)
end
end,
},
})
@ -1098,6 +1079,21 @@ internal.colorscheme = function(opts)
vim.cmd.colorscheme(before_color)
end
end
-- rewrite picker.set_selection so that color schemes can be previewed when the current
-- selection is shifted using the keyboard or if an item is clicked with the mouse
local set_selection = picker.set_selection
picker.set_selection = function(self, row)
set_selection(self, row)
local selection = action_state.get_selected_entry()
if selection == nil then
utils.__warn_no_selection "builtin.colorscheme"
return
end
if opts.enable_preview then
vim.cmd.colorscheme(selection.value)
end
end
end
picker:find()

View File

@ -421,13 +421,19 @@ local function get_workspace_symbols_requester(bufnr, opts)
return function(prompt)
local tx, rx = channel.oneshot()
cancel()
_, cancel = vim.lsp.buf_request(bufnr, "workspace/symbol", { query = prompt }, tx)
cancel = vim.lsp.buf_request_all(bufnr, "workspace/symbol", { query = prompt }, tx)
-- Handle 0.5 / 0.5.1 handler situation
local err, res = rx()
assert(not err, err)
local results = rx() ---@type table<integer, {error: lsp.ResponseError?, result: lsp.WorkspaceSymbol?}>
local locations = {} ---@type vim.lsp.util.locations_to_items.ret[]
for _, client_res in pairs(results) do
if client_res.error then
vim.api.nvim_err_writeln("Error when executing workspace/symbol : " .. client_res.error.message)
elseif client_res.result ~= nil then
vim.list_extend(locations, vim.lsp.util.symbols_to_items(client_res.result, bufnr))
end
end
local locations = vim.lsp.util.symbols_to_items(res or {}, bufnr) or {}
if not vim.tbl_isempty(locations) then
locations = utils.filter_symbols(locations, opts, symbols_sorter) or {}
end

View File

@ -380,7 +380,7 @@ previewers.new_buffer_previewer = function(opts)
function opts.setup(self)
local state = {}
if opt_setup then
vim.tbl_deep_extend("force", state, opt_setup(self))
state = vim.tbl_deep_extend("force", state, opt_setup(self))
end
return state
end
@ -802,6 +802,7 @@ previewers.git_branch_log = defaulter(function(opts)
"--no-pager",
"log",
"--graph",
"--max-count=1000", -- prevent fork bombing with large repos
"--pretty=format:%h -%d %s (%cr)",
"--abbrev-commit",
"--date=relative",

View File

@ -37,18 +37,18 @@ local bat_maker = function(filename, lnum, start, finish)
local command = { "bat" }
if lnum then
table.insert(command, { "--highlight-line", lnum })
vim.list_extend(command, { "--highlight-line", lnum })
end
if has_less then
if start then
table.insert(command, { "--pager", string.format("less -RS +%s", start) })
vim.list_extend(command, { "--pager", string.format("less -RS +%s", start) })
else
table.insert(command, { "--pager", "less -RS" })
vim.list_extend(command, { "--pager", "less -RS" })
end
else
if start and finish then
table.insert(command, { "-r", string.format("%s:%s", start, finish) })
vim.list_extend(command, { "-r", string.format("%s:%s", start, finish) })
end
end
@ -102,9 +102,6 @@ local get_maker = function(opts)
return maker
end
-- TODO: We shoudl make sure that all our terminals close all the way.
-- Otherwise it could be bad if they're just sitting around, waiting to be closed.
-- I don't think that's the problem, but it could be?
previewers.new_termopen_previewer = function(opts)
opts = opts or {}
@ -161,7 +158,7 @@ previewers.new_termopen_previewer = function(opts)
function opts.setup(self)
local state = {}
if opt_setup then
vim.tbl_deep_extend("force", state, opt_setup(self))
state = vim.tbl_deep_extend("force", state, opt_setup(self))
end
return state
end
@ -192,7 +189,7 @@ previewers.new_termopen_previewer = function(opts)
local prev_bufnr = get_bufnr_by_bufentry(self, entry)
if prev_bufnr then
self.state.termopen_bufnr = prev_bufnr
set_bufnr(self, prev_bufnr)
utils.win_set_buf_noautocmd(preview_winid, self.state.termopen_bufnr)
self.state.termopen_id = term_ids[self.state.termopen_bufnr]
else