Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This is in reply to:

A Vim script that checks capital letters and makes necessary corrections

that I found useful. I am a confirmed CLI hacker and writer. Because my fingers know Vim, I use it. In fact, I'm lost without it. How do I add the one-liner Vim script in my ~/.vimrc? Note, that I have tried a few things with no luck.

share|improve this question
add comment

1 Answer 1

You didn't say what you tried and how they didn't work, but if you just want to run that command with a single keystroke, you could put this in your ~/.vimrc:

map <F2> :%s/\(^\\|[.?!] \+\)./\U&/g<CR>

Note that I copied the command from the answer you referred to in your question but I had to double the backslash (\) in front of the bar (|) to get it to work. You might also read

:help usr_40.txt

for more on defining your own commands in Vim.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.