Hacker News new | ask | show | jobs
by chrismorgan 1857 days ago
TIL s/\u, thanks!

I know I’ve read that part of the documentation before, but probably not for over five years. In cases where I’ve wanted something like that, I’ve tended to reach for macros, visual block editing, and s/\=. A few days ago I did a somewhat more complicated one that s/\U wouldn’t be sufficient for:

  :'<,'>s/.*/\="    pub const ".substitute(toupper(submatch(0)), "[^A-Z0-9]\+", "_", "g").": &'static str = \"".submatch(0)."\";"
1 comments

Vim's documentation is complete and very well-written. I've been using the editor for over 10 years and I still learn new things when perusing :help.