Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .