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

Re: [patch] new cpo setting to make n/N search in the same direction

Expand Messages
  • Bram Moolenaar
    ... It seems the main objection is that the search history is affected. A generic solution to that would be a command modifier that does not store the pattern
    Message 1 of 11 , Feb 19, 2013
    View Source
    • 0 Attachment
      Christian Brabandt wrote:

      > > > Bram,
      > > > one of my annoyances with vim currently is, that when using n/N for
      > > > searching the direction depends on the previous search command. But I
      > > > usually forget if I initially used / or ? and then my brain gets stuck
      > > > whether I need to press n to search backwards or N. (e.g. I start a
      > > > search backwards using '?' and want to go further upwards and press
      > > > routinely 'N', but this moves back downwards again).
      > > >
      > > > I find it easier to know that n searches downwards while N searches
      > > > upwards, since I usually only know whether I want to go further down or
      > > > up, so I can reliably hit n to go further down and N to go further up to
      > > > the next match.
      > > >
      > > > This is what the attached patch enables, by adding the new flag 'N' to
      > > > the 'cpo' setting.
      > >
      > > Well, instead of adding an option, what about:
      > >
      > > :noremap n /<CR>
      > > :noremap N ?<CR>
      > >
      >
      > I wouldn't call this intuitively:
      > http://groups.google.com/group/vim_use/msg/6ff8586688e52b7d

      It seems the main objection is that the search history is affected.
      A generic solution to that would be a command modifier that does not
      store the pattern in history.

      We could also avoid storing an empty string in search history, even
      without a modifier. Searching for an empty string is useless.

      Actually, now that I try it I don't see the empty string being stored.
      Tim apparently used // instead of /. I don't see why.

      --
      DENNIS: Oh, very nice. King, eh! I expect you've got a palace and fine
      clothes and courtiers and plenty of food. And how d'you get that? By
      exploiting the workers! By hanging on to outdated imperialist dogma
      which perpetuates the social and economic differences in our society!
      "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • ZyX
      ... I would not call these attempts smart. noremap n Nn [v:searchforward] noremap N nN [v:searchforward] -- -- You received this message from
      Message 2 of 11 , Feb 19, 2013
      View Source
      • 0 Attachment
        > I wouldn't call this intuitively:
        > http://groups.google.com/group/vim_use/msg/6ff8586688e52b7d

        I would not call these attempts smart.

        noremap <expr> n 'Nn'[v:searchforward]
        noremap <expr> N 'nN'[v:searchforward]

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

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+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.