csv.vim icon indicating copy to clipboard operation
csv.vim copied to clipboard

Improve field text object performance

Open h3xx opened this issue 3 years ago • 4 comments
trafficstars

Use :v's _ flag to not clobber @/ instead of backing it up and restoring it.

This feature has been supported in Vim since 2004:

doc/repeat.txt: (:v :vglobal)

Example: :g/^Obsolete/d _   Using the underscore after :d avoids clobbering registers or the clipboard. This also makes it faster.

h3xx avatar Jul 07 '22 18:07 h3xx

Re: 2004: I think - I may be reading it wrong. The commit that mentions it in the docs was added on 2021-05-16, but maybe it was a hidden feature.

h3xx avatar Jul 07 '22 18:07 h3xx

I did some testing in Vim 8.1 (2018), this doesn't give an error, but it also doesn't preserve @/.

h3xx avatar Jul 07 '22 19:07 h3xx

Just kidding, the Vim builtin feature doesn't even preserve @/ yet. Every v:version = 900 build I've tried it in, :v/foo/d _ sets @/ to foo. The doc is just wrong. Maybe next year.

h3xx avatar Jul 07 '22 19:07 h3xx

try using :keeppatterns command modifier

chrisbra avatar Jul 08 '22 06:07 chrisbra

Decided this wasn't worth the effort; the software is fine as it is.

h3xx avatar Oct 31 '22 18:10 h3xx