Skip to content

Instantly share code, notes, and snippets.

@zbyna
Last active October 27, 2020 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zbyna/6fdd6af66fd890ff51796ef5826985cc to your computer and use it in GitHub Desktop.
Save zbyna/6fdd6af66fd890ff51796ef5826985cc to your computer and use it in GitHub Desktop.
VIM - checking reStructuredText (Sphinx) markups used in godot docs
" ONLY in VIM 8.0.1630 and later
" (trim function added see: https://github.com/vim/vim/commit/295ac5ab5e840af6051bed5ec9d9acc3c73445de)
" You can execute more than one command in command line by placing a | between two commands.
" You can execute the file by running this :source <filename>
" :ref:`label-name`
" weblate.org machine translation adds space after : like: : ref:
%s/: ref: /:ref:/gc
%s/: ref: / :ref:/gc
" two asterisks: **text** for strong emphasis (boldface)
" fixing ** text** nad **text **
%s/\*\*\(.\{-}\)\*\*/\='**'.trim(submatch(1)).'**'/gc
" backquotes: ``text`` for code samples
%s/\`\`\(.\{-}\)\`\`/\='``'.trim(submatch(1)).'``'/gc
" one asterisk: *text* for emphasis (italics)
%s/\*\(.\{-}\)\*/\='*'.trim(submatch(1)).'*'/gc
" `Link text <https://domain.invalid/>`_ for inline web links
%s/\`\(.\{-}\)\`/\='`'.trim(submatch(1)).'`'/gc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment