searching one word containing # with touch *

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

searching one word containing # with touch *

Mathieu
Hello,
I would like to search the word under my prompt on vim. For this, i can press touch *.
But, if the word i want to search is #foo, as an exemple, vim only searches word foo (without hashtag).
In fact, hashtag is not considered in the word, which is confirmed when i try to go to the next word from # with w.
Do you know how i can search effectively #titi by pressing * on my keyboard?
Thanks.
Mathieu Roux

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Tony Mechelynck
On Sun, May 5, 2019 at 6:44 PM Mathieu Roux <[hidden email]> wrote:
>
> Hello,
> I would like to search the word under my prompt on vim. For this, i can press touch *.
> But, if the word i want to search is #foo, as an exemple, vim only searches word foo (without hashtag).
> In fact, hashtag is not considered in the word, which is confirmed when i try to go to the next word from # with w.
> Do you know how i can search effectively #titi by pressing * on my keyboard?
> Thanks.
> Mathieu Roux

see :help *

Best regards,
Tony.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Mathieu
On dim., 2019-05-05 at 18:50 +0200, Tony Mechelynck wrote:

> On Sun, May 5, 2019 at 6:44 PM Mathieu Roux <[hidden email]>
> wrote:
> >
> > Hello,
> > I would like to search the word under my prompt on vim. For this, i
> > can press touch *.
> > But, if the word i want to search is #foo, as an exemple, vim only
> > searches word foo (without hashtag).
> > In fact, hashtag is not considered in the word, which is confirmed
> > when i try to go to the next word from # with w.
> > Do you know how i can search effectively #titi by pressing * on my
> > keyboard?
> > Thanks.
> > Mathieu Roux
>
> see :help *
>
> Best regards,
> Tony.
>
> --


Tony,
Thanks.
But how can i change keywords just for # and - (i want for exemple
#foo-bar to be just one word)? i tried before but i did not succeed.
The problem is that i also want to use tags with CTRL + ], so maybe i
cannot do
        set iskeyword=""
as far as i understand.
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Gary Johnson-4
On 2019-05-05, Mathieu Roux wrote:

> On dim., 2019-05-05 at 18:50 +0200, Tony Mechelynck wrote:
> > On Sun, May 5, 2019 at 6:44 PM Mathieu Roux wrote:
> > >
> > > Hello,
> > > I would like to search the word under my prompt on vim. For this, i
> > > can press touch *.
> > > But, if the word i want to search is #foo, as an exemple, vim only
> > > searches word foo (without hashtag).
> > > In fact, hashtag is not considered in the word, which is confirmed
> > > when i try to go to the next word from # with w.
> > > Do you know how i can search effectively #titi by pressing * on my
> > > keyboard?
> > > Thanks.
> > > Mathieu Roux
> >
> > see :help *

> But how can i change keywords just for # and - (i want for exemple
> #foo-bar to be just one word)? i tried before but i did not succeed.
> The problem is that i also want to use tags with CTRL + ], so maybe i
> cannot do
> set iskeyword=""
> as far as i understand.

    :set iskeyword+=#
    :set iskeyword+=-

seems to do it.

Regards,
Gary

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Tony Mechelynck
On Sun, May 5, 2019 at 9:35 PM Gary Johnson <[hidden email]> wrote:

>
> On 2019-05-05, Mathieu Roux wrote:
> > On dim., 2019-05-05 at 18:50 +0200, Tony Mechelynck wrote:
> > > On Sun, May 5, 2019 at 6:44 PM Mathieu Roux wrote:
> > > >
> > > > Hello,
> > > > I would like to search the word under my prompt on vim. For this, i
> > > > can press touch *.
> > > > But, if the word i want to search is #foo, as an exemple, vim only
> > > > searches word foo (without hashtag).
> > > > In fact, hashtag is not considered in the word, which is confirmed
> > > > when i try to go to the next word from # with w.
> > > > Do you know how i can search effectively #titi by pressing * on my
> > > > keyboard?
> > > > Thanks.
> > > > Mathieu Roux
> > >
> > > see :help *
>
> > But how can i change keywords just for # and - (i want for exemple
> > #foo-bar to be just one word)? i tried before but i did not succeed.
> > The problem is that i also want to use tags with CTRL + ], so maybe i
> > cannot do
> >       set iskeyword=""
> > as far as i understand.
>
>     :set iskeyword+=#
>     :set iskeyword+=-
>
> seems to do it.
>
> Regards,
> Gary

And if you want to do it easily and reversibly, you can assign it to a
key: e.g. (untested)

        :map <F4> :set isk+=#-<Bar>normal *<CR>
        :map <S-F4> :set isk-=# isk-=-<Bar>normal <C-]><CR>

Best regards,
Tony.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Mathieu
In reply to this post by Gary Johnson-4
On dim., 2019-05-05 at 12:35 -0700, Gary Johnson wrote:

> On 2019-05-05, Mathieu Roux wrote:
> > On dim., 2019-05-05 at 18:50 +0200, Tony Mechelynck wrote:
> > > On Sun, May 5, 2019 at 6:44 PM Mathieu Roux wrote:
> > > >
> > > > Hello,
> > > > I would like to search the word under my prompt on vim. For
> > > > this, i
> > > > can press touch *.
> > > > But, if the word i want to search is #foo, as an exemple, vim
> > > > only
> > > > searches word foo (without hashtag).
> > > > In fact, hashtag is not considered in the word, which is
> > > > confirmed
> > > > when i try to go to the next word from # with w.
> > > > Do you know how i can search effectively #titi by pressing * on
> > > > my
> > > > keyboard?
> > > > Thanks.
> > > > Mathieu Roux
> > >
> > > see :help *
> > But how can i change keywords just for # and - (i want for exemple
> > #foo-bar to be just one word)? i tried before but i did not
> > succeed.
> > The problem is that i also want to use tags with CTRL + ], so maybe
> > i
> > cannot do
> > set iskeyword=""
> > as far as i understand.
>
>     :set iskeyword+=#
>     :set iskeyword+=-
>
> seems to do it.
>
> Regards,
> Gary
>
> --

Great! it seems to work...!
Maybe you also know how i can search one whole lign with vim?
Of course, i can use visual mode to select the lign, and then press *,
but is there one faster solution?
Best regards,
Mathieu Roux

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Gary Johnson-4
On 2019-05-06, Mathieu Roux wrote:

> On dim., 2019-05-05 at 12:35 -0700, Gary Johnson wrote:
> > On 2019-05-05, Mathieu Roux wrote:
> > > On dim., 2019-05-05 at 18:50 +0200, Tony Mechelynck wrote:
> > > > On Sun, May 5, 2019 at 6:44 PM Mathieu Roux wrote:
> > > > >
> > > > > Hello,
> > > > > I would like to search the word under my prompt on vim. For
> > > > > this, i
> > > > > can press touch *.
> > > > > But, if the word i want to search is #foo, as an exemple, vim
> > > > > only
> > > > > searches word foo (without hashtag).
> > > > > In fact, hashtag is not considered in the word, which is
> > > > > confirmed
> > > > > when i try to go to the next word from # with w.
> > > > > Do you know how i can search effectively #titi by pressing * on
> > > > > my
> > > > > keyboard?
> > > > > Thanks.
> > > > > Mathieu Roux
> > > >
> > > > see :help *
> > > But how can i change keywords just for # and - (i want for exemple
> > > #foo-bar to be just one word)? i tried before but i did not
> > > succeed.
> > > The problem is that i also want to use tags with CTRL + ], so maybe
> > > i
> > > cannot do
> > >   set iskeyword=""
> > > as far as i understand.
> >
> >     :set iskeyword+=#
> >     :set iskeyword+=-
> >
> > seems to do it.
> >
> > Regards,
> > Gary
> >
> > --
>
> Great! it seems to work...!
> Maybe you also know how i can search one whole lign with vim?
> Of course, i can use visual mode to select the lign, and then press *,
> but is there one faster solution?

For that, I usually do

    0v$*

If you wanted something faster, you could map that to some unused
key sequence or to a function key.

I should add that I have * in visual mode mapped to a sequence of
commands that escape special characters in the visually-selected
region so that those characters don't corrupt the search pattern.

    vnoremap <silent> * :<C-U>
              \let old_reg=getreg('v')<bar>
              \let old_regmode=getregtype('v')<cr>
              \gv"vy/<C-R><C-R>=substitute(
              \escape(@v, '\\/.*$^~[]'), '\n', '\\n', 'g')<cr><cr>zv
              \:call setreg('v', old_reg, old_regmode)<cr>

To give credit where credit is due, that and some related mappings
were posted to the vim list in 2003 by Jürgen Krämer.  I may have
made some minor modifications since.

Regards,
Gary

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Andy Wokula
In reply to this post by Tony Mechelynck
Am 06.05.2019 um 15:33 schrieb Tony Mechelynck:

> On Sun, May 5, 2019 at 9:35 PM Gary Johnson <[hidden email]> wrote:
>>
>> On 2019-05-05, Mathieu Roux wrote:
>>> On dim., 2019-05-05 at 18:50 +0200, Tony Mechelynck wrote:
>>>> On Sun, May 5, 2019 at 6:44 PM Mathieu Roux wrote:
>>>>>
>>>>> Hello,
>>>>> I would like to search the word under my prompt on vim. For this, i
>>>>> can press touch *.
>>>>> But, if the word i want to search is #foo, as an exemple, vim only
>>>>> searches word foo (without hashtag).
>>>>> In fact, hashtag is not considered in the word, which is confirmed
>>>>> when i try to go to the next word from # with w.
>>>>> Do you know how i can search effectively #titi by pressing * on my
>>>>> keyboard?
>>>>> Thanks.
>>>>> Mathieu Roux
>>>>
>>>> see :help *
>>
>>> But how can i change keywords just for # and - (i want for exemple
>>> #foo-bar to be just one word)? i tried before but i did not succeed.
>>> The problem is that i also want to use tags with CTRL + ], so maybe i
>>> cannot do
>>>        set iskeyword=""
>>> as far as i understand.
>>
>>      :set iskeyword+=#
>>      :set iskeyword+=-
>>
>> seems to do it.
>>
>> Regards,
>> Gary
>
> And if you want to do it easily and reversibly, you can assign it to a
> key: e.g. (untested)
>
>          :map <F4> :set isk+=#-<Bar>normal *<CR>
>          :map <S-F4> :set isk-=# isk-=-<Bar>normal <C-]><CR>
>
> Best regards,
> Tony.

Maybe it's a little more complicated.

When you add characters to 'isk' with the star command `*'
and again remove them when going to a tag with Ctrl-],
then suddenly `#foo' is no longer found, because the pattern
     \<#foo\>
ceases to match (`\<' only matches before an 'isk' character).
Searching for
     #foo\>
instead should be fine.

almost got a plugin out of this
https://gist.github.com/Houl/7b3f46c42fbb8fbe3d1d6bd54204ab51

--
Andy

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Christian Brabandt

On Mo, 06 Mai 2019, 'Andy Wokula' via vim_use wrote:

> When you add characters to 'isk' with the star command `*'
> and again remove them when going to a tag with Ctrl-],
> then suddenly `#foo' is no longer found, because the pattern
>     \<#foo\>
> ceases to match (`\<' only matches before an 'isk' character).
> Searching for
>     #foo\>
> instead should be fine.

Indeed. I usually use the g* command in the case (although it does
something slightly different) I need this.

Best,
Christian
--
Moral - meist Predigt dessen, der nicht daran glaubt, für den, der
sich nicht darum kümmert.
                -- Karlheinz Deschner

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Anand Hariharan-2
In reply to this post by Gary Johnson-4


On Mon, May 6, 2019 at 1:05 PM Gary Johnson <[hidden email]> wrote:

> On 2019-05-06, Mathieu Roux wrote:
> >
> > Great! it seems to work...!
> > Maybe you also know how i can search one whole lign with vim?
> > Of course, i can use visual mode to select the lign, and then press *,
> > but is there one faster solution?
>
> For that, I usually do
>
>     0v$*
>

The key sequence of 0v$ could be replaced with just V.

That said, I do not think an * over a visual selection would search for the entire visual selection.

best,
- Anand

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Gary Johnson-4
On 2019-05-06, Anand Hariharan wrote:

>
> On Mon, May 6, 2019 at 1:05 PM Gary Johnson wrote:
> > On 2019-05-06, Mathieu Roux wrote:
> > >
> > > Great! it seems to work...!
> > > Maybe you also know how i can search one whole lign with vim?
> > > Of course, i can use visual mode to select the lign, and then press *,
> > > but is there one faster solution?
> >
> > For that, I usually do
> >
> >     0v$*
> >
>
> The key sequence of 0v$ could be replaced with just V.

You're right.  I'm careful about the difference between Y and 0y$
(the former includes the end-of-line while the latter does not) and
assumed that V and 0v$ differed the same way.  They do not.

> That said, I do not think an * over a visual selection would search for the
> entire visual selection.

You're right again.  I've been using my remappings of the *, # and
g* commands for so long that I forgot about all the differences
between them and the originals.

Thanks for the corrections.  Sorry for sowing confusion.

Regards,
Gary

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Mathieu
In reply to this post by Tony Mechelynck
On lun., 2019-05-06 at 15:33 +0200, Tony Mechelynck wrote:

> On Sun, May 5, 2019 at 9:35 PM Gary Johnson <[hidden email]>
> wrote:
> >
> > On 2019-05-05, Mathieu Roux wrote:
> > > On dim., 2019-05-05 at 18:50 +0200, Tony Mechelynck wrote:
> > > > On Sun, May 5, 2019 at 6:44 PM Mathieu Roux wrote:
> > > > >
> > > > > Hello,
> > > > > I would like to search the word under my prompt on vim. For
> > > > > this, i
> > > > > can press touch *.
> > > > > But, if the word i want to search is #foo, as an exemple, vim
> > > > > only
> > > > > searches word foo (without hashtag).
> > > > > In fact, hashtag is not considered in the word, which is
> > > > > confirmed
> > > > > when i try to go to the next word from # with w.
> > > > > Do you know how i can search effectively #titi by pressing *
> > > > > on my
> > > > > keyboard?
> > > > > Thanks.
> > > > > Mathieu Roux
> > > >
> > > > see :help *
> > > But how can i change keywords just for # and - (i want for
> > > exemple
> > > #foo-bar to be just one word)? i tried before but i did not
> > > succeed.
> > > The problem is that i also want to use tags with CTRL + ], so
> > > maybe i
> > > cannot do
> > >       set iskeyword=""
> > > as far as i understand.
> >
> >     :set iskeyword+=#
> >     :set iskeyword+=-
> >
> > seems to do it.
> >
> > Regards,
> > Gary
>
> And if you want to do it easily and reversibly, you can assign it to
> a
> key: e.g. (untested)
>
>         :map <F4> :set isk+=#-<Bar>normal *<CR>
>         :map <S-F4> :set isk-=# isk-=-<Bar>normal <C-]><CR>
>
> Best regards,
> Tony.
>
> --


Please, can you explain it to me.

In help i saw about "bar":


                                                        bar
|                       To screen column [count] in the current line.
                        exclusive motion.  Ceci n'est pas une pipe.

it does not help me 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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/35893753ac3befbfded8976843e7cebcf51ed618.camel%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Mathieu
In reply to this post by Andy Wokula
On lun., 2019-05-06 at 20:52 +0200, 'Andy Wokula' via vim_use wrote:

> Am 06.05.2019 um 15:33 schrieb Tony Mechelynck:
> > On Sun, May 5, 2019 at 9:35 PM Gary Johnson <[hidden email]>
> > wrote:
> > >
> > > On 2019-05-05, Mathieu Roux wrote:
> > > > On dim., 2019-05-05 at 18:50 +0200, Tony Mechelynck wrote:
> > > > > On Sun, May 5, 2019 at 6:44 PM Mathieu Roux wrote:
> > > > > >
> > > > > > Hello,
> > > > > > I would like to search the word under my prompt on vim. For
> > > > > > this, i
> > > > > > can press touch *.
> > > > > > But, if the word i want to search is #foo, as an exemple,
> > > > > > vim only
> > > > > > searches word foo (without hashtag).
> > > > > > In fact, hashtag is not considered in the word, which is
> > > > > > confirmed
> > > > > > when i try to go to the next word from # with w.
> > > > > > Do you know how i can search effectively #titi by pressing
> > > > > > * on my
> > > > > > keyboard?
> > > > > > Thanks.
> > > > > > Mathieu Roux
> > > > >
> > > > > see :help *
> > > > But how can i change keywords just for # and - (i want for
> > > > exemple
> > > > #foo-bar to be just one word)? i tried before but i did not
> > > > succeed.
> > > > The problem is that i also want to use tags with CTRL + ], so
> > > > maybe i
> > > > cannot do
> > > >        set iskeyword=""
> > > > as far as i understand.
> > >
> > >      :set iskeyword+=#
> > >      :set iskeyword+=-
> > >
> > > seems to do it.
> > >
> > > Regards,
> > > Gary
> >
> > And if you want to do it easily and reversibly, you can assign it
> > to a
> > key: e.g. (untested)
> >
> >          :map <F4> :set isk+=#-<Bar>normal *<CR>
> >          :map <S-F4> :set isk-=# isk-=-<Bar>normal <C-]><CR>
> >
> > Best regards,
> > Tony.
>
> Maybe it's a little more complicated.
>
> When you add characters to 'isk' with the star command `*'
> and again remove them when going to a tag with Ctrl-],
> then suddenly `#foo' is no longer found, because the pattern
>      \<#foo\>
> ceases to match (`\<' only matches before an 'isk' character).
> Searching for
>      #foo\>
> instead should be fine.
>
> almost got a plugin out of this
> https://gist.github.com/Houl/7b3f46c42fbb8fbe3d1d6bd54204ab51
>
> --
> Andy
>
> --


Waaaaaaa! you worked so much for me!
I am sorry not be intelligent enough just to understand how to use your
file? Should i copy in my ~/.vimrc file?
And what does it aim to do?

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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/59ee0b6b0317b79c3734b2f9b2ad1984832bb974.camel%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Mathieu
In reply to this post by Christian Brabandt
So, without modifying my isk, it seams that g* for #, but not for -.
Correct?

It means that if i do g* on #foo-bar, it search #foo, right?




On lun., 2019-05-06 at 22:12 +0200, Christian Brabandt wrote:

> On Mo, 06 Mai 2019, 'Andy Wokula' via vim_use wrote:
>
> > When you add characters to 'isk' with the star command `*'
> > and again remove them when going to a tag with Ctrl-],
> > then suddenly `#foo' is no longer found, because the pattern
> >     \<#foo\>
> > ceases to match (`\<' only matches before an 'isk' character).
> > Searching for
> >     #foo\>
> > instead should be fine.
>
> Indeed. I usually use the g* command in the case (although it does
> something slightly different) I need this.
>
> Best,
> Christian
> --
> Moral - meist Predigt dessen, der nicht daran glaubt, für den, der
> sich nicht darum kümmert.
> -- Karlheinz Deschner
>
> --

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/bfa57d83986df1f45ffeefd6e754691ca1658b3a.camel%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Mathieu
In reply to this post by Gary Johnson-4
On lun., 2019-05-06 at 11:05 -0700, Gary Johnson wrote:

> On 2019-05-06, Mathieu Roux wrote:
> > On dim., 2019-05-05 at 12:35 -0700, Gary Johnson wrote:
> > > On 2019-05-05, Mathieu Roux wrote:
> > > > On dim., 2019-05-05 at 18:50 +0200, Tony Mechelynck wrote:
> > > > > On Sun, May 5, 2019 at 6:44 PM Mathieu Roux wrote:
> > > > > >
> > > > > > Hello,
> > > > > > I would like to search the word under my prompt on vim. For
> > > > > > this, i
> > > > > > can press touch *.
> > > > > > But, if the word i want to search is #foo, as an exemple,
> > > > > > vim
> > > > > > only
> > > > > > searches word foo (without hashtag).
> > > > > > In fact, hashtag is not considered in the word, which is
> > > > > > confirmed
> > > > > > when i try to go to the next word from # with w.
> > > > > > Do you know how i can search effectively #titi by pressing
> > > > > > * on
> > > > > > my
> > > > > > keyboard?
> > > > > > Thanks.
> > > > > > Mathieu Roux
> > > > >
> > > > > see :help *
> > > >
> > > > But how can i change keywords just for # and - (i want for
> > > > exemple
> > > > #foo-bar to be just one word)? i tried before but i did not
> > > > succeed.
> > > > The problem is that i also want to use tags with CTRL + ], so
> > > > maybe
> > > > i
> > > > cannot do
> > > >   set iskeyword=""
> > > > as far as i understand.
> > >
> > >     :set iskeyword+=#
> > >     :set iskeyword+=-
> > >
> > > seems to do it.
> > >
> > > Regards,
> > > Gary
> > >
> > > --
> >
> > Great! it seems to work...!
> > Maybe you also know how i can search one whole lign with vim?
> > Of course, i can use visual mode to select the lign, and then press
> > *,
> > but is there one faster solution?
>
> For that, I usually do
>
>     0v$*
>
> If you wanted something faster, you could map that to some unused
> key sequence or to a function key.
>
> I should add that I have * in visual mode mapped to a sequence of
> commands that escape special characters in the visually-selected
> region so that those characters don't corrupt the search pattern.
>
>     vnoremap <silent> * :<C-U>
>               \let old_reg=getreg('v')<bar>
>               \let old_regmode=getregtype('v')<cr>
>               \gv"vy/<C-R><C-R>=substitute(
>               \escape(@v, '\\/.*$^~[]'), '\n', '\\n', 'g')<cr><cr>zv
>               \:call setreg('v', old_reg, old_regmode)<cr>
>
> To give credit where credit is due, that and some related mappings
> were posted to the vim list in 2003 by Jürgen Krämer.  I may have
> made some minor modifications since.
>
> Regards,
> Gary
>
> --


When i do 0v$*, i get (in french):
"E348: Aucune chaîne sous le curseur"


--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/3c7e5b2d2b0aa7286113a266cb6ed4be7cca4126.camel%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Mathieu
In reply to this post by Gary Johnson-4
On lun., 2019-05-06 at 16:42 -0700, Gary Johnson wrote:

> On 2019-05-06, Anand Hariharan wrote:
> >
> > On Mon, May 6, 2019 at 1:05 PM Gary Johnson wrote:
> > > On 2019-05-06, Mathieu Roux wrote:
> > > >
> > > > Great! it seems to work...!
> > > > Maybe you also know how i can search one whole lign with vim?
> > > > Of course, i can use visual mode to select the lign, and then
> > > > press *,
> > > > but is there one faster solution?
> > >
> > > For that, I usually do
> > >
> > >     0v$*
> > >
> >
> > The key sequence of 0v$ could be replaced with just V.
>
> You're right.  I'm careful about the difference between Y and 0y$
> (the former includes the end-of-line while the latter does not) and
> assumed that V and 0v$ differed the same way.  They do not.
>
> > That said, I do not think an * over a visual selection would search
> > for the
> > entire visual selection.
>
> You're right again.  I've been using my remappings of the *, # and
> g* commands for so long that I forgot about all the differences
> between them and the originals.
>
> Thanks for the corrections.  Sorry for sowing confusion.
>
> Regards,
> Gary
>
> --


Thanks to everybody for your help.

I try to analyse your answers. But maybe if i tell you more about what
i want to do, it can clarify the talk.


1) I have a big text file, which is composed of several articles.
For each article, i want to give several keywords.
#foo
#bar
#titi
And when i am on one word of this type and i press * (or another
touch), i want to move to the other articles owning this keyword.


2) First i wanted to do it with "real tags" (with a tag-file made by
ctag, and with ctrl-]), but if i understand good, it does not work like
this.
But if i understand good, i can press ctrl-] on the title of an article
voir titre-de-larticle
, to go to the (UNIQUE) article which has this title, after making tag-
file with:

!/bin/bash
/usr/bin/ctags   \
-f ./tags \
--langdef=diese \
--language-force=diese \
--regex-diese="/^Article: ([a-zA-Z0-9_]+)/\1/" \
./v

No possibility to use "real tags" for 1). Is that correct?


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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/e50539c6f4df077c56d05d7727933406eebc35c3.camel%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Erik Christiansen
On 07.05.19 21:19, Mathieu Roux wrote:

> 2) First i wanted to do it with "real tags" (with a tag-file made by
> ctag, and with ctrl-]), but if i understand good, it does not work like
> this.
> But if i understand good, i can press ctrl-] on the title of an article
> voir titre-de-larticle
> , to go to the (UNIQUE) article which has this title, after making tag-
> file with:
>
> !/bin/bash
> /usr/bin/ctags   \
> -f ./tags \
> --langdef=diese \
> --language-force=diese \
> --regex-diese="/^Article: ([a-zA-Z0-9_]+)/\1/" \
> ./v
>
> No possibility to use "real tags" for 1). Is that correct?

How that fell short is not clear, but if ctags is unwieldy for
generating custom¹ tags, then there are alternatives. Around twenty
years ago I quickly cobbled this together:

#!/bin/sh

# awktags creates an elementary tags file for awk scripts

nawk '
/^function / {
        printf("%s\t'$1'\t/^%s/\n",substr($2,1,index($2,"(")-1), \
                        substr($0,1,index($0,"(")))
}
' $1 > "tags_file"

That's not an endorsement for nawk - I use the gawk variant of awk
when it's available.

It's only necessary to generate a tags file which vim likes, see
:help tags-file-format

If tags for multiple text objects are desired, then just add another
/regex/ and another {...} action - job done. The awk manpage is very
extensive, but any text processing language would do. Heck, a keen
vimscripter could probably do it within vim, I'd wager. (Sorry, forget I
said that. :)

The format generated by the above one-liner is:

define_signal sdl/old/bin/sdlpp /^function define_signal(/
define_state sdl/old/bin/sdlpp /^function define_state(/
indelta  sdl/old/bin/sdlpp /^function indelta(/
deferror sdl/old/bin/sdlpp /^function deferror(/

The fields; tag, file, ex-search; are separated by a single tab.
AFAIR vim was happy with that, and it's consistent with almost current
vim help.

If tags_file is not where vim expects, then its location can be
set in vim:

:set tags=/path/to/tags_file

Erik

¹ I've only used it to generate 'C' tags.

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190508074645.GB3499%40ratatosk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Mathieu
In fact, i don't know enough about awk to do it...

I just would like something which looks like vim help.
When i do :help in vim, for exemple, i can see words in color.
Then same i would like. Several articles, and links in color blue.

for exemple:

6. :syntax arguments                                    :syn-arguments

display                                                 :syn-display

skipwhite                                               :syn-skipwhite



I don't know how it can works...


I would like something like that in my document when i open with vim:

"The sky is blue. See Sky blue. The grass is green."

With the words "Sky blue" in color blue, and when i do ctrl+], i go to
the article

Sky Blue
blablabla

I don't even know if tags are adapted for this.
I don't know how a stream editor can know automatically that SKY BLUE
should be a link to the article "Sky blue", and not "The grass" for
exemple.
Saying it differently, i want links inside my document opened with vim,
the same i can do in html with one htm page for one article. But i
prefer everything in the same text file, and using vim. Is it possible?
Maybe there is one tool all designed for this?

Best regards,
Mathieu











On mer., 2019-05-08 at 17:46 +1000, Erik Christiansen wrote:

> On 07.05.19 21:19, Mathieu Roux wrote:
> > 2) First i wanted to do it with "real tags" (with a tag-file made
> > by
> > ctag, and with ctrl-]), but if i understand good, it does not work
> > like
> > this.
> > But if i understand good, i can press ctrl-] on the title of an
> > article
> > voir titre-de-larticle
> > , to go to the (UNIQUE) article which has this title, after making
> > tag-
> > file with:
> >
> > !/bin/bash
> > /usr/bin/ctags   \
> > -f ./tags \
> > --langdef=diese \
> > --language-force=diese \
> > --regex-diese="/^Article: ([a-zA-Z0-9_]+)/\1/" \
> > ./v
> >
> > No possibility to use "real tags" for 1). Is that correct?
>
> How that fell short is not clear, but if ctags is unwieldy for
> generating custom¹ tags, then there are alternatives. Around twenty
> years ago I quickly cobbled this together:
>
> #!/bin/sh
>
> # awktags creates an elementary tags file for awk scripts
>
> nawk '
> /^function / {
> printf("%s\t'$1'\t/^%s/\n",substr($2,1,index($2,"(")-1), \
> substr($0,1,index($0,"(")))
> }
> ' $1 > "tags_file"
>
> That's not an endorsement for nawk - I use the gawk variant of awk
> when it's available.
>
> It's only necessary to generate a tags file which vim likes, see
> :help tags-file-format
>
> If tags for multiple text objects are desired, then just add another
> /regex/ and another {...} action - job done. The awk manpage is very
> extensive, but any text processing language would do. Heck, a keen
> vimscripter could probably do it within vim, I'd wager. (Sorry,
> forget I
> said that. :)
>
> The format generated by the above one-liner is:
>
> define_signal sdl/old/bin/sdlpp /^function define_signal(/
> define_state sdl/old/bin/sdlpp /^function define_state(/
> indelta  sdl/old/bin/sdlpp /^function indelta(/
> deferror sdl/old/bin/sdlpp /^function deferror(/
>
> The fields; tag, file, ex-search; are separated by a single tab.
> AFAIR vim was happy with that, and it's consistent with almost
> current
> vim help.
>
> If tags_file is not where vim expects, then its location can be
> set in vim:
>
> :set tags=/path/to/tags_file
>
> Erik
>
> ¹ I've only used it to generate 'C' tags.
>
> --

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/729e50a5dcf2263f96ac986aacf4ffca72f0b46d.camel%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Andy Wokula
In reply to this post by Mathieu
Am 07.05.2019 um 20:52 schrieb Mathieu Roux:

> On lun., 2019-05-06 at 20:52 +0200, 'Andy Wokula' via vim_use wrote:
>> Am 06.05.2019 um 15:33 schrieb Tony Mechelynck:
>>> On Sun, May 5, 2019 at 9:35 PM Gary Johnson <[hidden email]>
>>> wrote:
>>>>
>>>> On 2019-05-05, Mathieu Roux wrote:
>>>>> On dim., 2019-05-05 at 18:50 +0200, Tony Mechelynck wrote:
>>>>>> On Sun, May 5, 2019 at 6:44 PM Mathieu Roux wrote:
>>>>>>>
>>>>>>> Hello,
>>>>>>> I would like to search the word under my prompt on vim. For
>>>>>>> this, i can press touch *.  But, if the word i want to search is
>>>>>>> #foo, as an exemple, vim only searches word foo (without
>>>>>>> hashtag).  In fact, hashtag is not considered in the word, which
>>>>>>> is confirmed when i try to go to the next word from # with w.
>>>>>>> Do you know how i can search effectively #titi by pressing * on
>>>>>>> my keyboard?
>>>>>>> Thanks.
>>>>>>> Mathieu Roux
>>>>>>
>>>>>> see :help *
>>>>> But how can i change keywords just for # and - (i want for exemple
>>>>> #foo-bar to be just one word)? i tried before but i did not
>>>>> succeed.  The problem is that i also want to use tags with CTRL+],
>>>>> so maybe i cannot do
>>>>>         set iskeyword=""
>>>>> as far as i understand.
>>>>
>>>>       :set iskeyword+=#
>>>>       :set iskeyword+=-
>>>>
>>>> seems to do it.
>>>>
>>>> Regards,
>>>> Gary
>>>
>>> And if you want to do it easily and reversibly, you can assign it to
>>> a key: e.g. (untested)
>>>
>>>           :map <F4> :set isk+=#-<Bar>normal *<CR>
>>>           :map <S-F4> :set isk-=# isk-=-<Bar>normal <C-]><CR>
>>>
>>> Best regards,
>>> Tony.
>>
>> Maybe it's a little more complicated.
>>
>> When you add characters to 'isk' with the star command `*'
>> and again remove them when going to a tag with Ctrl-],
>> then suddenly `#foo' is no longer found, because the pattern
>>       \<#foo\>
>> ceases to match (`\<' only matches before an 'isk' character).
>> Searching for
>>       #foo\>
>> instead should be fine.
>>
>> almost got a plugin out of this
>> https://gist.github.com/Houl/7b3f46c42fbb8fbe3d1d6bd54204ab51
>>
>> --
>> Andy
>
> Waaaaaaa! you worked so much for me!
> I am sorry not be intelligent enough just to understand how to use your
> file? Should i copy in my ~/.vimrc file?

For a start, you can put the file in a plugin folder, eg
       ~/.vim/plugin/mtc147.vim

and then in your .vimrc, you can add a line
     map <F4> <Plug>(roux-search-*)

(basically the instructions inside the script tell you the same)

> And what does it aim to do?

It's a tuned version of the previous poster's
     map <F4> :set isk+=#-<Bar>normal *<CR>
suggestion:
- sets and immediately restores 'iskeyword'
- adjusts the last search pattern set by the star command `*'

eg if after `:setl isk+=#' the search pattern becomes `\<#foo\>', then
the pattern will be adjusted to `#foo\>' (because `#' is no longer an
'isk' character).

> Best regards,
> Mathieu

--
Andy

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/5CD4492B.8020905%40yahoo.de.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: searching one word containing # with touch *

Mathieu
On jeu., 2019-05-09 at 17:37 +0200, 'Andy Wokula' via vim_use wrote:

> Am 07.05.2019 um 20:52 schrieb Mathieu Roux:
> > On lun., 2019-05-06 at 20:52 +0200, 'Andy Wokula' via vim_use
> > wrote:
> > > Am 06.05.2019 um 15:33 schrieb Tony Mechelynck:
> > > > On Sun, May 5, 2019 at 9:35 PM Gary Johnson <
> > > > [hidden email]>
> > > > wrote:
> > > > >
> > > > > On 2019-05-05, Mathieu Roux wrote:
> > > > > > On dim., 2019-05-05 at 18:50 +0200, Tony Mechelynck wrote:
> > > > > > > On Sun, May 5, 2019 at 6:44 PM Mathieu Roux wrote:
> > > > > > > >
> > > > > > > > Hello,
> > > > > > > > I would like to search the word under my prompt on vim.
> > > > > > > > For
> > > > > > > > this, i can press touch *.  But, if the word i want to
> > > > > > > > search is
> > > > > > > > #foo, as an exemple, vim only searches word foo
> > > > > > > > (without
> > > > > > > > hashtag).  In fact, hashtag is not considered in the
> > > > > > > > word, which
> > > > > > > > is confirmed when i try to go to the next word from #
> > > > > > > > with w.
> > > > > > > > Do you know how i can search effectively #titi by
> > > > > > > > pressing * on
> > > > > > > > my keyboard?
> > > > > > > > Thanks.
> > > > > > > > Mathieu Roux
> > > > > > >
> > > > > > > see :help *
> > > > > >
> > > > > > But how can i change keywords just for # and - (i want for
> > > > > > exemple
> > > > > > #foo-bar to be just one word)? i tried before but i did not
> > > > > > succeed.  The problem is that i also want to use tags with
> > > > > > CTRL+],
> > > > > > so maybe i cannot do
> > > > > >         set iskeyword=""
> > > > > > as far as i understand.
> > > > >
> > > > >       :set iskeyword+=#
> > > > >       :set iskeyword+=-
> > > > >
> > > > > seems to do it.
> > > > >
> > > > > Regards,
> > > > > Gary
> > > >
> > > > And if you want to do it easily and reversibly, you can assign
> > > > it to
> > > > a key: e.g. (untested)
> > > >
> > > >           :map <F4> :set isk+=#-<Bar>normal *<CR>
> > > >           :map <S-F4> :set isk-=# isk-=-<Bar>normal <C-]><CR>
> > > >
> > > > Best regards,
> > > > Tony.
> > >
> > > Maybe it's a little more complicated.
> > >
> > > When you add characters to 'isk' with the star command `*'
> > > and again remove them when going to a tag with Ctrl-],
> > > then suddenly `#foo' is no longer found, because the pattern
> > >       \<#foo\>
> > > ceases to match (`\<' only matches before an 'isk' character).
> > > Searching for
> > >       #foo\>
> > > instead should be fine.
> > >
> > > almost got a plugin out of this
> > > https://gist.github.com/Houl/7b3f46c42fbb8fbe3d1d6bd54204ab51
> > >
> > > --
> > > Andy
> >
> > Waaaaaaa! you worked so much for me!
> > I am sorry not be intelligent enough just to understand how to use
> > your
> > file? Should i copy in my ~/.vimrc file?
>
> For a start, you can put the file in a plugin folder, eg
>        ~/.vim/plugin/mtc147.vim
>
> and then in your .vimrc, you can add a line
>      map <F4> <Plug>(roux-search-*)
>
> (basically the instructions inside the script tell you the same)
>
> > And what does it aim to do?
>
> It's a tuned version of the previous poster's
>      map <F4> :set isk+=#-<Bar>normal *<CR>
> suggestion:
> - sets and immediately restores 'iskeyword'
> - adjusts the last search pattern set by the star command `*'
>
> eg if after `:setl isk+=#' the search pattern becomes `\<#foo\>',
> then
> the pattern will be adjusted to `#foo\>' (because `#' is no longer an
> 'isk' character).
>
> > Best regards,
> > Mathieu
>
> --
> Andy
>
> --


So i tried it... that is great, doing what i want! But of course i
don't know why it works!

You are right, i am guilty, i should have read the beginning of the
file to know how to use it !

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.

2) "adjusts the last search pattern set by the star command `*'" ->
what do you mean? * and F4 do different things, right?

3) `\<#foo\>' -> why \< and \>... i really don't understand why you
write it. I want just to find #foo...?

4) You script allow me to do great things. As i said in another
message, i have a long text file divided in small articles, and i want
to move between articles easily with something like hypertext links. I
know how i can do it with html pages; but now i prefer to navigate
easily in my text file with vim.

I would like maybe 3 kinds of links.

        a) structure links
        b) title links
        c) keywords

With your script, you allow me to do c). For exemple, i can move easily
between all articles which have the keywords #sunny-may, for exemple...

One article can be designed like this:

===============================================================
It rains today
/abc/def/ghi/klm
#foo, #bar, #holidays, #mathieu
see also: Good weather today

blablablablabla

jeudi 9 mai 2019
===============================================================

- It rains today is the title
- /abc/def/ghi/klm is the localisation
                abc is the part
                def is the chapter
                ghi is the section
                klm is the subsection

When i press F4 (or another touch) when i am on "abc", i want to
navigate between all articles which are in the part "abc".
When i press F4 (or another touch) when i am on "def", i want to
navigate between all articles which are in the chapter "abc/def".
When i press F4 (or another touch) when i am on "ghi", i want to
navigate between all articles which are in the section "abc/def/ghi".
When i press F4 (or another touch) when i am on "klm", i want to
navigate between all articles which are in the subsection
"abc/def/ghi/klm".

That is what i call "structure links" (a).

And as for "title links" (b), i would like that "Good weather today" is
colored in blue, and allow me with Ctrl + ] to go to the article "Good
weather today".

I was suggested to write one tag file, with a script which uses stream
edition, of with ctag, but i don't know it is a good idea.

I don't know how vim's help work.
For exemple, :help mouse gives something, but not every occurence of
mouse is colored is blue. How is it possible?
I know what i want, but i am really in the fog about how i can do it :-
(


Thanks,
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/585d330ddaba351069ded7f0f26be186f8d74937.camel%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
12