Wednesday, May 8, 2019

Re: searching one word containing # with touch *

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 vim_use+unsubscribe@googlegroups.com.
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.

No comments: