Am 2016-07-26 23:07, schrieb Bram Moolenaar:
Christian Brabandt wrote:

On Do, 14 Jul 2016, Yegappan Lakshmanan wrote:

> Hi all,
>
> My wish list for extending the Vim search feature:
>
> 1. When searching for a pattern, pressing a key at the search prompt
>     should jump to the next or previous match.
> 2. After jumping multiple times from the search prompt, pressing the
>     escape key should restore the cursor to the original cursor position
>     before the search.
> 3. Pressing backspace at the search prompt to erase a few characters and
>     then typing additional characters should start the search from the
>     previously matched position and not from the original position.
> 4. As characters are typed at the search prompt, all the matching text
>     should be highlighted (multiple matches). This can be turned on/off by
>     an option.
>
> I know there are some Vim plugins that support some of these features.
> But it will be useful to extend the built-in Vim feature to support these
> features.

Here is an experimental patch, that does this using Ctrl-N Ctrl-P in
search mode, when 'incsearch' is set. I am not super happy, about
depending on 'incsearch', but on the other hand, Ctrl-L already only
works when 'incsearch' is set. Also I am open to suggestions for
alternative keys, although I must admit, Ctrl-N/Ctrl-P seem like logical
choices.

It doesn't do everything you want, but it seems to work well for me. I
made it so, that pressing enter will remain at the current selected
match, which seems obvious and so I did not need to introduce a new key
function. Pressing ESC however will return the cursor to the position
where you started with the search.

This was just written very fast, I am pretty sure, there are some bugs
lying around and also tests are missing. But if this turns out to be
useful, I'll work more on it (and add a test of course).

Comments welcome,

This smells like an interactive search dialog.  Does this combine with
the search count?  So when pressing CTRL-N it goes from "match 2 of 23"
to "match 3 of 23"?  And when typing a character it goes to "match 1 of
8"?  (I would think the match index is counting from the original start
position).

You mean the search_stat patch from last week? No, I haven't looked,
how well those two features would work together.

Would it make sense to submit it as one single patch, adding several features
at once?

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

--- 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui