chrisbra / csv.vim

A Filetype plugin for csv files
http://www.vim.org/scripts/script.php?script_id=2830
Vim License
1.28k stars 62 forks source link

Improve field text object performance #208

Closed h3xx closed 2 years ago

h3xx commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

h3xx commented 2 years ago

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.

chrisbra commented 2 years ago

try using :keeppatterns command modifier

h3xx commented 2 years ago

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