Jump to content

Nvim Regex by @Rongzhou

From Wikibase
No edit summary
Line 37: Line 37:
</syntaxhighlight>
</syntaxhighlight>


ordered list (#) > to unordered list (*):
ordered list (<code>#</code>) > to unordered list (<code>*</code>):


<syntaxhighlight lang="text" copy>
<syntaxhighlight lang="text" copy>
:%s#\##*#g
:%s#\##*#g
</syntaxhighlight>
<code>[[File:{filename}]]</code> > <code>[[File:{filename}|400px|center]]</code>
<syntaxhighlight lang="text" copy>
:%s/\[\[File:\([^]]*\)\]\]/[[File:\1\|400px\|center]]/g
</syntaxhighlight>
</syntaxhighlight>

Revision as of 09:07, 17 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

[[File:{filename}]] > [[File:{filename}|400px|center]]

:%s/\[\[File:\([^]]*\)\]\]/[[File:\1\|400px\|center]]/g