git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[almost-patch] Add diff regular expressions for Markdown and Zshell

From
Sebastian Gniazdowski <sgniazdowski@gmail.com>
Date
Feb 25, 2020, 13:56 UTC
Message-ID
<CAKc7PVAWwJSAMbqyn-EOiTn7nc_dXHrqD68JtwdrK8-WN2mkUA@mail.gmail.com>

Hi. Git comes with a few of the diff-regexes built-in. They are listed here: https://git-scm.com/docs/gitattributes#_defining_a_custom_hunk_header

I'm a Zsh plugin creator and I've found the following regexes to be useful:
- Zshell function-matching:
    xfuncname =
"^((function[[:blank:]]+[^[:blank:]]+[[:blank:]]*(\\(\\)|))|([^[:blank:]]+[[:blank:]]*\\(\\)))[[:blank:]]*(\\{|)[[:blank:]]*$"
- Markdown hading-matching:
    xfuncname = "^#+[[:blank:]].*$"

Could those regexes be added to the built-in set? I think that they're extremely useful and shipping them with Git would lift the requirement of having them in each .gitconfig on each machine – particularly useful for e.g.: receiving bug-reports from Zsh-plugin users, that may have the patterns not set up.

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zinit
Blog: http://zdharma.org
Message 1 of 1 in “Add diff regular expressions for Markdown and Zshell”
  1. Add diff regular expressions for Markdown and ZshellSebastian Gniazdowski, Feb 25, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.