writing one text the same way vim's help

16 views
Skip to first unread message

Mathieu Roux

unread,
May 10, 2019, 1:29:13 PM5/10/19
to vim...@googlegroups.com
Hi everybody,

I posted questions before, but i was not clear in my mind about what i
wanted to do exactly and what was possible with vim.
I read more in vim's help, and i understand better now.
I can see in my directory /usr/share/vim/vim80/doc
how vim's help files are made.

And now i think tags are the best tools to do what i want (one long
text with hypertext links, but only textfile, not html).

As far as i understand, one script using ctag searched in all vim help
files, and where it found |plouf|, one link was created in tags file
to search /*plouf*.

1) |plouf| is colored is blue, and *plouf* is colored in red when open
with vi. It is function of hightlight, right? How can i use the same
highlight for my own-text file?

2) Where is the script to build tags file for vim's help? I would like
to use it for my own.

Best regards,
Mathieu Roux

Erik Christiansen

unread,
May 11, 2019, 12:34:20 AM5/11/19
to vim...@googlegroups.com
On 10.05.19 19:29, Mathieu Roux wrote:
> 1) |plouf| is colored is blue, and *plouf* is colored in red when open
> with vi. It is function of hightlight, right? How can i use the same
> highlight for my own-text file?

Not being a user of highlighting, I can only point to ":h highlight".
Mastering syntax highlighting to the point of customising it will
probably require some reading, possibly even of some google hits.

> 2) Where is the script to build tags file for vim's help? I would like
> to use it for my own.

Built into Vim, by the look of it. See ":h helptags"
Where that puts the tagfile is not explicated, so we're not sure whether
it's suited to generating tags for other files.

Attempting to repurpose Vim's helptag generator is not as flexible as a
custom script, which may begin as a simple one-liner, yet be extended as
needed.

Erik

Erik Christiansen

unread,
May 11, 2019, 6:28:10 AM5/11/19
to vim...@googlegroups.com
On 11.05.19 14:34, Erik Christiansen wrote:
> On 10.05.19 19:29, Mathieu Roux wrote:
> > 1) |plouf| is colored is blue, and *plouf* is colored in red when open
> > with vi. It is function of hightlight, right? How can i use the same
> > highlight for my own-text file?
>
> Not being a user of highlighting, I can only point to ":h highlight".
> Mastering syntax highlighting to the point of customising it will
> probably require some reading, possibly even of some google hits.

A useful starting point might be: :h tag-highlight
It provides some mappings for generating and highlighting tags. Some of
that may suit your use case.

Erik

Mathieu Roux

unread,
May 13, 2019, 1:14:24 PM5/13/19
to vim...@googlegroups.com
> --


Thanks for you help. So i have read several articles of vi's help.

I have understood that when my file is call foo.txt, :helptags .
creates my tags file, and that is what i want.

:h tag-highlight
is apparently the section to set the highlight, but i don't understand
everything.

I can read:


"If you want to highlight all the tags in your file, you can use the
following
mappings.

<F11> -- Generate tags.vim file, and highlight tags.
<F12> -- Just highlight tags based on existing tags.vim file.

:map <F11> :sp tags<CR>:%s/^\([^ :]*:\)\=\([^ ]*\).*/syntax
keyword Tag \2/<CR>:wq! tags.vim<CR>/^<CR><F12>
:map <F12> :so tags.vim<CR>"





1) How can i know free shortcuts on my machine? it seams that F11 is
used for a wider window.

2) For exemple, is it possible to use Ctrl+F11? should i write <C-
F11>... does not work...

3) I have one tags.vim file her:
/usr/share/vim/vim80/syntax/tags.vim
What is the utility of this file? Does it allow to define coloration?

4) How to use it?
I copied tags.vim file in my current directory, and i copied a "true"
helpfile from directory
/usr/share/vim/vim80/doc
I tried so execute the command for F11, but it does not work...

5) After that, if i modify my .txt file, i will have to launch again :h
tag-highlight, if i change my file. But of course, i want to define
hightlighting one time forever. Is it possible?







Best regards,
Mathieu Roux

Reply all
Reply to author
Forward
0 new messages