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

Re: Substitution of metacharacters

Expand Messages
  • 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 1 of 4 , 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_dev" 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 2 of 4 , 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_dev" 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 3 of 4 , 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_dev" 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 4 of 4 , 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_dev" 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.