User:Il Park/vimcmds
From Scholarpedia
Hopefully this page will evolve and automate stuff.
- Convert $blah$ to <math>blah</math>: %s/\$\([^$]\{-}\)\$/<math>\1<\/math>/g
- Convert [something] to (something): %s/\(\[\)\@<!\[\(\_[^\[]\{-}\)\]/(\2)/gc
- Search stuff containing numbers in parenthesis: /(\(\_[^)]\{-}\d\+[^)]\{-}\))/
- Insert * on every non-empty line: s/^\(\a\)/\* \1/
- Do not do the following removal of LaTeX math:
- %s/<math>\s*\\epsilon\s*<\/math>/ε/gc
- %s/<math>\s*\\Omega\s*<\/math>/Ω/gc
- %s/<math>\s*\(\w*\)^{\?\(\w\)}\?\s*<\/math>/\1<sup>\2<\/sup>/gc
- %s/<math>\s*\(\w*\)\s*<\/math>/ ''\1''/gc
- remove old boldmath commands
- %s/\\mbox{\\boldmath\$\(.\{-\}\)\$}/\\mathbf{\1}/gc
- %s/{\\boldmath\$\(.\{-\}\)\$}/\$\\mathbf{\1}\$/gc
- Standard manipulations
- %s/\\begin{equation}/:<math>/g
- %s/\\end{equation}/<\/math>/g
- %s/\\section{\(.*\)\}/== \1 ==/
- %s/\\\[/:<math>/g
- %s/\\\]/<\/math>/g
- %s/{\\em \(.\{-\}\)}/'''\1'''/g</math>
- The surround.vim helps a lot. Use S command to surround the selected text.