[patch] add skip-expression to search() function

56 views
Skip to first unread message

Christian Brabandt

unread,
Feb 24, 2016, 3:13:54 PM2/24/16
to vim...@vim.org
Hi,
attached patch, enables skip expressions similar to what searchpairpos()
already does for search() and searchpos() functions. Patch includes
updated documentation and an updated test.

I think this is useful, so you can search for e.g. "pattern" only in
syntax group "Comment" or the other way around. Currently there is no
way to do that, other than making a loop and manually checking each
match.

Best,
Christian
--
Begehrst du sie, so sagen sie, du seist vulgär wie alle anderen
Männer; begehrst du sie nicht, so sagen sie, du seist impotent.
-- Pitigrilli
search_skip.diff

David Fishburn

unread,
Feb 25, 2016, 8:17:13 AM2/25/16
to vim_dev
On Wed, Feb 24, 2016 at 3:13 PM, Christian Brabandt <c...@256bit.org> wrote:
Hi,
attached patch, enables skip expressions similar to what searchpairpos()
already does for search() and searchpos() functions. Patch includes
updated documentation and an updated test.

I think this is useful, so you can search for e.g. "pattern" only in
syntax group "Comment" or the other way around. Currently there is no
way to do that, other than making a loop and manually checking each
match.


I had to write a plugin to do this which goes a word at a time and checks the synID, so this would be useful. 

Christian Brabandt

unread,
Feb 25, 2016, 3:20:15 PM2/25/16
to vim_dev
Hi David!
Yeah, I want to use it for vim-airline. looping over search() calls
while evaluating the statusline will most probably result in nasty lags,
so I really need this.

Best,
Christian
--
Den Timon fragte jemand wegen des Unterrichts seiner Kinder.
Lasst sie, sagte der, unterrichten in dem, was sie niemals begreifen
werden.
-- Goethe, Maximen und Reflektionen, Nr. 380
Reply all
Reply to author
Forward
0 new messages