From cd895f511fc8bd841324c73feb2b9c791b946691 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Tue, 18 Jun 2024 20:49:57 -0400 Subject: [PATCH] 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 = { [""] = "Close", }, }, }, }) ``` fixes #163 --- README.md | 3 --- doc/dressing.txt | 3 --- lua/dressing/config.lua | 3 --- lua/dressing/input.lua | 4 ---- tests/input_spec.lua | 19 ------------------- 5 files changed, 32 deletions(-) diff --git a/README.md b/README.md index 4475f60..6e63cff 100644 --- a/README.md +++ b/README.md @@ -141,9 +141,6 @@ require("dressing").setup({ -- Can be 'left', 'right', or 'center' title_pos = "left", - -- When true, will close the modal - insert_only = true, - -- When true, input will start in insert mode. start_in_insert = true, diff --git a/doc/dressing.txt b/doc/dressing.txt index 7e0611c..0e3ec83 100644 --- a/doc/dressing.txt +++ b/doc/dressing.txt @@ -19,9 +19,6 @@ Configure dressing.nvim by calling the setup() function. -- Can be 'left', 'right', or 'center' title_pos = "left", - -- When true, will close the modal - insert_only = true, - -- When true, input will start in insert mode. start_in_insert = true, diff --git a/lua/dressing/config.lua b/lua/dressing/config.lua index d4afe69..7ea00ff 100644 --- a/lua/dressing/config.lua +++ b/lua/dressing/config.lua @@ -12,9 +12,6 @@ local default_config = { -- Can be 'left', 'right', or 'center' title_pos = "left", - -- When true, will close the modal - insert_only = true, - -- When true, input will start in insert mode. start_in_insert = true, diff --git a/lua/dressing/input.lua b/lua/dressing/input.lua index 04e5d4a..6d7d9f5 100644 --- a/lua/dressing/input.lua +++ b/lua/dressing/input.lua @@ -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", "", 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 }) diff --git a/tests/input_spec.lua b/tests/input_spec.lua index b38d679..f65e902 100644 --- a/tests/input_spec.lua +++ b/tests/input_spec.lua @@ -59,25 +59,6 @@ a.describe("input modal", function() assert(ret == nil, string.format("Got '%s' expected nil", ret)) end) - a.it("cancels on when insert_only = true", function() - require("dressing.config").input.insert_only = true - local ret = run_input({ - "my text", - "", - }) - assert(ret == nil, string.format("Got '%s' expected nil", ret)) - end) - - a.it("does not cancel on when insert_only = false", function() - require("dressing.config").input.insert_only = false - local ret = run_input({ - "my text", - "", - "", - }) - assert(ret == "my text", string.format("Got '%s' expected 'my text'", ret)) - end) - a.it("returns cancelreturn when input is canceled ", function() local ret = run_input({ "my text",