refactor!: remove insert_only config option
If you wish to restore this behavior, you can easily set a custom keymap like so: ```lua require("dressing").setup({ input = { mappings = { i = { ["<Esc>"] = "Close", }, }, }, }) ``` fixes #163
This commit is contained in:
parent
71349f24c6
commit
cd895f511f
|
@ -141,9 +141,6 @@ require("dressing").setup({
|
|||
-- Can be 'left', 'right', or 'center'
|
||||
title_pos = "left",
|
||||
|
||||
-- When true, <Esc> will close the modal
|
||||
insert_only = true,
|
||||
|
||||
-- When true, input will start in insert mode.
|
||||
start_in_insert = true,
|
||||
|
||||
|
|
|
@ -19,9 +19,6 @@ Configure dressing.nvim by calling the setup() function.
|
|||
-- Can be 'left', 'right', or 'center'
|
||||
title_pos = "left",
|
||||
|
||||
-- When true, <Esc> will close the modal
|
||||
insert_only = true,
|
||||
|
||||
-- When true, input will start in insert mode.
|
||||
start_in_insert = true,
|
||||
|
||||
|
|
|
@ -12,9 +12,6 @@ local default_config = {
|
|||
-- Can be 'left', 'right', or 'center'
|
||||
title_pos = "left",
|
||||
|
||||
-- When true, <Esc> will close the modal
|
||||
insert_only = true,
|
||||
|
||||
-- When true, input will start in insert mode.
|
||||
start_in_insert = true,
|
||||
|
||||
|
|
|
@ -441,10 +441,6 @@ local show_input = util.make_queued_async_fn(2, function(opts, on_confirm)
|
|||
map_util.create_maps_to_plug(bufnr, mode, user_maps, "DressingInput:")
|
||||
end
|
||||
|
||||
if config.insert_only then
|
||||
vim.keymap.set("i", "<Esc>", M.close, { buffer = bufnr })
|
||||
end
|
||||
|
||||
vim.bo[bufnr].filetype = "DressingInput"
|
||||
local default = string.gsub(opts.default or "", "\n", " ")
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, true, { default })
|
||||
|
|
|
@ -59,25 +59,6 @@ a.describe("input modal", function()
|
|||
assert(ret == nil, string.format("Got '%s' expected nil", ret))
|
||||
end)
|
||||
|
||||
a.it("cancels on <Esc> when insert_only = true", function()
|
||||
require("dressing.config").input.insert_only = true
|
||||
local ret = run_input({
|
||||
"my text",
|
||||
"<Esc>",
|
||||
})
|
||||
assert(ret == nil, string.format("Got '%s' expected nil", ret))
|
||||
end)
|
||||
|
||||
a.it("does not cancel on <Esc> when insert_only = false", function()
|
||||
require("dressing.config").input.insert_only = false
|
||||
local ret = run_input({
|
||||
"my text",
|
||||
"<Esc>",
|
||||
"<CR>",
|
||||
})
|
||||
assert(ret == "my text", string.format("Got '%s' expected 'my text'", ret))
|
||||
end)
|
||||
|
||||
a.it("returns cancelreturn when input is canceled <C-c>", function()
|
||||
local ret = run_input({
|
||||
"my text",
|
||||
|
|
Loading…
Reference in New Issue