Monday, May 13, 2019

Re: searching one word containing # with touch *

On ven., 2019-05-10 at 17:05 +0200, 'Andy Wokula' via vim_use wrote:
> Am 09.05.2019 um 20:20 schrieb Mathieu Roux:
> > I have so many questions:
> >
> > 1) map <F4> :set isk+=#-<Bar>normal *<CR>
> > Vim's help about "bar" does not allow me to understand what it
> > means.
>
> Relevant help sections are
> :h :bar
> :h <Bar>
>
> The bar character `|' separates most Ex-commands. And to escape the
> special meaning, there is a keycode form `<Bar>' for use in mappings.
>
> > 2) "adjusts the last search pattern set by the star command `*'" ->
> > what do you mean? * and F4 do different things, right?
>
> Right, `F4' executes `*' and then modifies its result.
>
> > 3) `\<#foo\>' -> why \< and \>... i really don't understand why you
> > write it. I want just to find #foo...?
>
> Because when searching for `#foo', you don't want to find `#foobar',
> right?
>
> There is yet another command, see
> :h g*
>
> --
> Andy
>
> --




1) So, i investigated more, and i tried to understand...
My question should be stupid, but i still dont understand why you talk
about <BAR> and \<...
It is a way to protect the string we search?
I guess that it is used in line
return substitute(a:1, '^\\<\k\@!\|\k\@<!\\>$', '', 'g')
in your script, Andy?




2) when i go to :h g*, i can read:


g* Like "*", but don't put "\<" and "\>" around
the word.
This makes the search also find matches that are not a
whole word. {not in Vi}

Really, i don't understand what it does. If i search "france", should
it find also "fran"? I don't understand.




3) Should it be possible, Andy, to modify your script to do the
following:
if i position my cursor on the line:
/abc/def/ghi/klm
of localisation, where
abc is the part
def is the chapter
ghi is the section
klm is the subsection

When i press F4 (or another touch) when my cursor is on "abc", i want
to search the lines beginning with "abc".
When i press F4 (or another touch) when my cursor is on "def", i want
to search the lines beginning with "abc/def".
When i press F4 (or another touch) when my cursor is on "ghi", i want
to search the lines beginning with "abc/def/ghi".
When i press F4 (or another touch) when my cursor is on "klm", i want
to search the lines beginning with"abc/def/ghi/klm".

Maybe it is not so difficult.





Best regards,
Mathieu

--
--
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@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/4c9bf0fcf3b3f65478cb3a7be1d429fd8bf34306.camel%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments: