Loading ...
Sorry, an error occurred while loading the content.
 

Substitution of metacharacters

Expand Messages
  • Bob von Knobloch
    Hi, I ve searched all over but can t find an answer. How can one perform commands like :%s/ n/ r r/g (replacing newlines or tabs etc.) in the gui s find and
    Message 1 of 20 , May 24, 2012
      Hi, I've searched all over but can't find an answer. How can one perform
      commands like ':%s/\n/\r\r/g' (replacing newlines or tabs etc.) in the
      gui's 'find and replace' dialogue?

      Many thanks,

      Bob
      --
      The Sun is out, the sky is blue. It's time to drive the MR2.

      --
      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
    • Tim Chase
      ... Playing around with :promptrepl (the underlying command), it looks like the *search* portion of it is happy to take various regexps. However the
      Message 2 of 20 , May 24, 2012
        On 05/24/12 08:34, Bob von Knobloch wrote:
        > Hi, I've searched all over but can't find an answer. How can one perform
        > commands like ':%s/\n/\r\r/g' (replacing newlines or tabs etc.) in the
        > gui's 'find and replace' dialogue?

        Playing around with :promptrepl (the underlying command), it looks
        like the *search* portion of it is happy to take various regexps.
        However the replacement part only seems to accept literals. Thus in
        your example, it puts in a literal "\r\r" instead of two newlines.

        So I guess my short answer based on testing is: when using the gui
        find-and-replace, there's no way to replace with anything but literals.

        I'd be glad if someone could prove me wrong (it seems a peculiar
        development choice to lose the parity with :substitute)

        -tim



        --
        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
      • Ben Fritz
        ... I tried replacing tabs, and also replacing newlines, with the GUI dialog (Edit- Find an Replace...) Entering t as the Find what pattern and (two
        Message 3 of 20 , May 24, 2012
          On Thursday, May 24, 2012 8:34:03 AM UTC-5, Bob von Knobloch wrote:
          > Hi, I've searched all over but can't find an answer. How can one perform
          > commands like ':%s/\n/\r\r/g' (replacing newlines or tabs etc.) in the
          > gui's 'find and replace' dialogue?
          >

          I tried replacing tabs, and also replacing newlines, with the GUI dialog (Edit->Find an Replace...)

          Entering \t as the "Find what" pattern and " " (two spaces) as the "Replace with" text worked as expected, replacing all tab characters with spaces.

          Entering \n as the "Find what" and '.' as the "Replace with" text also worked as expected, joining all lines together with a '.' character in between.

          Oh, I see...if a special character is in the "Replace with" text, it doesn't work as you are hoping. For example, with "Find what" as \\t and "Replace with" as \t, the dialog does nothing. The "Replace with" text seems to always be taken literally. The help does not really offer any information about the behavior of the find-replace dialog (:help :promptrepl). It looks like to replace with a special character, you somehow need to enter that special character in the dialog.

          For some characters, you can do this by copy-pasting the desired literal character into the "Replace with" text. You can get it into the clipboard from within Vim with, for example,

          :let @+="\t"

          Unfortunately, this does not work for linefeed characters, and probably other special unprintable characters will likewise not be available.

          I'm not sure if there's a way to enter these characters directly in the dialog, but likely you'll need to use the command-line rather than the dialog for special patterns like this.

          --
          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
        • Roy Fulbright
          ... try this: Find what: n Replace with: = x20 to replace all newlines with a space -- You received this message from the vim_use maillist. Do not
          Message 4 of 20 , May 24, 2012

             
            > Date: Thu, 24 May 2012 07:56:08 -0700
            > From: fritzophrenic@...
            > To: vim_use@...
            > CC: vim@...
            > Subject: Re: Substitution of metacharacters
            >
            > On Thursday, May 24, 2012 8:34:03 AM UTC-5, Bob von Knobloch wrote:
            > > Hi, I've searched all over but can't find an answer. How can one perform
            > > commands like ':%s/\n/\r\r/g' (replacing newlines or tabs etc.) in the
            > > gui's 'find and replace' dialogue?
            > >
            >
            > I tried replacing tabs, and also replacing newlines, with the GUI dialog (Edit->Find an Replace...)
            >
            > Entering \t as the "Find what" pattern and " " (two spaces) as the "Replace with" text worked as expected, replacing all tab characters with spaces.
            >
            > Entering \n as the "Find what" and '.' as the "Replace with" text also worked as expected, joining all lines together with a '.' character in between.
            >
            > Oh, I see...if a special character is in the "Replace with" text, it doesn't work as you are hoping. For example, with "Find what" as \\t and "Replace with" as \t, the dialog does nothing. The "Replace with" text seems to always be taken literally. The help does not really offer any information about the behavior of the find-replace dialog (:help :promptrepl). It looks like to replace with a special character, you somehow need to enter that special character in the dialog.
            >
            > For some characters, you can do this by copy-pasting the desired literal character into the "Replace with" text. You can get it into the clipboard from within Vim with, for example,
            >
            > :let @+="\t"
            >
            > Unfortunately, this does not work for linefeed characters, and probably other special unprintable characters will likewise not be available.
            >
            > I'm not sure if there's a way to enter these characters directly in the dialog, but likely you'll need to use the command-line rather than the dialog for special patterns like this.
            >
            > --
            > 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
            try this:
             
            Find what:  \n
            Replace with: \="\x20"
             
            to replace all newlines with a space
             

            --
            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
          • Bob von Knobloch
            ... Nope, the text = x20 gets inserted literally. Thanks anyway, Bob -- The Sun is out, the sky is blue, it s time to drive the MR2. -- You received
            Message 5 of 20 , May 24, 2012
              On 24/05/12 19:20, Roy Fulbright wrote:
              >
              >
              >
              >
              >> Date: Thu, 24 May 2012 07:56:08 -0700
              >> From: fritzophrenic@...
              >> To: vim_use@...
              >> CC: vim@...
              >> Subject: Re: Substitution of metacharacters
              >>
              >> On Thursday, May 24, 2012 8:34:03 AM UTC-5, Bob von Knobloch wrote:
              >>> Hi, I've searched all over but can't find an answer. How can one perform
              >>> commands like ':%s/\n/\r\r/g' (replacing newlines or tabs etc.) in the
              >>> gui's 'find and replace' dialogue?
              >>>
              >>
              >> I tried replacing tabs, and also replacing newlines, with the GUI dialog (Edit->Find an Replace...)
              >>
              >> Entering \t as the "Find what" pattern and " " (two spaces) as the "Replace with" text worked as expected, replacing all tab characters with spaces.
              >>
              >> Entering \n as the "Find what" and '.' as the "Replace with" text also worked as expected, joining all lines together with a '.' character in between.
              >>
              >> Oh, I see...if a special character is in the "Replace with" text, it doesn't work as you are hoping. For example, with "Find what" as \\t and "Replace with" as \t, the dialog does nothing. The "Replace with" text seems to always be taken literally. The help does not really offer any information about the behavior of the find-replace dialog (:help :promptrepl). It looks like to replace with a special character, you somehow need to enter that special character in the dialog.
              >>
              >> For some characters, you can do this by copy-pasting the desired literal character into the "Replace with" text. You can get it into the clipboard from within Vim with, for example,
              >>
              >> :let @+="\t"
              >>
              >> Unfortunately, this does not work for linefeed characters, and probably other special unprintable characters will likewise not be available.
              >>
              >> I'm not sure if there's a way to enter these characters directly in the dialog, but likely you'll need to use the command-line rather than the dialog for special patterns like this.
              >>
              >> --
              >> 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
              >
              > try this:
              >
              > Find what: \n
              > Replace with: \="\x20"
              >
              > to replace all newlines with a space
              >
              >
              Nope, the text ' \="\x20" ' gets inserted literally.
              Thanks anyway,

              Bob

              --
              The Sun is out, the sky is blue, it's time to drive the MR2.

              --
              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
            • Christian Brabandt
              Hi Bob! ... Not possible, the replace text is escaped: ,----[ gui.c ]- ... `---- Here is an experimental patch against the gtk gui, that adds an extra flag,
              Message 6 of 20 , May 24, 2012
                Hi Bob!

                On Do, 24 Mai 2012, Bob von Knobloch wrote:

                > Hi, I've searched all over but can't find an answer. How can one perform
                > commands like ':%s/\n/\r\r/g' (replacing newlines or tabs etc.) in the
                > gui's 'find and replace' dialogue?

                Not possible, the replace text is escaped:

                ,----[ gui.c ]-
                |5276 ga_concat(&ga, (char_u *)"/");
                |5277 /* escape / and \ */
                |5278 p = vim_strsave_escaped(repl_text, (char_u *)"/\\");
                `----

                Here is an experimental patch against the gtk gui, that adds an extra
                flag, and allows to replace with special chars ,e.g. \t for Tab

                Looking at the dialog, it could possibly also get some more
                possibilities, e.g. a confirm/undo button, perhaps even more.

                regards,
                Christian

                --
                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
              • Tony Mechelynck
                ... If the menus don t do what you want, use the keyboard. Typing ... followed by Enter (no /g needed since there can be only one end-of-line per line) will
                Message 7 of 20 , May 24, 2012
                  On 24/05/12 15:34, Bob von Knobloch wrote:
                  > Hi, I've searched all over but can't find an answer. How can one perform
                  > commands like ':%s/\n/\r\r/g' (replacing newlines or tabs etc.) in the
                  > gui's 'find and replace' dialogue?
                  >
                  > Many thanks,
                  >
                  > Bob
                  >

                  If the menus don't do what you want, use the keyboard. Typing

                  :%s/\n/\r\r

                  followed by Enter (no /g needed since there can be only one end-of-line
                  per line) will add an empty line after every line in the file. Not what
                  you'd want to do every day, but it ought to work.

                  Similarly, you can assign all that to one key by means of

                  :map <F2> :%s/<Bslash>n/<Bslash>r<Bslash>r<CR>

                  and/or

                  :vmap <F2> :s/<Bslash>n/<Bslash>r<Bslash>r<CR>

                  (the vmap would apply the substitute to all lines of the current visual
                  selection).

                  See
                  :help :s
                  :help 'magic'
                  :help sub-replace-special
                  :help map.txt


                  Best regards,
                  Tony.
                  --
                  Chism's Law of Completion:
                  The amount of time required to complete a government project is
                  precisely equal to the length of time already spent on it.

                  --
                  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
                • Bob von Knobloch
                  ... ... Thanks Tony, I know how to use the keyboard to get what I want done, it just niggles when the gui doesn t work the same way, especially when I m
                  Message 8 of 20 , May 25, 2012
                    On 25/05/12 04:18, Tony Mechelynck wrote:

                    > If the menus don't do what you want, use the keyboard. Typing
                    >
                    > :%s/\n/\r\r
                    >

                    <snip>

                    > Best regards,
                    > Tony.

                    Thanks Tony, I know how to use the keyboard to get what I want done, it
                    just niggles when the gui doesn't work the same way, especially when I'm
                    trying to show someone how to do it and have to explain that the 2
                    methods (command vs. gui) are not the same. It seems like an oversight
                    somehow.

                    Bob

                    --
                    The Sun is out, the sky is blue. It's time to drive the MR2.

                    --
                    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
                  • Bob von Knobloch
                    ... Thanks Christian, I really wanted to know if I had missed something. This demonstrates that the gui cannot replace these characters. I don t want to build
                    Message 9 of 20 , May 25, 2012
                      On 24/05/12 22:14, Christian Brabandt wrote:
                      > Hi Bob!
                      >
                      > On Do, 24 Mai 2012, Bob von Knobloch wrote:
                      >
                      >> Hi, I've searched all over but can't find an answer. How can one perform
                      >> commands like ':%s/\n/\r\r/g' (replacing newlines or tabs etc.) in the
                      >> gui's 'find and replace' dialogue?
                      >
                      > Not possible, the replace text is escaped:
                      >
                      > ,----[ gui.c ]-
                      > |5276 ga_concat(&ga, (char_u *)"/");
                      > |5277 /* escape / and \ */
                      > |5278 p = vim_strsave_escaped(repl_text, (char_u *)"/\\");
                      > `----
                      >
                      > Here is an experimental patch against the gtk gui, that adds an extra
                      > flag, and allows to replace with special chars ,e.g. \t for Tab
                      >
                      > Looking at the dialog, it could possibly also get some more
                      > possibilities, e.g. a confirm/undo button, perhaps even more.
                      >
                      > regards,
                      > Christian
                      >
                      Thanks Christian,
                      I really wanted to know if I had missed something. This demonstrates
                      that the gui cannot replace these characters. I don't want to build my
                      own version, mainly because I can use the command line. It's when I try
                      to explain to others (who have the 'standard' issue gvim), that it seems
                      strange that the 2 input methods are different. However, that's how it is.
                      Thanks very much for you efforts.

                      Bob

                      --
                      The Sun is out, the sky is blue. It's time to drive the MR2.

                      --
                      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
                    • Tony Mechelynck
                      ... Maybe it is. With Vim, the whole menu subsystem is a kind of aftersight, sometimes that was added after-the-fact, even though in a console Vim compiled
                      Message 10 of 20 , May 25, 2012
                        On 25/05/12 09:38, Bob von Knobloch wrote:
                        > On 25/05/12 04:18, Tony Mechelynck wrote:
                        >
                        >> If the menus don't do what you want, use the keyboard. Typing
                        >>
                        >> :%s/\n/\r\r
                        >>
                        >
                        > <snip>
                        >
                        >> Best regards,
                        >> Tony.
                        >
                        > Thanks Tony, I know how to use the keyboard to get what I want done, it
                        > just niggles when the gui doesn't work the same way, especially when I'm
                        > trying to show someone how to do it and have to explain that the 2
                        > methods (command vs. gui) are not the same. It seems like an oversight
                        > somehow.
                        >
                        > Bob
                        >


                        Maybe it is. With Vim, the whole menu subsystem is a kind of aftersight,
                        sometimes that was added after-the-fact, even though in a console Vim
                        compiled with +menu (or, on Unix, when using a GUI-enabled Vim in
                        console mode) it is quite easy to access the menus even in the console.

                        Best regards,
                        Tony.
                        --
                        Has your family tried 'em?

                        POWDERMILK BISCUITS

                        Heavens, they're tasty and expeditious!

                        They're made from whole wheat, to give shy persons the
                        strength to get up and do what needs to be done.

                        POWDERMILK BISCUITS

                        Buy them ready-made in the big blue box with the picture of the
                        biscuit on the front, or in the brown bag with the dark stains
                        that indicate freshness.

                        --
                        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
                      • Chris Jones
                        ... Search/replace behavior in the GUI is not only different than in the console version but appears to lead to inconsistencies: try a search ‘.*’ for
                        Message 11 of 20 , May 25, 2012
                          On Thu, May 24, 2012 at 10:53:27AM EDT, Tim Chase wrote:
                          > On 05/24/12 08:34, Bob von Knobloch wrote:

                          > > Hi, I've searched all over but can't find an answer. How can one
                          > > perform commands like ':%s/\n/\r\r/g' (replacing newlines or tabs
                          > > etc.) in the gui's 'find and replace' dialogue?

                          > Playing around with :promptrepl (the underlying command), it looks
                          > like the *search* portion of it is happy to take various regexps.
                          > However the replacement part only seems to accept literals. Thus in
                          > your example, it puts in a literal "\r\r" instead of two newlines.

                          Search/replace behavior in the GUI is not only different than in the
                          console version but appears to lead to inconsistencies: try a search
                          ‘.*’ for instance and compare with ‘\s\s’.

                          > So I guess my short answer based on testing is: when using the gui
                          > find-and-replace, there's no way to replace with anything but literals.
                          >
                          > I'd be glad if someone could prove me wrong (it seems a peculiar
                          > development choice to lose the parity with :substitute)

                          +1 .. (fwiw, since I don't use the GUI).

                          Would that be worth a feature/enhancement request?

                          In the ELinks text-mode browser, e.g. the popup dialog has the following
                          checkboxes:

                          ( ) Normal search ( ) Regexp search (X) Extended regexp search

                          There are probably other examples of this feature that are more relevant
                          to the GUI world but perhaps Vim could have a ‘Regex’ checkbox: checking
                          it would activate regex mode both for search & replace..?

                          CJ

                          --
                          WHAT YOU SAY??

                          --
                          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
                        • Christian Brabandt
                          ... I think the search/replace dialog uses the V atom to make the search very nomagic , so you need to use . * It seems the windows version of the replace
                          Message 12 of 20 , May 25, 2012
                            On Fri, May 25, 2012 11:32, Chris Jones wrote:
                            > Search/replace behavior in the GUI is not only different than in the
                            > console version but appears to lead to inconsistencies: try a search
                            > ‘.*’ for instance and compare with ‘\s\s’.

                            I think the search/replace dialog uses the \V atom to make the
                            search "very nomagic", so you need to use \.\*

                            It seems the windows version of the replace dialog is also missing a
                            direction radio-button.

                            regards,
                            Christian

                            --
                            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
                          • Chris Jones
                            ... Yes, I didn t mention it in my post but I did check the GUI s setting by a ‘:set magic?’ and noticed that it was (recommended for portability s sake by
                            Message 13 of 20 , May 25, 2012
                              On Fri, May 25, 2012 at 05:47:35AM EDT, Christian Brabandt wrote:
                              > On Fri, May 25, 2012 11:32, Chris Jones wrote:

                              > > Search/replace behavior in the GUI is not only different than in the
                              > > console version but appears to lead to inconsistencies: try a search
                              > > ‘.*’ for instance and compare with ‘\s\s’.

                              > I think the search/replace dialog uses the \V atom to make the
                              > search "very nomagic", so you need to use \.\*

                              Yes, I didn't mention it in my post but I did check the GUI's setting by
                              a ‘:set magic?’ and noticed that it was (recommended for portability's
                              sake by the manual..) that it is also set to ‘magic’ in the GUI.. same
                              as the console version.

                              Do you mean that the code overrides this setting for the GUI search..?

                              Anyway, I don't use the GUI so it doesn't affect me but I was thinking
                              that there may be real world cases where possible inconsistencies (if
                              there are any) might lead to false positives/negatives.. making the
                              search functionality unreliable for the user even when he's trying to
                              search on a regex.. If so, and depending on the context this might not
                              be a good thing.. (?)

                              CJ

                              --
                              Focus follow mouse users will burn in hell!!!

                              --
                              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
                            • Chris Jones
                              ... oops.. s/when he s trying/when he s *not* trying/ CJ -- Alex Perez is aliveeeeeeee!!! -- You received this message from the vim_use maillist. Do not
                              Message 14 of 20 , May 25, 2012
                                On Fri, May 25, 2012 at 06:00:46AM EDT, Chris Jones wrote:

                                > Anyway, I don't use the GUI so it doesn't affect me but I was thinking
                                > that there may be real world cases where possible inconsistencies (if
                                > there are any) might lead to false positives/negatives.. making the
                                > search functionality unreliable for the user even when he's trying to
                                > search on a regex.. If so, and depending on the context this might not
                                > be a good thing.. (?)

                                oops.. s/when he's trying/when he's *not* trying/

                                CJ

                                --
                                Alex Perez is aliveeeeeeee!!!

                                --
                                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
                              • Ben Fritz
                                ... Well, there s this in todo.txt: 7 More features in the find/replace dialog: - regexp on/off - search in selection/buffer/all buffers/directory when all
                                Message 15 of 20 , May 25, 2012
                                  On Thursday, May 24, 2012 3:14:35 PM UTC-5, Christian Brabandt wrote:
                                  >
                                  > Looking at the dialog, it could possibly also get some more
                                  > possibilities, e.g. a confirm/undo button, perhaps even more.
                                  >

                                  Well, there's this in todo.txt:

                                  7 More features in the find/replace dialog:
                                  - regexp on/off
                                  - search in selection/buffer/all buffers/directory
                                  when all buffers/directory is used:
                                  - filter for file name
                                  when directory is used:
                                  - subdirectory on/off
                                  - top directory browser

                                  --
                                  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
                                • Ben Fritz
                                  ... Yes...kind of. The code for the GUI automatically inserts V in the search pattern, which is a flag for very nomagic , which is not even settable via an
                                  Message 16 of 20 , May 25, 2012
                                    On Friday, May 25, 2012 5:00:46 AM UTC-5, Chris Jones wrote:
                                    > On Fri, May 25, 2012 at 05:47:35AM EDT, Christian Brabandt wrote:
                                    > > On Fri, May 25, 2012 11:32, Chris Jones wrote:
                                    >
                                    > > > Search/replace behavior in the GUI is not only different than in the
                                    > > > console version but appears to lead to inconsistencies: try a search
                                    > > > ‘.*’ for instance and compare with ‘\s\s’.
                                    >
                                    > > I think the search/replace dialog uses the \V atom to make the
                                    > > search "very nomagic", so you need to use \.\*
                                    >
                                    > Yes, I didn't mention it in my post but I did check the GUI's setting by
                                    > a ‘:set magic?’ and noticed that it was (recommended for portability's
                                    > sake by the manual..) that it is also set to ‘magic’ in the GUI.. same
                                    > as the console version.
                                    >
                                    > Do you mean that the code overrides this setting for the GUI search..?
                                    >

                                    Yes...kind of. The code for the GUI automatically inserts \V in the search pattern, which is a flag for "very nomagic", which is not even settable via an option. The \V flag will override any 'magic' option setting.

                                    --
                                    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
                                  • Chris Jones
                                    ... [..] ... So it appears to be.. Maybe the doc should mention that ‘very nomagic’ that is the default option when you do a search via the GUI dialog. I d
                                    Message 17 of 20 , May 25, 2012
                                      On Fri, May 25, 2012 at 10:10:49AM EDT, Ben Fritz wrote:
                                      > On Friday, May 25, 2012 5:00:46 AM UTC-5, Chris Jones wrote:

                                      [..]

                                      > > Do you mean that the code overrides this setting for the GUI
                                      > > search..?

                                      > Yes...kind of. The code for the GUI automatically inserts \V in the
                                      > search pattern, which is a flag for "very nomagic", which is not even
                                      > settable via an option. The \V flag will override any 'magic' option
                                      > setting.

                                      So it appears to be..

                                      Maybe the doc should mention that ‘very nomagic’ that is the default
                                      option when you do a search via the GUI dialog. I'd always wondered what
                                      that particular option was meant for.

                                      CJ

                                      --
                                      Oh My God!!! Larry is back!

                                      --
                                      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
                                    • Tim Chase
                                      ... The docs for :promptrepl should also include that the replacement is a literal, not making use of any metachars such as & or . -tim -- You received
                                      Message 18 of 20 , May 25, 2012
                                        On 05/25/12 14:17, Chris Jones wrote:
                                        >> Yes...kind of. The code for the GUI automatically inserts \V in
                                        >> the search pattern, which is a flag for "very nomagic", which
                                        >> is not even settable via an option. The \V flag will override
                                        >> any 'magic' option setting.
                                        >
                                        > So it appears to be..
                                        >
                                        > Maybe the doc should mention that ‘very nomagic’ that is the
                                        > default option when you do a search via the GUI dialog. I'd
                                        > always wondered what that particular option was meant for.

                                        The docs for :promptrepl should also include that the replacement is
                                        a literal, not making use of any metachars such as "&" or "\".

                                        -tim


                                        --
                                        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
                                      • Christian Brabandt
                                        ... Here is an even improved version of the patch, which adds the buttons Undo and Redo to the gtk and motif version and which adds an extra parameter whether
                                        Message 19 of 20 , May 26, 2012
                                          On Do, 24 Mai 2012, Christian Brabandt wrote:
                                          > On Do, 24 Mai 2012, Bob von Knobloch wrote:
                                          > > Hi, I've searched all over but can't find an answer. How can one perform
                                          > > commands like ':%s/\n/\r\r/g' (replacing newlines or tabs etc.) in the
                                          > > gui's 'find and replace' dialogue?
                                          >
                                          > Not possible, the replace text is escaped:
                                          >
                                          > ,----[ gui.c ]-
                                          > |5276 ga_concat(&ga, (char_u *)"/");
                                          > |5277 /* escape / and \ */
                                          > |5278 p = vim_strsave_escaped(repl_text, (char_u *)"/\\");
                                          > `----
                                          >
                                          > Here is an experimental patch against the gtk gui, that adds an extra
                                          > flag, and allows to replace with special chars ,e.g. \t for Tab
                                          >
                                          > Looking at the dialog, it could possibly also get some more
                                          > possibilities, e.g. a confirm/undo button, perhaps even more.

                                          Here is an even improved version of the patch, which adds the buttons
                                          Undo and Redo to the gtk and motif version and which adds an extra
                                          parameter whether to search/replace literally.

                                          regards,
                                          Christian

                                          --
                                          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
                                        • Christian Brabandt
                                          ... One more update: - Replace should work better now (and works like in the current version of Gvim). - When using REPLACE, the cursor is positioned at the
                                          Message 20 of 20 , Jun 2, 2012
                                            On Sa, 26 Mai 2012, Christian Brabandt wrote:
                                            > On Do, 24 Mai 2012, Christian Brabandt wrote:
                                            > > On Do, 24 Mai 2012, Bob von Knobloch wrote:
                                            > > > Hi, I've searched all over but can't find an answer. How can one perform
                                            > > > commands like ':%s/\n/\r\r/g' (replacing newlines or tabs etc.) in the
                                            > > > gui's 'find and replace' dialogue?
                                            > >
                                            > > Not possible, the replace text is escaped:
                                            > >
                                            > > ,----[ gui.c ]-
                                            > > |5276 ga_concat(&ga, (char_u *)"/");
                                            > > |5277 /* escape / and \ */
                                            > > |5278 p = vim_strsave_escaped(repl_text, (char_u *)"/\\");
                                            > > `----
                                            > >
                                            > > Here is an experimental patch against the gtk gui, that adds an extra
                                            > > flag, and allows to replace with special chars ,e.g. \t for Tab
                                            > >
                                            > > Looking at the dialog, it could possibly also get some more
                                            > > possibilities, e.g. a confirm/undo button, perhaps even more.
                                            >
                                            > Here is an even improved version of the patch, which adds the buttons
                                            > Undo and Redo to the gtk and motif version and which adds an extra
                                            > parameter whether to search/replace literally.


                                            One more update:
                                            - Replace should work better now (and works like in the current
                                            version of Gvim).
                                            - When using REPLACE, the cursor is positioned at the next match,
                                            but it doesn't take into account, that it could match at the
                                            current cursor position (so adding the flag SEARCH_START to the
                                            do_search function) (simple example, search for \. in the gui and
                                            replace it by A, you'll notice, it will only replace every other
                                            character).

                                            regards,
                                            Christian
                                            --

                                            --
                                            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
                                          Your message has been successfully submitted and would be delivered to recipients shortly.