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 <[email protected]>
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 [email protected].
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 via email to