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.

I copied some data from an app and it has lots of ^Ds and ^Ms in it. I got rid of ^D with no problem using :%s/^D//g and I know I can remove ^M with something like :%s/^V^M//g but the problem is that I'm running on windows and ^V is Ctrl-V, which pastes data from the clipboard into gvim. How do I escape the paste function of ^V/ctrl-V in Windows for vim?

share|improve this question

3 Answers 3

up vote 3 down vote accepted

from :help CTRL-V-alternative:

                                                *CTRL-V-alternative* *CTRL-Q*
Since CTRL-V is used to paste, you can't use it to start a blockwise Visual
selection.  You can use CTRL-Q instead.  You can also use CTRL-Q in Insert
mode and Command-line mode to get the old meaning of CTRL-V.  But CTRL-Q
doesn't work for terminals when it's used for control flow.
share|improve this answer

Another Way, specific for ^M, would be to use :%s/\r//g since ^M is a carriage return.

share|improve this answer

To use your familiar MS Windows hotkeys for copy, paste etc. use the mswin.vim file as your configuration. Copy it from your install path to where your $HOME directory is, renamed to _vimrc. Type :echo $HOME to figure out where that is. Usually something like C:\Users\'username'. Restart gVim and your regular Windows Ctrl-V, Ctrl-C type of hotkeys should work.

See Where should .vimrc file be located on Windows 7? for a little more guidance.

share|improve this answer

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.