2016-03-30 23:03 GMT+03:00 Bram Moolenaar <[email protected]>:
>
> Nikolay Pavlov wrote:
>
>> 2016-03-30 16:39 GMT+03:00 Ken Takata <[email protected]>:
>> > Hi Bram,
>> >
>> > 2016/3/27 Sun 21:23:36 UTC+9 Bram Moolenaar wrote:
>> >> The backticks work like bars, but highlight the text as a command. I
>> >> started doing this a year ago, so there are still lots of commands in
>> >> bars. The idea is to use backticks where possible.
>> >
>> > The usage of bars in the help is written in `:help bars`, but the usage
>> > of backticks are not written, I think. Maybe it's better to mention about
>> > backticks.
>>
>> Also how about actually changing the meaning to “inline code block”?
>> From that “quick :helpgrep” I see that backticks are used as “inline
>> code block” in:
>>
>> 1. plugins like command-t, editorconfig, ag, pymode (though this one
>> uses ``…`` inherited from rst I guess, but this is also highlighted,
>> though excluding “outer” backticks), Bashka/vim_template, gutentags
>> 2. change.txt: e.g. from “`:retab!`” <C-]> will not jump to `:retab`,
>> though other backticks are mostly proper links
>> 3. cmdline.txt: e.g. from “`:'<,'>`” it will not jump anywhere, though
>> other backticks are also mostly links here
>> 4. filetype.txt: all occurences mark shell commands
>> 5. if_pyth.txt: almost all occurences mark Python code
>> 6. pi_netrw.txt: all occurences mark shell or VimL commands
>> 7. starting.txt: again commands with bangs, <C-]> does not jump
>> 8. syntax.txt: 2 of 2 occurences did not mean links
>> 9. version7.txt: I see things like “`str()`”: Python code again
>>
>> In any case allowing space inside backtick highlighted region is not
>> going to change the ability of <C-]> to jump to a tag.
>
> The main concern was that when accepting any text between backticks,
> including spaces, lines where two or more backticks appear are
> unintentionally highlighted. I haven't tried to find out how many times
> that happens. At least the `m command exist. If there are any such
> places, how does one avoid the highlighting?
I do not see any problems with the “`m” command, these commands help
does not contain `…`. But usually such problem is solved by simply
requiring that “inline code block” is
\v%(^|\s|\()@1<=
\`\S@1=[^`]{-}\S@1<=\`
%($|\s|%(\.{1,3}|[!?]{1,2})%(\ \ |$)|\,%(\ |$)|\))@5=
(i.e. backtick that starts inline code block is either preceded by a
line start, whitespace or opening parenthesis and is followed by
either line end, whitespace, sentence end (i.e. punctuation that ends
sentence (., .., ..., !, !?, ?!, !!, ??) followed by either line end
or two spaces), comma followed by a space or line end, or closing
parenthesis; code in the inline code block must start and end with a
non-whitespace character).
I do not see any problems with “`m” or “m`”, but in my documentation
you may find examples of “`foo'”: i.e. backtick closed by a quote
(also “``foo''” in NERD commenter documentation: like my variant, but
doubled), such complex regex should prevent these from causing
problems (though specifically against them one needs only “code … must
start and end with a non-whitespace …” condition).
>
> A restriction would be that there can be no line breaks inside the
> backticks, but we can most likely live with that.
>
> --
> In Joseph Heller's novel "Catch-22", the main character tries to get out of a
> war by proving he is crazy. But the mere fact he wants to get out of the war
> only shows he isn't crazy -- creating the original "Catch-22".
>
> /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
> /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\ an exciting new programming language -- http://www.Zimbu.org ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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.