DEV Community

Discussion on: Formating Dates With Vim Substitutuions

Collapse
 
filbranden profile image
Filipe Brandenburger

Great article, as usual!

For the replacement, also possible to use Vim functions strftime() and strptime(), so you don't need to shell out to an external date binary..

:%s/\v\d{4}-\d{2}-\d{2}/\=strftime("%B %d, %Y", strptime("%Y-%m-%d", submatch(0)))/g
Collapse
 
voyeg3r profile image
Sérgio Araújo

Filipe, it seems that my neovim does not have the function "strptime"