Thursday, November 23, 2006

Capitalizing Sentences

Here is a quick way to search for some letters, and then capitalize them quickly. I wanted to capitalize all of the letters at that start a line. Here was my query:

:%s/^\(\w\)/\=toupper(submatch(0))/

I forget about Vim's submatching expression, which is extra handy for some of those tasks that just appear to be unavoidable monotony.

No comments: