I like to capitalise my Pull Requests titles. It’s a cumbersome task tho, so
I’ve added to my Vim config a handy command to capitalise a line of text. Used
on a Git commit it gives me a pretty PR title in seconds.
The command is <Leader>cap
.
Here’s the .vimrc
config:
vmap <Leader>cap :s/^\a\\|\<\(in\>\\|the\>\\|at\>\\|with\>\\|a\>\\|and\>\\|for\>\\|of\>\\|on\>\\|from\>\\|by\>\)\@\!\a/\u&/g<CR>:noh<CR><CR>
nmap <Leader>cap <S-V><Leader>cap
This is inspired from this blog post.