Jump to content

Nvim Regex by @Rongzhou

From Wikibase
No edit summary
Line 1: Line 1:
== Generic ==
<syntaxhighlight lang="text" copy>
:%s#\n# #g
</syntaxhighlight>
== Markdown /md  ==
== Markdown /md  ==



Revision as of 07:01, 16 October 2026

Generic

:%s#\n# #g

Markdown /md

Text <> list

:%s#^#- #
:%s#^- ##

Katex

\[ \( <> $$ $ separator change:

:%s/\(\\(\(.\{-}\)\\)\)\|\(\\\[\(\_.\{-}\)\\\]\)/\=submatch(1) != '' ? '$'.submatch(2).'$' : '$$'.submatch(4).'$$'/g
:%s/\$\$\(\_.\{-}\)\$\$\|\$\(.\{-}\)\$/\=submatch(0) =~ '^\$\$' ? '\['.submatch(1).'\]' : '\('.submatch(2).'\)'/g

Wikitext

<syntaxhighlight ... inline></syntaxhighlight> > <code></code>:

:%s#<syntaxhighlight[^>]*inline>\(.\{-}\)<\/syntaxhighlight>#<code>\1</code>#g

ordered list (#) > to unordered list (*):

:%s#\##*#g