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

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

            Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

            Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?