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

`E565: ...` when using `getchar()` in expression Operator-pending mapping

Open echasnovski opened this issue 3 years ago • 0 comments

This is basically the #68 but appeared with 'mini.jump' and 'mini.ai' resulting in different error. Scenario is the same as described in this comment: <expr> mapping + getchar() + async function from 'fidget.nvim'. The visible effect for 'mini.jump' is to undo previous action.

The getchar() function in both those plugins is used to get exactly one character from user input. And expression mappings are needed to enable dot-repeat without re-asking for user input. So almost no way to refactor this.

I am not really sure why specifically E565 is thrown, as it seems to deal with "... While completion is active Insert mode..." which not the case here. The error thrown as a result of this nvim_buf_set_lines() call.

Solution here seems to be similar to #69: also allow E565 here. What I would like to suggest, though, is to rename it to safely and just catch all errors (as having them forwarded didn't result into much clarity). Happy to make PR if any of this is a welcome change.

How it works now:

https://user-images.githubusercontent.com/24854248/182851005-1dd2d3a8-c56c-424f-8450-3314c87f4d64.mp4

How it works with proposed change:

https://user-images.githubusercontent.com/24854248/182851549-595b7a69-0b87-4302-bf85-d1d3ed2021a3.mp4

Note: I've got to know this in 'mini.nvim' discussions.

echasnovski avatar Aug 04 '22 12:08 echasnovski