Change control characters

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Change control characters

Alex Chen
Hi,
   I am using Vim 7.4 on Windows.  I used to be able to do replace control charters like ^M in command mode  by entering ^V and followed by ^M so that the command
:%s/^V^M/\r/
will fix the carriage return issue of a file.

The character ^ is the CTRL key, therefore the string :%s/^V^M/\r/ above is actually shown as
:%s/^M/\r/ when I do this on Mac, which is also 'vim'.
However, on Windows the CTRL-V key always 'pastes' whatever is in the cut buffer instead of entering control charter editing mode no matter which mode I am in.  

Is this a bug or is there something not set properly.

Alex

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Change control characters

Tony Mechelynck
On Sat, Nov 11, 2017 at 3:21 AM, 'Alex Chen' via vim_use
<[hidden email]> wrote:

> Hi,
>    I am using Vim 7.4 on Windows.  I used to be able to do replace control charters like ^M in command mode  by entering ^V and followed by ^M so that the command
> :%s/^V^M/\r/
> will fix the carriage return issue of a file.
>
> The character ^ is the CTRL key, therefore the string :%s/^V^M/\r/ above is actually shown as
> :%s/^M/\r/ when I do this on Mac, which is also 'vim'.
> However, on Windows the CTRL-V key always 'pastes' whatever is in the cut buffer instead of entering control charter editing mode no matter which mode I am in.
>
> Is this a bug or is there something not set properly.
>
> Alex

It is the result of one of the mappings set up by the script
mswin.vim, which is supposed — if you can believe it — to make life
easier for Windows newbie users. There are two possible ways to fix
it, choose the one you prefer, or even both of them:

Method I. Go over your vimrc and make sure that it doesn't :source (or
:runtime) the mswin.vim script. Then various other keys such as
Ctrl-C, Ctrl-X, etc., will go back to their "classical Vim" meaning.
This is what I personally prefer but YMMV.

Method II. Use Ctrl-Q instead of Ctrl-V, also to go from Normal mode
to Block-Visual. This will not solve the fact that mswin.vim hides
some other very useful bindings, though.

See
    :help mswin.vim
    :help CTRL-V-alternative
    :help i_CTRL-Q


Best regards,
Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.