mzlogin / vim-markdown-toc

A vim 7.4+ plugin to generate table of contents for Markdown files.
http://www.vim.org/scripts/script.php?script_id=5460
MIT License
613 stars 59 forks source link

Add regex comments #30

Closed wget closed 7 years ago

wget commented 7 years ago

Simply add comments for newcomers discovering these regexes.

wget commented 7 years ago

Also @mzlogin, could you explain to me why the help specifies this is the start and end of file then? Is this an error in the vim doc? 2017-08-18_-_vim_regexp_begin_end_string_file_0001

wget commented 7 years ago

Wrt. my idea. This is to have the Python code generating the vim table finished by the end of the day. The idea will be basically the same as unicode.vim:

" For the unicode char names
let unicode#table#char#name[0x000D] = 'CARRIAGE RETURN'
" For the unicode char properties, either the ranges:
let unicode#table#char#name[Cn] = range(0x2, 0xA) + range(0x30, 0x40)
" or the ranges written in all letters, this mean a bunch of characters! As some array values are aliases `Alpha` and `Alphanumeric`, this means a bunch of lines to save in the file, and a few more Mio of RAM.
let unicode#table#char#name[Cn] = [2, 3, 4, 5, 6, 7, 8, 9, 10, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64]
mzlogin commented 7 years ago

@wget Yes you are right, it's actually beginning of file and end of file, my mistake.

Because headings are all single lines, I'm thinking about use \_^ and \_$ to replace \%^ and \%$, to make intention more clear.

mzlogin commented 7 years ago

@wget All we need is the right ranges. What can I do for your idea, or just waiting? 😄

I don't know ruby, I have a headache when look at that code. 😢

mzlogin commented 7 years ago

Can :digraphs and :help digraph help?

wget commented 7 years ago

@mzlogin Just waiting is fine :) I didn't know Ruby either, but it isn't that much complicated compared to Python for example :)