Last active
December 13, 2020 01:39
-
-
Save zhou13/1d2229d0636d649c9bba41d6afaa582d to your computer and use it in GitHub Desktop.
Format the title entry of a bib into apacase (title case) in vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Format all the word into title cases | |
| :%s/\(^\s*title.*\)\@<=\v<(.)(\w*)/\u\2\3/g | |
| " Change short words back | |
| :%s/\(^\s*title.*\)\@<=\(:\s*\|{\)\@<!\v<(And|As|But|For|If|Nor|Or|So|Yet|A|An|The|As|At|By|For|In|Of|Off|On|Per|To|Up|Via)>/\L\0/g |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment