4 ms·
I don't understand the first one: :%s/\w\+/\=submatch(0)+1/g | echo line('$') It doesn't seem to work -- except it says "xxx substitutions", so you can ass
by teo_zero 3y ago
I don't understand the first one:
:%s/\w\+/\=submatch(0)+1/g | echo line('$')
It doesn't seem to work -- except it says "xxx substitutions", so you can assume it found exactly xxx words. Besides, it changes the original text so you need to undo. Lastly, why is it so complicated? What is the purpose of submatch()? And why echoing the number of the last line?
- ConorSheehan1 3y agoI also thought this one was weird. I'd just use wc.
- palata 3y agoOr in vim, do `g ctrl+g`.