Set keybindings and confirmation

main
Micke Nordin 4 days ago
parent daf5bb5b9b
commit 2afce0278e

@ -66,11 +66,14 @@ telescope_knot.zones = function(opts)
local record = _filter_records(entry, records)
actions.close(prompt_bufnr)
local buffer = vim.api.nvim_create_buf(false, true)
vim.api.nvim_buf_set_name(buffer, entry.value)
vim.api.nvim_buf_set_lines(buffer, 0, 0, false, record)
local width = vim.api.nvim_win_get_width(0)
local height = vim.api.nvim_win_get_height(0) - 10
local _ = vim.api.nvim_open_win(buffer, true,
{ relative = 'win', bufpos = { 0, 0 }, width = width, height = height, border = 'rounded' })
vim.api.nvim_set_keymap("n", "q", "<cmd>bd<CR>", {})
vim.api.nvim_buf_set_keymap(buffer, "c", "w", "<NOP>", {})
vim.api.nvim_create_autocmd({ "BufWinLeave" }, {
buffer = buffer,
callback = function(_)
@ -101,7 +104,10 @@ telescope_knot.zones = function(opts)
" -r" .. cleanold.rtype ..
" -d" .. cleanold.data ..
table.concat(changed, " ")
log.info(vim.fn.system(command))
local choice = vim.fn.confirm("Update record?", "&Yes\n&No", 2)
if choice == 1 then
log.info(vim.fn.system(command))
end
end
end
end

Loading…
Cancel
Save