command-t icon indicating copy to clipboard operation
command-t copied to clipboard

Weird things happen when I type "css"

Open trotzig opened this issue 9 years ago • 4 comments

This is a strange issue, and it might very well be caused by some other vim plugin. But I thought I'd report it anyway to hear your thoughts.

If I type "css" during the time it takes to build the command-t cache, this error appears:

screen shot 2016-09-15 at 11 02 18

The "css" text isn't even captured in the UI.

If I wait for the cache to build, the problem goes away. I can reproduce this both by clearing the cache then quickly typing as well as typing directly on vim startup.

trotzig avatar Sep 15 '16 09:09 trotzig

Okay, I think the error is coming from the vim-surround plugin. css followed by something means "change surrounding s for ". I guess this is because Command-T creates a read-only buffer to display the results, and that the initial key presses (during cache init) target this buffer. I can reproduce the same error I got above by opening vim in read-only mode (vim -M) and then typing "css" plus one more character.

I wonder if there is a way to work around this?

trotzig avatar Sep 15 '16 09:09 trotzig

I would love to find a workaround for this. I've seen it myself a bunch of times over the years, but never been able to repro reliably. Will have another try, but would love to hear any ideas you might have.

On Thu, Sep 15, 2016 at 2:13 AM Henric Trotzig [email protected] wrote:

Okay, I think the error is coming from the vim-surround plugin. css followed by something means "change surrounding s for ". I guess this is because Command-T creates a read-only buffer to display the results, and that the initial key presses (during cache init) target this buffer. I can reproduce the same error I got above by opening vim in read-only mode (vim -M) and then typing "css" plus one more character.

I wonder if there is a way to work around this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/wincent/command-t/issues/245#issuecomment-247277244, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAbonCBwNFokY8oF7B2nI-lSd0wMnfLks5qqQxAgaJpZM4J9pUr .

wincent avatar Sep 15 '16 13:09 wincent

I fear the "best" solution may come down to special-casing to deal with these lines in vim-surround.

Pseudo-code:

if exists mapping for `cs` to `<Plug>Csurround`
  unmap it
end

# Later on...
if existed mapping
  restore it
end

Ideally we wouldn't have to search for a surround-specific mapping but could do this for all potentially ambiguous mappings (multiple letter characters mapped in normal mode), but that might be fiddly to do generally.

wincent avatar Sep 15 '16 13:09 wincent

This thread has some promising details. Looks like a fair bit of quite fragile hacking around may be needed.

wincent avatar Sep 15 '16 13:09 wincent

Given the big rewrite for v6.0.x, I'm closing all older issues as there is unlikely to be anything significant happening on the 5-x-devel branch from here on[^patches]. Feedback issue for 6.0.x is here:

  • https://github.com/wincent/command-t/issues/393

[^patches]: Patches and PRs would be welcome, but my personal efforts are going to be directed towards main.

wincent avatar Aug 26 '22 21:08 wincent