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

vim highlights the replaced characters after doing a "u"

Expand Messages
  • pmu
    Hi, I am using gvim version 7.3 32 Bit on 64 Bit Windows 7. After I use the command :%s/ /,/g which basically replaces every instance of space with a comma,
    Message 1 of 5 , Jul 11, 2013
      Hi,

      I am using gvim version 7.3 32 Bit on 64 Bit Windows 7.

      After I use the command ":%s/ /,/g" which basically replaces every instance
      of space with a comma, the replacement works fine.

      However, right after that, if I press "u" to undo the replacement, it does
      replace the "," with space, however, for some reason, it highlights the
      space.

      My _vimrc has highlighting enabled.

      Is this a feature or a bug? Not that its causing a big issue, just that so
      many highlights sort of become an eyesore.

      Any help or suggestion will be helpful.

      Regards,
      Pritesh <http://vim.1045645.n5.nabble.com/file/n5716409/vim_hl.jpg>



      --
      View this message in context: http://vim.1045645.n5.nabble.com/vim-highlights-the-replaced-characters-after-doing-a-u-tp5716409.html
      Sent from the Vim - General mailing list archive at Nabble.com.

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

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • glts
      ... Use :nohls to turn off the highlighting. See :h :nohls. Best, -- -- You received this message from the vim_use maillist. Do not top-post! Type your reply
      Message 2 of 5 , Jul 11, 2013
        On Thursday, July 11, 2013 4:48:30 PM UTC+2, Pritesh Ugrankar wrote:
        > After I use the command ":%s/ /,/g" which basically replaces every instance
        > of space with a comma, the replacement works fine.
        >
        > However, right after that, if I press "u" to undo the replacement, it does
        > replace the "," with space, however, for some reason, it highlights the
        > space.
        >
        > My _vimrc has highlighting enabled.
        >
        > Is this a feature or a bug? Not that its causing a big issue, just that so
        > many highlights sort of become an eyesore.

        Use :nohls to turn off the highlighting.

        See :h :nohls.

        Best,

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

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Ben Fritz
        ... Whenever you use an :s command, it sets the last search pattern just like searching with / will set the last search pattern. If you have hlsearch set in
        Message 3 of 5 , Jul 11, 2013
          On Thursday, July 11, 2013 9:48:30 AM UTC-5, Pritesh Ugrankar wrote:
          > Hi,
          >
          >
          >
          > I am using gvim version 7.3 32 Bit on 64 Bit Windows 7.
          >
          >
          >
          > After I use the command ":%s/ /,/g" which basically replaces every instance
          >
          > of space with a comma, the replacement works fine.
          >
          >
          >
          > However, right after that, if I press "u" to undo the replacement, it does
          >
          > replace the "," with space, however, for some reason, it highlights the
          >
          > space.
          >
          >
          >
          > My _vimrc has highlighting enabled.
          >
          >
          >
          > Is this a feature or a bug? Not that its causing a big issue, just that so
          >
          > many highlights sort of become an eyesore.
          >

          Whenever you use an :s command, it sets the last search pattern just like searching with / will set the last search pattern.

          If you have 'hlsearch' set in your .vimrc, Vim will always highlight the last search pattern.

          So if you do a global substitute, then undo the substitution, then everywhere the substitute matched now matches the last search pattern and gets highlighted.

          It's a feature. One you enabled in your .vimrc.

          >
          >
          > Any help or suggestion will be helpful.
          >

          After undoing the change, just issue the command :nohlsearch. This temporarily turns off search highlighting (until your next search). You could even map a key to do that if you do it a lot.

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

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Christian Brabandt
          ... Personally, I don t think this is a bug, since after the undo, the matched pattern can be found and will therefore be highlighted. Since I also get annoyed
          Message 4 of 5 , Jul 11, 2013
            On Thu, July 11, 2013 16:48, pmu wrote:
            > Hi,
            >
            > I am using gvim version 7.3 32 Bit on 64 Bit Windows 7.
            >
            > After I use the command ":%s/ /,/g" which basically replaces every
            > instance
            > of space with a comma, the replacement works fine.
            >
            > However, right after that, if I press "u" to undo the replacement, it does
            > replace the "," with space, however, for some reason, it highlights the
            > space.
            >
            > My _vimrc has highlighting enabled.
            >
            > Is this a feature or a bug? Not that its causing a big issue, just that so
            > many highlights sort of become an eyesore.
            >
            > Any help or suggestion will be helpful.
            >

            Personally, I don't think this is a bug, since after the undo, the matched
            pattern can be found and will therefore be highlighted.

            Since I also get annoyed by the search highlighting usually, I mapped <C-L>
            to also clear the search highlighting. It seems so logacially, that
            a redraw should also clear the last search pattern highlight, that I
            don't understand why this is the default.

            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

            ---
            You received this message because you are subscribed to the Google Groups "vim_use" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • pmu
            Hi All, Thank you very much for replying. This my 5th day with VIM so learning a lot. Thanks once again for your help. -- View this message in context:
            Message 5 of 5 , Jul 11, 2013
              Hi All,

              Thank you very much for replying.

              This my 5th day with VIM so learning a lot.

              Thanks once again for your help.



              --
              View this message in context: http://vim.1045645.n5.nabble.com/vim-highlights-the-replaced-characters-after-doing-a-u-tp5716409p5716421.html
              Sent from the Vim - General mailing list archive at Nabble.com.

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

              ---
              You received this message because you are subscribed to the Google Groups "vim_use" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
            Your message has been successfully submitted and would be delivered to recipients shortly.