editorconfig / editorconfig-vim

EditorConfig plugin for Vim
http://editorconfig.org
Other
3.13k stars 137 forks source link

Pollutes vim's search history #94

Closed rosshadden closed 2 years ago

rosshadden commented 6 years ago

When this plugin is enabled, doing a simple :w<cr> adds two entries to neovim's search history:

/\s\+$
/[\u0009\u0020\u00a0\u1680\u180e\u2000-\u200b\u202f\u205f\u3000\ufeff]\+$

The result is that after saving a file, hitting n for example to view the next occurrence of a pattern will instead search for \s\+$, which is not found. I suspect based on the pattern this is related to trimming trailing whitespace.

I have had this plugin commented out for about a year and forgot why until I tried it again just now :D. Should be an easy fix though, and I regret not bringing it up back then.

k-takata commented 6 years ago

:keeppatterns might be used for fixing this, it was introduced by Vim 7.4.083.

cxw42 commented 4 years ago

@rosshadden Are you still experiencing this issue? Have you experimented with :keeppatterns?

sroccaserra commented 3 years ago

I looked at editorconfig.vim, and it looks like there is only one place where a search is used (in fact a substitution), and the keeppatterns option is now present (along with winsaveview() a few line above):

It should work as expected for the search pattern? Unfortunately not for the substition string, which seems not to be restored by winrestview().

Also, if I understand the doc, keeppatterns should not be needed in a vimscript function: the last used search pattern and the redo command "." will not be changed by functions?

rosshadden commented 2 years ago

No it doesn't do it anymore. I'm not sure whether I should close the issue though because it seems like it may be affecting @sroccaserra now?