evil icon indicating copy to clipboard operation
evil copied to clipboard

C-w support yank word when search-module is 'evil-search

Open jixiuf opened this issue 7 years ago • 10 comments

jixiuf avatar Feb 12 '19 14:02 jixiuf

Could you describe what behaviour this is trying to achieve? C-w deletes the previous work in the search prompt in vim.

edkolev avatar Feb 13 '19 09:02 edkolev

same to C-w in isearch, search words under point ,and you can press C-w multiple times

jixiuf avatar Feb 14 '19 02:02 jixiuf

Yes, actually C-w should have the opposite behavior. It should delete the previous word in the Ex minibuffer since that is how vim does it. That is more in line with how evil is meant to behave anyways since its main goal is to emulate vi/vim.

But there are variables like evil-want-C-u-scroll which take into account discrepancies between fundamental keys used in both Emacs and Vim but have different meaning. Perhaps this could be another one of those cases and we could have an evil-want-C-w-delete-in-search variable or just piggyback off of evil-want-C-w-delete? I'm thinking the latter makes more sense since if someone is already used to the Emacs way of C-w meaning to kill text, they wouldn't want that behavior to be different in Ex/search. If this is done then it would probably make sense for evil-ex-completion-map to also obey evil-want-C-w-delete.

nnicandro avatar Feb 22 '19 22:02 nnicandro

Now that evil-want-C-w-delete is used to opt into yanking, it would be great if this could get reviewed and merged. This is the only thing stopping me from using evil-search as my main search module.

leungbk avatar Dec 28 '20 05:12 leungbk

I encountered the following issue:

alphaBetCatDog

If evil-ex-search-case is smart and I use evil-search-forward with evil-search and type bet C-w, the search string changes to betCat and fails to match.

With isearch-forward, typing bet C-w changes the search string to betcat. I think this is the preferred behavior when evil-ex-search-case is set to smart.

leungbk avatar Feb 05 '21 18:02 leungbk

evil-ex-search-case

fixed

jixiuf avatar Feb 06 '21 05:02 jixiuf

evil-ex-search-case

fixed

With isearch-forward and smart casing, if an uppercase char is typed into the search string, the C-w invocations preserve case. For example, in a buffer with alphaBetCatDog, typing M-x isearch-forward and Bet C-w changes the search string to BetCat.

Currently, using the patched evil-search module and evil-ex-search-case set to smart, typing Bet C-w changes the search string to Betcat, which fails to match.

leungbk avatar Feb 12 '21 04:02 leungbk

evil-ex-search-case

fixed

With isearch-forward and smart casing, if an uppercase char is typed into the search string, the C-w invocations preserve case. For example, in a buffer with alphaBetCatDog, typing M-x isearch-forward and Bet C-w changes the search string to BetCat.

Currently, using the patched evil-search module and evil-ex-search-case set to smart, typing Bet C-w changes the search string to Betcat, which fails to match.

fixed.

jixiuf avatar Feb 13 '21 15:02 jixiuf

Is this still being experimented with or is there another way to get the desired behavior?

angrybacon avatar Aug 14 '22 07:08 angrybacon

@angrybacon I'll take a look soon and merge if all looks good

tomdl89 avatar Aug 14 '22 08:08 tomdl89

As soon as github actions recovers (https://www.githubstatus.com/) I will merge #1694 and close this.

tomdl89 avatar Oct 05 '22 16:10 tomdl89

Closed by #1694

tomdl89 avatar Oct 05 '22 16:10 tomdl89