cheatsheet.nvim icon indicating copy to clipboard operation
cheatsheet.nvim copied to clipboard

Alt-Enter doesn't work for commands with placeholders and hotkeys

Open barsv opened this issue 3 years ago • 0 comments

Hi,

I noticed a couple of issues with Alt+Enter.

If I press Alt+Enter for the built-in 'find-and-replace' command :s/{P}/{P}/g then I get:

E5108: Error executing lua ...src/cheatsheet.nvim/lua/cheatsheet/telescope/actions.lua:27: Vim(substitute):E486: Pattern not found: {P}
stack traceback:
        [C]: in function 'nvim_command'
        ...src/cheatsheet.nvim/lua/cheatsheet/telescope/actions.lua:27: in function 'select_current_item'
        ...src/cheatsheet.nvim/lua/cheatsheet/telescope/actions.lua:63: in function 'action'
        ...r1/src/cheatsheet.nvim/lua/cheatsheet/telescope/init.lua:94: in function 'key_func'
        ...e/nvim/plugged/telescope.nvim/lua/telescope/mappings.lua:338: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk
Press ENTER or type command to continue

If I press Alt+Enter for hotkeys like gg to go to the first line then it just doesn't work. I'm not sure if it's a bug or a missing feature.

I looked into the code in actions.lua and I don't get the idea behind it. To me it just looks wrong.

The code is introduced in commit https://github.com/sudormrfbin/cheatsheet.nvim/commit/9716f9aaa94dd1fd6ce59b5aae0e5f25e2a463ef. It's related to issue https://github.com/sudormrfbin/cheatsheet.nvim/issues/11 and PR https://github.com/sudormrfbin/cheatsheet.nvim/pull/12

I fixed the problems and I can create a PR.

The only remaining problem for me is that if I press Enter for a cheat in Telescope then the cheat doesn't get printed at the bottom of the screen. I suspect that it's a regression from telescope. Maybe I will try to look into it later and I will create a separate issue then.

Best regards, Stan

barsv avatar Aug 29 '22 19:08 barsv