On 14/11/11 12:52, Eddine wrote:
yes I know s/string1/string2 will not replace ^M or ^A ;
I just want to make a first try to replace string1 to string2 first
before replacing "string1" by "^M"

2011/11/14 Tony Mechelynck <[email protected]
<mailto:[email protected]>>

    On 14/11/11 11:37, Eddine wrote:

        Hello
        At work I have to edit regurlarly files containing special
        characters
        like*^M or ^A*

        for the moment Im' at the first stage where I just try to make
        replace a
        string by another one in my autocommand:

            *au VimEnter,BufNewFile,BufRead,__BufEnter  *.log
          s/string1/string2/*


        But this doesn't give me good results:
        Wehn opeining a .log file, Vim prompts me to know if I want to
        replace
        the first occurence ;
        hitting "y" (yes key) change the first matching one then brings
        me error
        messages :

            E488: trailing characters
            E486: pattern not found string1

        Any mean to make it replace all matching strings whitout
        prompting and
        without error ?
        Thanks in adavance for your help.
        Eddine.


    _Exactly_ what command did you use? s/string1/string2 (where string1
    is six letters, Sierra Tango Romeo India November Golf, and the
    digit one) will never replace a ^M or a ^A

    Best regards,
    Tony.
    --
    There was a gay countess of Bray,
    And you may think it odd when I say,
            That in spite of high station,
            Rank and education,
    She always spelled cunt with a "k".



Well,
        s/string1/string2
                will replace "string1" by "string2" in the current line
                only, and give an error if there is no match.

See
        :help range
                to replace in the whole file
        :help :s_flags
                to give no error for no match
and near the bottom of the list given at
        :help /ordinary-atom
                about replacing a "special" (e.g. non-printable)
                character.

Best regards,
Tony.
--
Court, n.:
        A place where they dispense with justice.
                -- Arthur Train

--
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

Reply via email to