smart-open.nvim icon indicating copy to clipboard operation
smart-open.nvim copied to clipboard

Ctrl+W to delete word in Telescope picker works in 0.1.x but not 0.2.x

Open ebkalderon opened this issue 1 year ago • 3 comments

For some reason, version 0.2.x of smart-open.nvim doesn't allow the use of Ctrl+W (in INSERT mode) within the Telescope picker search box. This is a regression from 0.1.x, which allowed all standard INSERT mode text editing hotkeys to be used to edit the search string. For context, all builtin Telescope pickers and all other third-party Telescope extensions I've ever tried allow for the use of Ctrl+W just fine, among other shortcuts.

It'd be great if support for standard INSERT mode text editing shortcuts could be restored in the 0.2.x branch! In the meantime, I'll probably be sticking with branch = "0.1.x" of smart-open.nvim until this is resolved.

ebkalderon avatar Jun 15 '24 00:06 ebkalderon

Yeah I think this was an oversight in choosing a default keybind, but what was worse is you couldn't provide overriding mappings. I've fixed that in main and 0.2.x.

After updating, the following should work as an override:

  mappings = {
    i = {
      ["<C-w>"] = function ()
        vim.api.nvim_input "<c-s-w>"
      end,
    },
  },

In 0.3.x, I will look at changing the default.

danielfalk avatar Oct 15 '24 18:10 danielfalk

Hmm I'm on main and tried the above but I'm getting an error:

E5108: Error executing lua: ...are/nvim/lazy/smart-open.nvim/lua/smart-open/actions.lua:17: attempt to index local 'selection' (a nil value)
stack traceback:
	...are/nvim/lazy/smart-open.nvim/lua/smart-open/actions.lua:17: in function 'key_func'
	...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:253: in function <...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:252>

dlvhdr avatar Oct 20 '24 19:10 dlvhdr

@dlvhdr - where are you adding the mappings config referenced above?

In my case I had to add it under telescope's opts, specifically: opts.extensions.smart_open. Here's an example from my dotfiles.

alexpls avatar Jan 09 '25 06:01 alexpls