News for hackers. Stuff that matters.
Re:Intermediate Vim by isostatic on Wednesday May 01, 2019 @04:47AM (#19795495)
I've used vim for a couple of decades, but never pushed to many advanced features. For your example above I'd do :%s/^/"/ and :%s/$/",/

Unless I use a feature regularly I find it's a higher cognative load. I use bash, sed and perl regexps on a near daily basis. Macros are very rare.

Re:Intermediate Vim by chongli on Wednesday May 01, 2019 @08:52AM (#19796566)
For that same example, you can accomplish the job in one substitute command:

    :%s/.*/"&",/
The & special character gets replaced with the whole matched pattern.
Re:Intermediate Vim by mooreds on Wednesday May 01, 2019 @11:33AM (#19798026)
How do you escape the & character? I have been bit by this (not escaping &) a few times but never enough to have found the answer.
Re:Intermediate Vim by Asooka on Wednesday May 01, 2019 @12:00PM (#19798379)
The same way you escape anything - with a \. E.g. if you wanted to substitute the character x with the sequence &/\ you would type

:s/x/\&\/\\

Re:Intermediate Vim by jermy on Wednesday May 01, 2019 @08:12AM (#19796344)
Likewise - with visual mode it's normally pretty quick to select an area and do a basic regex, even for things like re-indentation (auto-completes to something like :'<,'>s/^/\t/) even though I'm sure there's a 'proper' way to do that
Re:Intermediate Vim by Izkata on Wednesday May 01, 2019 @11:09AM (#19797711)
> for indent, < for un-indent