🪴 my neovim config:)
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

plugin: clean up input callback

robin 70ee235c ed17e070

+8 -9
+8 -9
config/plugin/input.lua
··· 13 13 vim.validate("on_confirm", on_confirm, "function") 14 14 15 15 local buf = vim.api.nvim_create_buf(false, true) 16 - ---@type fun(v: string?) 17 - local f = function(v) 18 - vim.api.nvim_buf_delete(buf, { force = true }) 19 - vim.cmd.stopinsert() 20 - on_confirm(v) 21 - end 22 16 23 17 vim.bo[buf].buftype = "prompt" 24 18 vim.bo[buf].bufhidden = "wipe" ··· 35 29 end 36 30 37 31 vim.fn.prompt_setprompt(buf, promptstr or "") 38 - vim.fn.prompt_setcallback(buf, f) 39 - vim.fn.prompt_setinterrupt(buf, f) 40 - 41 32 promptlines = promptlines or {} 42 33 if opts.default then 43 34 table.insert(promptlines, (promptstr or "") .. opts.default) ··· 52 43 col = offset, 53 44 style = "minimal", 54 45 }) 46 + 47 + vim.fn.prompt_setcallback(buf, function(text) 48 + if vim.api.nvim_win_is_valid(win) then 49 + vim.api.nvim_win_close(win, true) 50 + end 51 + on_confirm(#text > 0 and text or nil) 52 + end) 53 + 55 54 vim.api.nvim_set_option_value("wrap", true, { win = win, scope = "local" }) 56 55 vim.api.nvim_set_option_value("signcolumn", "no", { win = win, scope = "local" }) 57 56 vim.api.nvim_set_option_value("sidescrolloff", 0, { win = win, scope = "local" })