threads / patch / 52882

patchAdd diff regular expressions for Markdown and Zshell

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

## tl;dr

One message between Feb 25, 2020 and Feb 25, 2020. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Sebastian Gniazdowski· Feb 25, 2020, 13:56 UTC · lore

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

← back to recent threads