How to escape forward slashes?What does it mean to replace slashes (/) by exclamation marks (!) in a substitute command?Other ways to exit Insert mode besides EscapeCan Escape be disabled in insert mode?How to translate Unicode escape sequences to the Unicode character?What does it mean to replace slashes (/) by exclamation marks (!) in a substitute command?How to escape angle brackets in mappings (the ones that appear in <esc> and <cr>)How to escape filename containing single and double quotes mix?How to escape pipe character in `:make`, `:grep` and friendsHow to escape @ in search replacementSlow vim escape from insert modeHow to assign a Python list to a vim variable and escape its strings correctly

How to gracefully leave a company you helped start?

Running code generated in realtime in JavaScript with eval()

What unique challenges/limitations will I face if I start a career as a pilot at 45 years old?

Chunk + Enumerate a list of digits

(A room / an office) where an artist works

Does fossil fuels use since 1990 account for half of all the fossil fuels used in history?

What are the advantages of this gold finger shape?

Will using a resistor in series with a LED to control its voltage increase the total energy expenditure?

Why not demand President's/candidate's financial records instead of tax returns?

Help, I cannot decide when to start the story

Why aren't rainbows blurred-out into nothing after they are produced?

Do I have to cite common CS algorithms?

How do I ask for 2-3 days per week remote work in a job interview?

Is it possible to know the exact chord from the roman numerals

Is there a fallacy about "appeal to 'big words'"?

Prestidigitation to replace bathing and washing clothes worn?

Do beef farmed pastures net remove carbon emissions?

What is the prop for Thor's hammer made of?

How can I find an old paper when the usual methods fail?

Is there a way to proportionalize fixed costs in a MILP?

What would it take to get a message to another star?

What is the most difficult concept to grasp in Calculus 1?

Dogfights in outer space

Doesn't the speed of light limit imply the same electron can be annihilated twice?



How to escape forward slashes?


What does it mean to replace slashes (/) by exclamation marks (!) in a substitute command?Other ways to exit Insert mode besides EscapeCan Escape be disabled in insert mode?How to translate Unicode escape sequences to the Unicode character?What does it mean to replace slashes (/) by exclamation marks (!) in a substitute command?How to escape angle brackets in mappings (the ones that appear in <esc> and <cr>)How to escape filename containing single and double quotes mix?How to escape pipe character in `:make`, `:grep` and friendsHow to escape @ in search replacementSlow vim escape from insert modeHow to assign a Python list to a vim variable and escape its strings correctly






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I was editing a file and found accidentally that I somehow escaped all the forward slashes in a path I was replacing in text. And that is something very useful!



For instance, to do this replacement correctly I should escape the second path:



:%s/mvn//opt/maven/bin/mvn/g


I did that somehow with an accidental keystroke! But which one? :-(



Thank you.










share|improve this question


























  • Related issue: vi.stackexchange.com/questions/3156/…

    – Hotschke
    Aug 3 at 9:50

















2















I was editing a file and found accidentally that I somehow escaped all the forward slashes in a path I was replacing in text. And that is something very useful!



For instance, to do this replacement correctly I should escape the second path:



:%s/mvn//opt/maven/bin/mvn/g


I did that somehow with an accidental keystroke! But which one? :-(



Thank you.










share|improve this question


























  • Related issue: vi.stackexchange.com/questions/3156/…

    – Hotschke
    Aug 3 at 9:50













2












2








2








I was editing a file and found accidentally that I somehow escaped all the forward slashes in a path I was replacing in text. And that is something very useful!



For instance, to do this replacement correctly I should escape the second path:



:%s/mvn//opt/maven/bin/mvn/g


I did that somehow with an accidental keystroke! But which one? :-(



Thank you.










share|improve this question
















I was editing a file and found accidentally that I somehow escaped all the forward slashes in a path I was replacing in text. And that is something very useful!



For instance, to do this replacement correctly I should escape the second path:



:%s/mvn//opt/maven/bin/mvn/g


I did that somehow with an accidental keystroke! But which one? :-(



Thank you.







substitute escape






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 6 at 13:17









ruohola

23311 bronze badges




23311 bronze badges










asked Aug 2 at 19:45









januxjanux

111 bronze badge




111 bronze badge















  • Related issue: vi.stackexchange.com/questions/3156/…

    – Hotschke
    Aug 3 at 9:50

















  • Related issue: vi.stackexchange.com/questions/3156/…

    – Hotschke
    Aug 3 at 9:50
















Related issue: vi.stackexchange.com/questions/3156/…

– Hotschke
Aug 3 at 9:50





Related issue: vi.stackexchange.com/questions/3156/…

– Hotschke
Aug 3 at 9:50










1 Answer
1






active

oldest

votes


















8














You don't need to escape them: you could use a different separator for the search pattern and the replace part:



%s;mvn;/opt/maven/bin/mvn;g


But, if you really want to escape them, you can use a backslash ():



%s/mvn//opt/maven/bin/mvn/g


(much harder to read, IMO)






share|improve this answer



























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "599"
    ;
    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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f20802%2fhow-to-escape-forward-slashes%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    8














    You don't need to escape them: you could use a different separator for the search pattern and the replace part:



    %s;mvn;/opt/maven/bin/mvn;g


    But, if you really want to escape them, you can use a backslash ():



    %s/mvn//opt/maven/bin/mvn/g


    (much harder to read, IMO)






    share|improve this answer





























      8














      You don't need to escape them: you could use a different separator for the search pattern and the replace part:



      %s;mvn;/opt/maven/bin/mvn;g


      But, if you really want to escape them, you can use a backslash ():



      %s/mvn//opt/maven/bin/mvn/g


      (much harder to read, IMO)






      share|improve this answer



























        8












        8








        8







        You don't need to escape them: you could use a different separator for the search pattern and the replace part:



        %s;mvn;/opt/maven/bin/mvn;g


        But, if you really want to escape them, you can use a backslash ():



        %s/mvn//opt/maven/bin/mvn/g


        (much harder to read, IMO)






        share|improve this answer













        You don't need to escape them: you could use a different separator for the search pattern and the replace part:



        %s;mvn;/opt/maven/bin/mvn;g


        But, if you really want to escape them, you can use a backslash ():



        %s/mvn//opt/maven/bin/mvn/g


        (much harder to read, IMO)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 2 at 21:10









        João A. ToledoJoão A. Toledo

        5412 silver badges4 bronze badges




        5412 silver badges4 bronze badges






























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Vi and Vim Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f20802%2fhow-to-escape-forward-slashes%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form