Skip to content

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

@barsv

Description

@barsv

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 9716f9a. It's related to issue #11 and PR #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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions