Hello,

Using different languages, I remarked that the "Todo" system (highlighting
of special words inside comments) was currently a bit chaotic: some keywords
are highlighted for one syntax, but not for an another one.

(I won't talk here of syntax files which doesn't support this at all, syntax
files which have special needs, i.e. "syntax match" / "syntax region", etc.)

Out of curiosity, I searched all the (uniques) lists of "Todo" keywords;
currently there are about 40 (!) different variants:

    TODO
    TODO BUG FIX
    TODO BUG FIXME HACK REFACTOR REVIEW TEMP XXX
    TODO COMBAK DEBUG FIXME XXX
    TODO COMBAK FIXME XXX
    TODO DEBUG FIXME NOTE XXX
    TODO FIXME
    TODO FIXME DEBUG NOTE XXX
    TODO FIXME NOT XXX
    TODO FIXME NOTE
    TODO FIXME NOTE NOTES XXX
    TODO FIXME NOTE OPTIMIZE XXX
    TODO FIXME NOTE XXX
    TODO FIXME REVIEW TBD XXX[XXXXX]
    TODO FIXME TBD
    TODO FIXME TBD XXX
    TODO FIXME XXX
    TODO FIXME XXX[XXXXX]
    TODO NOTE XXX
    TODO TODO: FIXME FIXME: NOTE NOTE: TBD TBD: XXX XXX:
    TODO Todo COMBAK DEBUG FIXME XXX
    TODO Todo DEBUG
    TODO Todo todo
    TODO XXX
    TODO XXX FIXME
    TODO XXX FIXME BUG
    TODO display FIXME XXX
    TODO lout Lout LOUT
    TODO todo FIXME NOTE OPTIMIZE XXX
    TODO todo FIXME fixme TBD tbd
    Todo
    todo
    todo todo: combak combak:
    todo combak fixme xxx
    todo attention note fixme readme
    todo fixme
    todo fixme bugbug todo: bugbug: note:
    todo fixme xxx
    todo test

The problem is that each syntax file contains the hard-coded preferences
of its author.

However the end user may want to have some keywords added to the "Todo"
list, to have some other keywords removed, or may even want to have the "Todo"
system completely switched off! And above all, the end user probably wants
the same "Todo" list for whatever syntax he uses!

Of course one can take a Vim syntax file, tweak it for his own needs,
and drop it into his personal configuration directory. But it's a bit
radical when few lines must be changed!

To solve this, just for simple cases where a "syntax keyword" is used
(around 240 syntax files), the proposal is:

    - to let the user defines its list of "Todo" matches, using a
      Vim-standardized global variable; for instance:

         let g:todo_keywords = 'Todo FIX MyTodo'

    - to update Vim documentation (mostly "syntax.txt" and "user_44.txt")
      to replace hard-coded "Todo", explain the usage of the variable, etc.

    - modify syntax files to use this variable (and do nothing when
      undefined) to build syntax commands. Taking "c.vim" as an example
      of adaptation:

        " ........ Original ..............................................
        syn keyword     cTodo           contained TODO FIXME XXX

        " [...]

        " cCommentGroup allows adding matches for special things in comments
        syn cluster     cCommentGroup   contains=cTodo,cBadContinuation

        " ........ New version ...........................................

        " cCommentGroup allows adding matches for special things in comments
        syn cluster     cCommentGroup   contains=cBadContinuation

        if exists ('g:todo_keywords')
          exe 'syntax keyword cTodo contained ' g:todo_keywords
          syn cluster   cCommentGroup   add=cTodo
        endif

Note that some syntax files (sinda, tak, trasys) already allows the user
user to define its own list of "Todo" keywords. However the variable name
("thermal_todo") isn't too generic!

The proposal involves small changes to a lot of files. I've started
to test this with some syntax file (c, tcl, vhdl) and seen no problem.

Other remark: sometimes the "contained" keyword isn't used to declare "Todo"
lists; I'm not sure it's needed or not, but here's the list of syntax files:
    arch, cdrdaoconf, falcon, initex, lace, modconf, nsis, pli,
    plsql, sqlinformix, stp

regards, jfb

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui