How do you insert literal control chars in vim on Mac?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












How do you insert literal control characters in vi on Mac?



For example what is the Mac equivalent of



Unix ^V^M
Windows ^Q^M (in vim)



to insert a r into a substitution string?







share|improve this question


























    up vote
    3
    down vote

    favorite












    How do you insert literal control characters in vi on Mac?



    For example what is the Mac equivalent of



    Unix ^V^M
    Windows ^Q^M (in vim)



    to insert a r into a substitution string?







    share|improve this question
























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      How do you insert literal control characters in vi on Mac?



      For example what is the Mac equivalent of



      Unix ^V^M
      Windows ^Q^M (in vim)



      to insert a r into a substitution string?







      share|improve this question














      How do you insert literal control characters in vi on Mac?



      For example what is the Mac equivalent of



      Unix ^V^M
      Windows ^Q^M (in vim)



      to insert a r into a substitution string?









      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 2 at 1:35









      bmike♦

      149k45265583




      149k45265583










      asked Sep 2 at 1:17









      user3557732

      464




      464




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          6
          down vote













          It's the same like in Unix/Linux:



          ^V^M


          But, if you want to use the character in a substitution string, then you should write it like it is, r, e.g.



          :%s/blabla/r/





          share|improve this answer






















          • Thank you. The trick for others who are trying to de-Windows their brains, is to use the actual ^ (control) key not the command key that you think is the mac version of the control key (because it usually is) and to use the actual M key for ^M not the Enter key that works equally well in vim on Windows.
            – user3557732
            Sep 2 at 11:47











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "118"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f335369%2fhow-do-you-insert-literal-control-chars-in-vim-on-mac%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          6
          down vote













          It's the same like in Unix/Linux:



          ^V^M


          But, if you want to use the character in a substitution string, then you should write it like it is, r, e.g.



          :%s/blabla/r/





          share|improve this answer






















          • Thank you. The trick for others who are trying to de-Windows their brains, is to use the actual ^ (control) key not the command key that you think is the mac version of the control key (because it usually is) and to use the actual M key for ^M not the Enter key that works equally well in vim on Windows.
            – user3557732
            Sep 2 at 11:47















          up vote
          6
          down vote













          It's the same like in Unix/Linux:



          ^V^M


          But, if you want to use the character in a substitution string, then you should write it like it is, r, e.g.



          :%s/blabla/r/





          share|improve this answer






















          • Thank you. The trick for others who are trying to de-Windows their brains, is to use the actual ^ (control) key not the command key that you think is the mac version of the control key (because it usually is) and to use the actual M key for ^M not the Enter key that works equally well in vim on Windows.
            – user3557732
            Sep 2 at 11:47













          up vote
          6
          down vote










          up vote
          6
          down vote









          It's the same like in Unix/Linux:



          ^V^M


          But, if you want to use the character in a substitution string, then you should write it like it is, r, e.g.



          :%s/blabla/r/





          share|improve this answer














          It's the same like in Unix/Linux:



          ^V^M


          But, if you want to use the character in a substitution string, then you should write it like it is, r, e.g.



          :%s/blabla/r/






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 2 at 1:46

























          answered Sep 2 at 1:30









          t0r0X

          1668




          1668











          • Thank you. The trick for others who are trying to de-Windows their brains, is to use the actual ^ (control) key not the command key that you think is the mac version of the control key (because it usually is) and to use the actual M key for ^M not the Enter key that works equally well in vim on Windows.
            – user3557732
            Sep 2 at 11:47

















          • Thank you. The trick for others who are trying to de-Windows their brains, is to use the actual ^ (control) key not the command key that you think is the mac version of the control key (because it usually is) and to use the actual M key for ^M not the Enter key that works equally well in vim on Windows.
            – user3557732
            Sep 2 at 11:47
















          Thank you. The trick for others who are trying to de-Windows their brains, is to use the actual ^ (control) key not the command key that you think is the mac version of the control key (because it usually is) and to use the actual M key for ^M not the Enter key that works equally well in vim on Windows.
          – user3557732
          Sep 2 at 11:47





          Thank you. The trick for others who are trying to de-Windows their brains, is to use the actual ^ (control) key not the command key that you think is the mac version of the control key (because it usually is) and to use the actual M key for ^M not the Enter key that works equally well in vim on Windows.
          – user3557732
          Sep 2 at 11:47


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f335369%2fhow-do-you-insert-literal-control-chars-in-vim-on-mac%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          List of Gilmore Girls characters

          Confectionery