--- /dev/null
+*
+!/.gitignore.d/vim
+!/.var/vim/.gitignore
+!/.vim/after/ftplugin/automake.vim
+!/.vim/after/ftplugin/debchangelog.vim
+!/.vim/after/ftplugin/diff.vim
+!/.vim/after/ftplugin/gitcommit.vim
+!/.vim/after/ftplugin/git.vim
+!/.vim/after/ftplugin/mail.vim
+!/.vim/after/ftplugin/make.vim
+!/.vim/after/ftplugin/nroff.vim
+!/.vim/after/ftplugin/perl.vim
+!/.vim/after/ftplugin/puppet.vim
+!/.vim/after/ftplugin/python.vim
+!/.vim/after/ftplugin/rst.vim
+!/.vim/after/ftplugin/tex.vim
+!/.vim/after/ftplugin/vo_base.vim
+!/.vim/after/plugin/TabularMaps.vim
+!/.vim/after/syntax/tex.vim
+!/.vim/autoload/airline/async.vim
+!/.vim/autoload/airline/builder.vim
+!/.vim/autoload/airline/debug.vim
+!/.vim/autoload/airline/extensions/ale.vim
+!/.vim/autoload/airline/extensions/branch.vim
+!/.vim/autoload/airline/extensions/bufferline.vim
+!/.vim/autoload/airline/extensions/capslock.vim
+!/.vim/autoload/airline/extensions/commandt.vim
+!/.vim/autoload/airline/extensions/csv.vim
+!/.vim/autoload/airline/extensions/ctrlp.vim
+!/.vim/autoload/airline/extensions/ctrlspace.vim
+!/.vim/autoload/airline/extensions/cursormode.vim
+!/.vim/autoload/airline/extensions/default.vim
+!/.vim/autoload/airline/extensions/denite.vim
+!/.vim/autoload/airline/extensions/eclim.vim
+!/.vim/autoload/airline/extensions/example.vim
+!/.vim/autoload/airline/extensions/fugitiveline.vim
+!/.vim/autoload/airline/extensions/grepper.vim
+!/.vim/autoload/airline/extensions/gutentags.vim
+!/.vim/autoload/airline/extensions/hunks.vim
+!/.vim/autoload/airline/extensions/keymap.vim
+!/.vim/autoload/airline/extensions/languageclient.vim
+!/.vim/autoload/airline/extensions/localsearch.vim
+!/.vim/autoload/airline/extensions/neomake.vim
+!/.vim/autoload/airline/extensions/netrw.vim
+!/.vim/autoload/airline/extensions/nrrwrgn.vim
+!/.vim/autoload/airline/extensions/obsession.vim
+!/.vim/autoload/airline/extensions/po.vim
+!/.vim/autoload/airline/extensions/promptline.vim
+!/.vim/autoload/airline/extensions/quickfix.vim
+!/.vim/autoload/airline/extensions/syntastic.vim
+!/.vim/autoload/airline/extensions/tabline/autoshow.vim
+!/.vim/autoload/airline/extensions/tabline/buffers.vim
+!/.vim/autoload/airline/extensions/tabline/buflist.vim
+!/.vim/autoload/airline/extensions/tabline/builder.vim
+!/.vim/autoload/airline/extensions/tabline/ctrlspace.vim
+!/.vim/autoload/airline/extensions/tabline/formatters/default.vim
+!/.vim/autoload/airline/extensions/tabline/formatters/jsformatter.vim
+!/.vim/autoload/airline/extensions/tabline/formatters/tabnr.vim
+!/.vim/autoload/airline/extensions/tabline/formatters/unique_tail_improved.vim
+!/.vim/autoload/airline/extensions/tabline/formatters/unique_tail.vim
+!/.vim/autoload/airline/extensions/tabline/tabs.vim
+!/.vim/autoload/airline/extensions/tabline.vim
+!/.vim/autoload/airline/extensions/tabline/xtabline.vim
+!/.vim/autoload/airline/extensions/tagbar.vim
+!/.vim/autoload/airline/extensions/term.vim
+!/.vim/autoload/airline/extensions/tmuxline.vim
+!/.vim/autoload/airline/extensions/undotree.vim
+!/.vim/autoload/airline/extensions/unicode.vim
+!/.vim/autoload/airline/extensions/unite.vim
+!/.vim/autoload/airline/extensions.vim
+!/.vim/autoload/airline/extensions/vimagit.vim
+!/.vim/autoload/airline/extensions/vimtex.vim
+!/.vim/autoload/airline/extensions/virtualenv.vim
+!/.vim/autoload/airline/extensions/whitespace.vim
+!/.vim/autoload/airline/extensions/windowswap.vim
+!/.vim/autoload/airline/extensions/wordcount/formatters/default.vim
+!/.vim/autoload/airline/extensions/wordcount.vim
+!/.vim/autoload/airline/extensions/xkblayout.vim
+!/.vim/autoload/airline/extensions/ycm.vim
+!/.vim/autoload/airline/highlighter.vim
+!/.vim/autoload/airline/init.vim
+!/.vim/autoload/airline/msdos.vim
+!/.vim/autoload/airline/parts.vim
+!/.vim/autoload/airline/section.vim
+!/.vim/autoload/airline/themes/dark.vim
+!/.vim/autoload/airline/themes.vim
+!/.vim/autoload/airline/util.vim
+!/.vim/autoload/airline.vim
+!/.vim/autoload/deb.vim
+!/.vim/autoload/ledger.vim
+!/.vim/autoload/pathogen.vim
+!/.vim/autoload/tabular.vim
+!/.vim/autoload/voom.vim
+!/.vim/autoload/voom/voom_vimplugin2657/__init__.py
+!/.vim/autoload/voom/voom_vimplugin2657/__pycache__/__init__.cpython-37.pyc
+!/.vim/autoload/voom/voom_vimplugin2657/__pycache__/voom_mode_fmr.cpython-37.pyc
+!/.vim/autoload/voom/voom_vimplugin2657/__pycache__/voom_vim.cpython-37.pyc
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_asciidoc.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_cwiki.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_dokuwiki.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_fmr1.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_fmr2.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_fmr3.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_fmr.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_hashes.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_html.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_inverseAtx.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_latexDtx.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_latex.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_markdown.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_org.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_pandoc.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_paragraphBlank.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_paragraphIndent.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_paragraphNoIndent.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_python.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_rest.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_taskpaper.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_thevimoutliner.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_txt2tags.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_viki.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_vimoutliner.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_vimwiki.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_mode_wiki.py
+!/.vim/autoload/voom/voom_vimplugin2657/voom_vim.py
+!/.vim/bundle/explainpat/autoload/explainpat.vim
+!/.vim/bundle/explainpat/autoload/nwo/magic.vim
+!/.vim/bundle/explainpat/doc/explainpat.txt
+!/.vim/bundle/explainpat/.gitignore
+!/.vim/bundle/explainpat/plugin/explainpat.vim
+!/.vim/bundle/explainpat/README
+!/.vim/bundle/password-store/doc/vim-password-store.txt
+!/.vim/bundle/password-store/ftdetect/pass.vim
+!/.vim/bundle/password-store/ftplugin/pass.vim
+!/.vim/bundle/password-store/LICENSE
+!/.vim/bundle/password-store/README.md
+!/.vim/bundle/password-store/syntax/pass.vim
+!/.vim/colors/madduck.vim
+!/.vim/compiler/ledger.vim
+!/.vim/compiler/tex.vim
+!/.vim/doc/airline.txt
+!/.vim/doc/.gitignore
+!/.vim/doc/imaps.txt.gz
+!/.vim/doc/lastplace.txt
+!/.vim/doc/latexhelp.txt.gz
+!/.vim/doc/latex-suite-quickstart.txt.gz
+!/.vim/doc/latex-suite.txt.gz
+!/.vim/doc/ledger.txt
+!/.vim/doc/surround.txt
+!/.vim/doc/Tabular.txt
+!/.vim/doc/vimplate.txt
+!/.vim/doc/voom.txt
+!/.vim/ftdetect/itsalltext.vim
+!/.vim/ftdetect/ledger.vim
+!/.vim/ftdetect/mediawiki.vim
+!/.vim/ftdetect/puppet.vim
+!/.vim/ftplugin/bib_latexSuite.vim
+!/.vim/ftplugin/gitcommit.vim
+!/.vim/ftplugin/gitconfig.vim
+!/.vim/ftplugin/itsalltext.vim
+!/.vim/ftplugin/latex-suite/bibtex.vim
+!/.vim/ftplugin/latex-suite/bibtools.py
+!/.vim/ftplugin/latex-suite/brackets.vim
+!/.vim/ftplugin/latex-suite/compiler.vim
+!/.vim/ftplugin/latex-suite/custommacros.vim
+!/.vim/ftplugin/latex-suite/diacritics.vim
+!/.vim/ftplugin/latex-suite/dictionaries/dictionary
+!/.vim/ftplugin/latex-suite/dictionaries/SIunits
+!/.vim/ftplugin/latex-suite/elementmacros.vim
+!/.vim/ftplugin/latex-suite/envmacros.vim
+!/.vim/ftplugin/latex-suite/folding.vim
+!/.vim/ftplugin/latex-suite/.gitignore
+!/.vim/ftplugin/latex-suite/macros/example
+!/.vim/ftplugin/latex-suite/main.vim
+!/.vim/ftplugin/latex-suite/mathmacros-utf.vim
+!/.vim/ftplugin/latex-suite/mathmacros.vim
+!/.vim/ftplugin/latex-suite/multicompile.vim
+!/.vim/ftplugin/latex-suite/outline.py
+!/.vim/ftplugin/latex-suite/packages/accents
+!/.vim/ftplugin/latex-suite/packages/acromake
+!/.vim/ftplugin/latex-suite/packages/afterpage
+!/.vim/ftplugin/latex-suite/packages/alltt
+!/.vim/ftplugin/latex-suite/packages/amsmath
+!/.vim/ftplugin/latex-suite/packages/amsthm
+!/.vim/ftplugin/latex-suite/packages/amsxtra
+!/.vim/ftplugin/latex-suite/packages/arabic
+!/.vim/ftplugin/latex-suite/packages/array
+!/.vim/ftplugin/latex-suite/packages/babel
+!/.vim/ftplugin/latex-suite/packages/bar
+!/.vim/ftplugin/latex-suite/packages/biblatex
+!/.vim/ftplugin/latex-suite/packages/bm
+!/.vim/ftplugin/latex-suite/packages/bophook
+!/.vim/ftplugin/latex-suite/packages/boxedminipage
+!/.vim/ftplugin/latex-suite/packages/caption2
+!/.vim/ftplugin/latex-suite/packages/cases
+!/.vim/ftplugin/latex-suite/packages/ccaption
+!/.vim/ftplugin/latex-suite/packages/changebar
+!/.vim/ftplugin/latex-suite/packages/chapterbib
+!/.vim/ftplugin/latex-suite/packages/cite
+!/.vim/ftplugin/latex-suite/packages/color
+!/.vim/ftplugin/latex-suite/packages/comma
+!/.vim/ftplugin/latex-suite/packages/csquotes
+!/.vim/ftplugin/latex-suite/packages/deleq
+!/.vim/ftplugin/latex-suite/packages/drftcite
+!/.vim/ftplugin/latex-suite/packages/dropping
+!/.vim/ftplugin/latex-suite/packages/enumerate
+!/.vim/ftplugin/latex-suite/packages/eqlist
+!/.vim/ftplugin/latex-suite/packages/eqparbox
+!/.vim/ftplugin/latex-suite/packages/everyshi
+!/.vim/ftplugin/latex-suite/packages/exmpl
+!/.vim/ftplugin/latex-suite/packages/fixme
+!/.vim/ftplugin/latex-suite/packages/flafter
+!/.vim/ftplugin/latex-suite/packages/float
+!/.vim/ftplugin/latex-suite/packages/floatflt
+!/.vim/ftplugin/latex-suite/packages/fn2end
+!/.vim/ftplugin/latex-suite/packages/footmisc
+!/.vim/ftplugin/latex-suite/packages/geometry
+!/.vim/ftplugin/latex-suite/packages/german
+!/.vim/ftplugin/latex-suite/packages/graphicx
+!/.vim/ftplugin/latex-suite/packages/graphpap
+!/.vim/ftplugin/latex-suite/packages/harpoon
+!/.vim/ftplugin/latex-suite/packages/hhline
+!/.vim/ftplugin/latex-suite/packages/histogram
+!/.vim/ftplugin/latex-suite/packages/hyperref
+!/.vim/ftplugin/latex-suite/packages/ifthen
+!/.vim/ftplugin/latex-suite/packages/inputenc
+!/.vim/ftplugin/latex-suite/packages/letterspace
+!/.vim/ftplugin/latex-suite/packages/lineno
+!/.vim/ftplugin/latex-suite/packages/longtable
+!/.vim/ftplugin/latex-suite/packages/lscape
+!/.vim/ftplugin/latex-suite/packages/manyfoot
+!/.vim/ftplugin/latex-suite/packages/moreverb
+!/.vim/ftplugin/latex-suite/packages/multibox
+!/.vim/ftplugin/latex-suite/packages/multicol
+!/.vim/ftplugin/latex-suite/packages/newalg
+!/.vim/ftplugin/latex-suite/packages/ngerman
+!/.vim/ftplugin/latex-suite/packages/numprint
+!/.vim/ftplugin/latex-suite/packages/oldstyle
+!/.vim/ftplugin/latex-suite/packages/outliner
+!/.vim/ftplugin/latex-suite/packages/overcite
+!/.vim/ftplugin/latex-suite/packages/pagenote
+!/.vim/ftplugin/latex-suite/packages/parallel
+!/.vim/ftplugin/latex-suite/packages/plain
+!/.vim/ftplugin/latex-suite/packages/plates
+!/.vim/ftplugin/latex-suite/packages/polski
+!/.vim/ftplugin/latex-suite/packages/psgo
+!/.vim/ftplugin/latex-suite/packages/schedule
+!/.vim/ftplugin/latex-suite/packages/SIunits
+!/.vim/ftplugin/latex-suite/packages/textfit
+!/.vim/ftplugin/latex-suite/packages/times
+!/.vim/ftplugin/latex-suite/packages/tipa
+!/.vim/ftplugin/latex-suite/packages/ulem
+!/.vim/ftplugin/latex-suite/packages/url
+!/.vim/ftplugin/latex-suite/packages/verbatim
+!/.vim/ftplugin/latex-suite/packages/version
+!/.vim/ftplugin/latex-suite/packages.vim
+!/.vim/ftplugin/latex-suite/projecttemplate.vim
+!/.vim/ftplugin/latex-suite/pytools.py
+!/.vim/ftplugin/latex-suite/smartspace.vim
+!/.vim/ftplugin/latex-suite/templates/article.tex
+!/.vim/ftplugin/latex-suite/templates/IEEEtran.tex
+!/.vim/ftplugin/latex-suite/templates/report.tex
+!/.vim/ftplugin/latex-suite/templates/report_two_column.tex
+!/.vim/ftplugin/latex-suite/templates.vim
+!/.vim/ftplugin/latex-suite/texmenuconf.vim
+!/.vim/ftplugin/latex-suite/texproject.vim
+!/.vim/ftplugin/latex-suite/texrc
+!/.vim/ftplugin/latex-suite/texviewer.vim
+!/.vim/ftplugin/latex-suite/version.vim
+!/.vim/ftplugin/latex-suite/wizardfuncs.vim
+!/.vim/ftplugin/ledger.vim
+!/.vim/ftplugin/mediawiki.vim
+!/.vim/ftplugin/python.vim
+!/.vim/ftplugin/tex_latexSuite.vim
+!/.vim/ftplugin/tex.vim
+!/.vim/ftplugin/vcard.vim
+!/.vim/.gitignore
+!/.vim/indent/ledger.vim
+!/.vim/indent/python.vim
+!/.vim/indent/tex.vim
+!/.vim/macros/table.vim
+!/.vim/plugin/airline.vim
+!/.vim/plugin/debPlugin.vim
+!/.vim/plugin/filebrowser.vim
+!/.vim/plugin/gnupg.vim
+!/.vim/plugin/imaps.vim
+!/.vim/plugin/justify.vim
+!/.vim/plugin/lastplace.vim
+!/.vim/plugin/lbdbq.vim
+!/.vim/plugin/matchit.vim
+!/.vim/plugin/remoteOpen.vim
+!/.vim/plugin/securemodelines.vim
+!/.vim/plugin/surround.vim
+!/.vim/plugin/SyntaxFolds.vim
+!/.vim/plugin/Tabular.vim
+!/.vim/plugin/vimplate.vim
+!/.vim/plugin/voom.vim
+!/.vimrc
+!/.vim/spell/en.utf-8.add
+!/.vim/spell/.gitignore
+!/.vim/syntax/deb.vim
+!/.vim/syntax/jinja.vim
+!/.vim/syntax/ledger.vim
+!/.vim/syntax/mediawiki.vim
+!/.vim/syntax/puppet.vim
+!/.vim/syntax/tex.vim
+!/.vim/vimplaterc
+!/.zsh/zshenv/parts.d/50-vim
--- /dev/null
+view
+viminfo
--- /dev/null
+setlocal noexpandtab
--- /dev/null
+setlocal foldclose=
+setlocal nofoldenable
+setlocal comments+=f:-
--- /dev/null
+setlocal noexpandtab
--- /dev/null
+setlocal textwidth=72
--- /dev/null
+" display the git-diff --cached in window below commit
+" assumes nosplitbelow set. Might want to use wincmd p otherwise
+DiffGitCached | wincmd J
--- /dev/null
+setlocal textwidth=68
+setlocal formatoptions-=o
+setlocal formatoptions-=r
+setlocal formatoptions-=l
+setlocal formatoptions+=a
+setlocal formatoptions+=w
+setlocal formatoptions+=n
+
+setlocal comments=n:>
+
+"setlocal spell
+
+augroup tsperrorinsert
+ au!
+augroup END
+match none /\s*$/
+augroup listinsert
+ au!
+augroup END
+setlocal list
+
+" Dynamically set format options, depending on where you are in a
+" mail, idea from Teemu Likonen:
+" http://groups.google.com/group/vim_use/msg/f59e5c1adc6be2b3
+
+let s:defaults = "setlocal fo=".&fo
+" tw=".&tw." ts=".&ts." sts=".&sts." sw=".&sw." fo=".&fo
+execute s:defaults
+let b:MailAreaDetect=1
+
+nnoremap <buffer><silent> <F9> :call <SID>MailAreaDetect_Switch(0)<CR>
+inoremap <buffer><silent> <F9> <C-\><C-O>:call <SID>MailAreaDetect_Switch(1)<CR>
+
+function! s:MailAreaDetect_Switch(vmode)
+ if b:MailAreaDetect
+ silent call <SID>MailAreaDetect_Off()
+ let b:MailAreaDetect=0
+ echo 'MailAreaDetect Off'
+ if a:vmode
+ sleep 1
+ endif
+ else
+ silent call <SID>MailAreaDetect_On()
+ let b:MailAreaDetect=1
+ echo 'MailAreaDetect On'
+ if a:vmode
+ sleep 1
+ endif
+ endif
+endfu
+
+function! s:MailAreaDetect_On()
+ silent autocmd! MailAreaDetect CursorMoved,CursorMoved
+ \ <buffer> call <SID>AreaOptions()
+ let b:MailAreaDetect=1
+endfunction
+
+function! s:MailAreaDetect_Off()
+ silent autocmd! MailAreaDetect
+ execute s:defaults
+ let b:MailAreaDetect=0
+endfunction
+
+augroup MailAreaDetect
+ autocmd!
+ call <SID>MailAreaDetect_On()
+augroup END
+
+function! s:AreaOptions()
+ execute s:defaults
+
+ let s:synCur = synIDattr(synID(line("."),1,0),"name")
+ let s:synNext = synIDattr(synID(line(".")+1,1,0),"name")
+
+ if s:synNext =~ '^mailQuote' && s:synCur == '' && getline('.') =~ '^.'
+ " elseif getline('.') =~ '^\s*[^>]' && getline(line('.')+1) =~ '\m^\s*>'
+ setlocal fo-=a
+ "echo 'Quotation leader (fo='.&fo.')'
+ elseif s:synCur =~ '^mailQuote'
+ " elseif getline('.') =~ '\m^\s*>'
+ setlocal fo-=a
+ "echo 'Quotation (fo='.&fo.')'
+ elseif <SID>CheckArea('\m^--- .*\n^+++ ','\v(^$|\n^-- $)')
+ setlocal fo-=a fo-=w fo-=t noet
+ "echo 'Patch (fo='.&fo.')'
+ elseif s:synCur == '' && s:synNext =~ '^mailSignature'
+ " elseif getline(line('.')+1) =~ '\m^-- $'
+ setlocal fo-=a fo-=w fo-=t
+ "echo 'Last line before signature (fo='.&fo.')'
+ elseif s:synCur =~ '^mailSignature'
+ " elseif <SID>CheckArea('^-- $','^$')
+ setlocal fo-=a fo-=w fo-=t
+ "echo 'Signature (fo='.&fo.')'
+ elseif s:synCur =~ '^mail'
+ " if <SID>CheckArea('\v^From( |: ).*\n','\v^$')
+ setlocal fo-=a fo-=w fo-=t
+ "echo 'Header (fo='.&fo.')'
+ else
+ "echo 'My text (fo='.&fo.')'
+ endif
+endfunction
+
+function! s:CheckArea(start, end)
+ return (search(a:start,'bcnW')-line('.')) >
+ \ (search(a:end,'bnW')-line('.'))
+endfunction
+
+function! FixQuotes()
+ let l:i = 0
+ let l:lineNxt = getline(l:i)
+ let l:synNxt = synIDattr(synID(l:i,1,0),"name")
+ while l:i < line('$')-1
+ let l:lineCur = l:lineNxt
+ let l:synCur = l:synNxt
+ let l:lineNxt = getline(l:i+1)
+ let l:synNxt = synIDattr(synID(l:i+1,1,0),"name")
+ if l:synCur =~ '^mailQuote' && l:lineCur =~ '\w.*\S$' &&
+ \ l:synNxt =~ '^mailQuote' && l:lineNxt =~ '\w'
+ call setline(l:i, l:lineCur . ' ')
+ endif
+ let l:i += 1
+ endwhile
+endfunction
+
+augroup fixquotes
+ au!
+ autocmd BufWinEnter $TMPDIR/mutt-* call FixQuotes()
+augroup END
+
+nmap <buffer> <C-P><F1> :w<CR>:%!mailplate --keep-unknown official<CR>
+nmap <buffer> <C-P><F2> :w<CR>:%!mailplate --keep-unknown tahi<CR>
+nmap <buffer> <C-P><F3> :w<CR>:%!mailplate --keep-unknown pmvm<CR>
+nmap <buffer> <C-P><F4> :w<CR>:%!mailplate --keep-unknown pobox<CR>
+nmap <buffer> <C-P><F5> :w<CR>:%!mailplate --keep-unknown debian<CR>
+nmap <buffer> <C-P><F6> :w<CR>:%!mailplate --keep-unknown debconf<CR>
+nmap <buffer> <C-P><F7> :w<CR>:%!mailplate --keep-unknown uniwh<CR>
+nmap <buffer> <C-P><F8> :w<CR>:%!mailplate --keep-unknown mtfk<CR>
+nmap <buffer> <C-P><F9> :w<CR>:%!mailplate --keep-unknown sudetia<CR>
+nmap <buffer> <C-P><F12> :w<CR>:%!mailplate --keep-unknown private<CR>
+nmap <buffer> <F1> :w<CR>:%!mailplate --auto --keep-unknown 2>/dev/null<CR>
+
+" change subject line
+" Before: Subject: old
+" After : Subject: New (was: old)
+" http://strcat.de/wiki/dotfiles#vim
+" map ,sw 1G/^Subject: <CR>:s/Re:/was:/<CR>Wi (<C-O>$)<ESC>0Whi
+map <Leader>ns 1G/^Subject: /<CR>:s,\(Subject: \)\(Re: \)*\(.*\)$,\1 (was: \3),<CR>:set nohls<CR>f li
+
+" Delete 'was' in the Subject.
+" Before: Subject: New (was: old)
+" After : Subject: New
+" http://strcat.de/wiki/dotfiles#vim
+map <Leader>dw 1G/^Subject: /<CR>:s, *(was: .*)$<CR>:set nohls<CR>f l
+
+" http://dollyfish.net.nz/blog/2008-04-01/mutt-and-vim-custom-autocompletion
+fun! LBDBCompleteFn(findstart, base)
+ let line = getline('.')
+ if a:findstart
+ " locate the start of the word
+ let start = col('.') - 1
+ while start > 0 && line[start - 1] =~ '[^:,]'
+ let start -= 1
+ endwhile
+ while start < col('.') && line[start] =~ '[:, ]'
+ let start += 1
+ endwhile
+ return start
+ else
+ let res = []
+ let query = substitute(a:base, '"', '', 'g')
+ let query = substitute(query, '\s*<.*>\s*', '', 'g')
+ for m in LbdbQuery(query)
+ call complete_add(printf('"%s" <%s>', escape(m[0], '"'), m[1]))
+ if complete_check()
+ break
+ endif
+ endfor
+ return res
+ endif
+endfun
+set completefunc=LBDBCompleteFn
+
+" And this magic by James Vega, which ensures that we only complete with lbdb
+" on the recipient lines of the mail header.
+inoremap <expr> <C-n> DelegateCompletion(1)
+inoremap <expr> <C-p> DelegateCompletion(0)
+
+fun! DelegateCompletion(next)
+ if getline('.') =~? '^\%(To\|B\=Cc\):'
+ return "\x18\x15"
+ elseif a:next
+ return "\x0e"
+ else
+ return "\x10"
+ endif
+endfun
+
+autocmd BufWritePost <buffer> exe 'write ' . fnameescape((exists('$TMPDIR') ? expand('$TMPDIR') : '/tmp') . '/mail.backup.' . strftime('%Y-%m-%d-%H%M%S'))
--- /dev/null
+setlocal noexpandtab
--- /dev/null
+setlocal tw=75
--- /dev/null
+setlocal sw=8
+setlocal sts=8
+setlocal noet
--- /dev/null
+setlocal sw=4
+setlocal sts=4
+iunab ➬
--- /dev/null
+setlocal sw=4
+setlocal sts=4
--- /dev/null
+"setlocal formatoptions+=a
+setlocal formatoptions-=n
+setlocal formatoptions-=o
+setlocal formatoptions-=r
--- /dev/null
+setlocal formatoptions-=r
+setlocal formatoptions-=o
+setlocal formatoptions-=n
+
+setlocal iskeyword+=:
+
+"setlocal spell
--- /dev/null
+setlocal nolist
--- /dev/null
+/usr/share/vim/addons/after/plugin/TabularMaps.vim
\ No newline at end of file
--- /dev/null
+"syntax region mailBody start="^$" end="^--\s"me=s-1 skip=">.*$" keepend contains=@Markdown
+"syntax include @Markdown syntax/markdown.vim
--- /dev/null
+syn region texRefZone matchgroup=texRefZone start="\\[acefmptl]label{" end="}\|%stopzone\>" contains=@texRefGroup
+syn region texRefZone matchgroup=texRefZone start="\\[aAcCeEfFmMpPtTlL][rvx]\=ref{" end="}\|%stopzone\>" contains=@texRefGroup
+
+syn region texMyForeign matchgroup=texTypeStyle start="\\foreign{" end="}" contains=texMatcher,@NoSpell
+syn cluster texFoldGroup add=texMyForeign
+syn cluster texMatchGroup add=texMyForeign
+
+syn region texMyTTerm matchgroup=texTypeStyle start="\\tterm{" end="}" contains=texMatcher,@NoSpell
+syn cluster texFoldGroup add=texMyTTerm
+syn cluster texMatchGroup add=texMyTTerm
+
+syn region texTodoCmd matchgroup=texTodoCmd start="\\todo{" end="}\|%stopzone\>" contains=@texMatchGroup,@NoSpell,texMatcher
+syn cluster texFoldGroup add=texTodoCmd
+syn cluster texMatchGroup add=texTodoCmd
+hi def link texTodoCmd texTodo
+
+syn match texCiteNeeded '\\citeneeded\ze:\=\>'
+syn cluster texFoldGroup add=texCiteNeeded
+syn cluster texMatchGroup add=texCiteNeeded
+hi def link texCiteNeeded texTodo
+
+syn region texHighlit matchgroup=texHighlit start="\\highlit{" end="}\|%stopzone\>" contains=@texMatchGroup
+syn cluster texFoldGroup add=texHighlit
+syn cluster texMatchGroup add=texHighlit
+hi def link texHighlit Highlit
+
+syn region texDLMsg matchgroup=texDLMsg start="\\d[lp]msg{" end="}\|%stopzone\>" contains=@NoSpell
+syn cluster texFoldGroup add=texDLMsg
+syn cluster texMatchGroup add=texDLMsg
+
+syn match texMySection '^\\section{.*'
+syn match texMySubSection '^\\subsection{.*'
+syn match texMySubSubSection '^\\subsubsection{.*'
+syn match texMyParagraph '^\\paragraph{.*'
+hi texMySection ctermbg=gray ctermfg=white cterm=bold term=reverse
+hi texMySubSection ctermbg=cyan ctermfg=black cterm=none term=reverse
+hi texMySubSubSection ctermbg=none ctermfg=blue cterm=bold term=reverse
+hi texMyParagraph ctermbg=none ctermfg=black cterm=bold term=reverse
--- /dev/null
+/usr/share/vim/addons/autoload/airline.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/async.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/builder.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/debug.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/ale.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/branch.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/bufferline.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/capslock.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/commandt.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/csv.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/ctrlp.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/ctrlspace.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/cursormode.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/default.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/denite.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/eclim.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/example.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/fugitiveline.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/grepper.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/gutentags.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/hunks.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/keymap.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/languageclient.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/localsearch.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/neomake.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/netrw.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/nrrwrgn.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/obsession.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/po.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/promptline.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/quickfix.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/syntastic.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tabline.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tabline/autoshow.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tabline/buffers.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tabline/buflist.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tabline/builder.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tabline/ctrlspace.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tabline/formatters/default.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tabline/formatters/jsformatter.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tabline/formatters/tabnr.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tabline/formatters/unique_tail.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tabline/formatters/unique_tail_improved.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tabline/tabs.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tabline/xtabline.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tagbar.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/term.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/tmuxline.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/undotree.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/unicode.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/unite.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/vimagit.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/vimtex.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/virtualenv.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/whitespace.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/windowswap.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/wordcount.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/wordcount/formatters/default.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/xkblayout.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/extensions/ycm.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/highlighter.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/init.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/msdos.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/parts.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/section.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/themes.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/themes/dark.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/airline/util.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim-scripts/autoload/deb.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/ledger.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/pathogen.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/autoload/tabular.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/__init__.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_asciidoc.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_cwiki.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_dokuwiki.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_fmr.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_fmr1.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_fmr2.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_fmr3.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_hashes.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_html.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_inverseAtx.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_latex.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_latexDtx.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_markdown.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_org.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_pandoc.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_paragraphBlank.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_paragraphIndent.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_paragraphNoIndent.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_python.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_rest.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_taskpaper.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_thevimoutliner.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_txt2tags.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_viki.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_vimoutliner.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_vimwiki.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_mode_wiki.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/autoload/voom/voom_vimplugin2657/voom_vim.py
\ No newline at end of file
--- /dev/null
+This is a mirror of http://www.vim.org/scripts/script.php?script_id=4364
+
+:ExplainPattern {pattern} or
+:ExplainPattern {register}
+
+ parse the given Vim {pattern} and print a line of help
+ (with color) for each found pattern item. Nested
+ items get extra indent.
+
+ A single-char argument is used as {register} argument:
+ / explain the last search pattern
+ * explain pattern from the clipboard
+ a explain pattern from register a
+
+
+Example: :ExplainPattern *
+
+Register: *
+Pattern: \C^\%(\\\%(@<.\|%[dxouU[(^$V#<>]\=\|z[1-9se(]\|@[>=!]\|_[[^$.]\=\|.\)\|.\)
+ \C match case while matching the pattern
+ ^ match at start of line (or string)
+ \%( start of non-capturing group
+ | \\ literal string (1 atom(s))
+ | \%( start of non-capturing group
+ | | @< literal string (2 atom(s))
+ | | . match any character
+ | | \| OR branch
+ | | % literal string (1 atom(s))
+ | | [dxouU[(^$V#<>] collection
+ | | \= (multi) zero or one of the preceding atom
+ | | \| OR branch
+ | | z literal string (1 atom(s))
+ | | [1-9se(] collection
+ | | \| OR branch
+ | | @ literal string (1 atom(s))
+ | | [>=!] collection
+ | | \| OR branch
+ | | _ literal string (1 atom(s))
+ | | [[^$.] collection
+ | | \= (multi) zero or one of the preceding atom
+ | | \| OR branch
+ | | . match any character
+ | \) end of group
+ | \| OR branch
+ | . match any character
+ \) end of group
+
+2013 Jan 17
--- /dev/null
+" File: explainpat.vim
+" Created: 2011 Nov 02
+" Last Change: 2017 Dec 15
+" Version: 0.9
+" Author: Andy Wokula <anwoku@yahoo.de>
+" License: Vim License, see :h license
+
+" Implements :ExplainPattern [pattern]
+
+" History: "{{{
+" 2013 Jun 21 AND/OR text is confusing, removed
+" 2013 Apr 20 ...
+"}}}
+
+" TODO {{{
+" - add something like "(empty) ... match everywhere" ... example: '\v(&&|str)'
+" Pattern: \v(&&|str)
+" Magic Pattern: \(\&\&\|str\)
+" \( start of first capturing group
+" | (empty) match everywhere
+" | \& AND
+" | (empty) match everywhere
+" | \& AND
+" | (empty) match everywhere
+" | \| OR
+" | str literal string (3 atom(s))
+" \) end of group
+" - more testing, completeness check
+" ? detailed collections
+" ? literal string: also print the unescaped magic items
+" ? literal string: show leading/trailing spaces
+"
+"}}}
+
+" Init Folklore {{{
+let s:cpo_save = &cpo
+set cpo&vim
+let g:explainpat#loaded = 1
+"}}}
+
+func! explainpat#ExplainPattern(cmd_arg, ...) "{{{
+ " {a:1} alternative help printer object (caution, no sanity check)
+ " (for test running)
+ if a:cmd_arg == ""
+ " let pattern_str = nwo#vis#Get()
+ echo "(usage) :ExplainPattern [{register} | {pattern}]"
+ return
+ elseif strlen(a:cmd_arg) == 1 && a:cmd_arg =~ '["@0-9a-z\-:.*+/]'
+ echo 'Register:' a:cmd_arg
+ let pattern_str = getreg(a:cmd_arg)
+ else
+ let pattern_str = a:cmd_arg
+ endif
+
+ echo printf('Pattern: %s', pattern_str)
+ let magicpat = nwo#magic#MakeMagic(pattern_str)
+ if magicpat !=# pattern_str
+ echo printf('Magic Pattern: %s', magicpat)
+ endif
+
+ " we need state:
+ " set flag when in `\%[ ... ]' (optionally matched atoms):
+ let s:in_opt_atoms = 0
+ " counter for `\(':
+ let s:capture_group_nr = 0
+ " >=1 at pos 0 or after '\|', '\&', '\(', '\%(' or '\n'; else 0 or less:
+ let s:at_begin_of_pat = 1
+
+ let hulit = a:0>=1 && type(a:1)==s:DICT ? a:1 : explainpat#NewHelpPrinter()
+ call hulit.AddIndent(' ')
+ let bull = s:NewTokenBiter(magicpat)
+ while !bull.AtEnd()
+ let item = bull.Bite(s:magic_item_pattern)
+ if item != ''
+ let Doc = get(s:doc, item, '')
+ if empty(Doc)
+ call hulit.AddLiteral(item)
+ elseif type(Doc) == s:STRING
+ call hulit.Print(item, Doc)
+ elseif type(Doc) == s:FUNCREF
+ call call(Doc, [bull, hulit, item])
+ elseif type(Doc) == s:LIST
+ call call(Doc[0], [bull, hulit, item, Doc[1]])
+ endif
+ let s:at_begin_of_pat -= 1
+ else
+ echoerr printf('ExplainPattern: cannot parse "%s"', bull.Rest())
+ break
+ endif
+ unlet Doc
+ endwhile
+ call hulit.FlushLiterals()
+endfunc "}}}
+
+" s: types {{{
+let s:STRING = type("")
+let s:DICT = type({})
+let s:FUNCREF = type(function("tr"))
+let s:LIST = type([])
+" }}}
+
+let s:magic_item_pattern = '\C^\%(\\\%(%#=\|%[dxouU[(^$V#<>]\=\|z[1-9se(]\|@[>=!]\=\|_[[^$.]\=\|.\)\|.\)'
+
+let s:doc = {} " {{{
+" this is all the help data ...
+" strings, funcrefs and intermixed s:DocFoo() functions
+" strongly depends on s:magic_item_pattern
+
+func! s:DocOrBranch(bull, hulit, item) "{{{
+ call a:hulit.RemIndent()
+ call a:hulit.Print(a:item, "OR")
+ call a:hulit.AddIndent(' ')
+ let s:at_begin_of_pat = 2
+endfunc "}}}
+
+let s:doc['\|'] = function("s:DocOrBranch")
+
+func! s:DocBeginOfPat(bull, hulit, item, msg) "{{{
+ call a:hulit.Print(a:item, a:msg)
+ let s:at_begin_of_pat = 2
+endfunc "}}}
+
+let s:doc['\&'] = [function("s:DocBeginOfPat"), "AND"]
+
+let s:ord = split('n first second third fourth fifth sixth seventh eighth ninth')
+
+func! s:DocGroupStart(bull, hulit, item) "{{{
+ if a:item == '\%('
+ call a:hulit.Print(a:item, "start of non-capturing group")
+ elseif a:item == '\('
+ let s:capture_group_nr += 1
+ call a:hulit.Print(a:item, printf("start of %s capturing group", get(s:ord, s:capture_group_nr, '(invalid)')))
+ else " a:item == '\z('
+ call a:hulit.Print(a:item, 'start of "external" group (only usable in :syn-region)')
+ endif
+ call a:hulit.AddIndent('| ', ' ')
+ let s:at_begin_of_pat = 2
+endfunc "}}}
+func! s:DocGroupEnd(bull, hulit, item) "{{{
+ call a:hulit.RemIndent(2)
+ call a:hulit.Print(a:item, "end of group")
+endfunc "}}}
+
+let s:doc['\('] = function("s:DocGroupStart")
+let s:doc['\%('] = function("s:DocGroupStart")
+let s:doc['\)'] = function("s:DocGroupEnd")
+" let s:doc['\z('] = "only in syntax scripts"
+let s:doc['\z('] = function("s:DocGroupStart")
+
+func! s:DocStar(bull, hulit, item) "{{{
+ if s:at_begin_of_pat >= 1
+ " call a:hulit.Print(a:item, "(at begin of pattern) literal `*'")
+ call a:hulit.AddLiteral(a:item)
+ else
+ call a:hulit.Print(a:item, "(multi) zero or more of the preceding atom")
+ endif
+endfunc "}}}
+
+" let s:doc['*'] = "(multi) zero or more of the preceding atom"
+let s:doc['*'] = function("s:DocStar")
+
+let s:doc['\+'] = "(multi) one or more of the preceding atom"
+let s:doc['\='] = "(multi) zero or one of the preceding atom"
+let s:doc['\?'] = "(multi) zero or one of the preceding atom"
+" let s:doc['\{'] = "(multi) N to M, greedy"
+" let s:doc['\{-'] = "(multi) N to M, non-greedy"
+
+func! s:DocBraceMulti(bull, hulit, item) "{{{
+ let rest = a:bull.Bite('^-\=\d*\%(,\d*\)\=\\\=}')
+ if rest != ""
+ if rest == '-}'
+ call a:hulit.Print(a:item. rest, "non-greedy version of `*'")
+ elseif rest =~ '^-'
+ call a:hulit.Print(a:item. rest, "(multi) N to M, non-greedy")
+ else
+ call a:hulit.Print(a:item. rest, "(multi) N to M, greedy")
+ endif
+ else
+ call a:hulit.Print(a:item, "(invalid) incomplete `\\{...}' item")
+ endif
+endfunc "}}}
+
+let s:doc['\{'] = function("s:DocBraceMulti")
+
+let s:doc['\@>'] = "(multi) match preceding atom like a full pattern"
+let s:doc['\@='] = "(assertion) require match for preceding atom"
+let s:doc['\@!'] = "(assertion) forbid match for preceding atom"
+
+func! s:DocBefore(bull, hulit, item) "{{{
+ let rest = a:bull.Bite('^\d*\%[<[=!]]')
+ if rest == "<="
+ call a:hulit.Print(a:item.rest, "(assertion) require match for preceding atom to the left")
+ elseif rest == "<!"
+ call a:hulit.Print(a:item.rest, "(assertion) forbid match for preceding atom to the left")
+ elseif rest =~ '^\d\+<='
+ call a:hulit.Print(a:item.rest, printf("(assertion) like `\\@<=', looking back at most %s bytes (since Vim 7.3.1037)", s:SillyCheck(matchstr(rest, '\d\+'))))
+ elseif rest =~ '^\d\+<!'
+ call a:hulit.Print(a:item.rest, printf("(assertion) like `\\@<!', looking back at most %s bytes (since Vim 7.3.1037)", s:SillyCheck(matchstr(rest, '\d\+'))))
+ else
+ call a:hulit.Print(a:item.rest, "(invalid) incomplete item")
+ endif
+endfunc "}}}
+
+let s:doc['\@'] = function("s:DocBefore")
+
+func! s:DocCircumFlex(bull, hulit, item) "{{{
+ if s:at_begin_of_pat >= 1
+ call a:hulit.Print(a:item, "(assertion) require match at start of line")
+ " after `^' is not at begin of pattern ... handle special case `^*' here:
+ if a:bull.Bite('^\*') == "*"
+ call a:hulit.AddLiteral("*")
+ endif
+ else
+ " call a:hulit.Print(a:item, "(not at begin of pattern) literal `^'")
+ call a:hulit.AddLiteral(a:item)
+ endif
+endfunc "}}}
+
+" let s:doc['^'] = "(assertion) require match at start of line"
+let s:doc['^'] = function("s:DocCircumFlex")
+
+let s:doc['\_^'] = "(assertion) like `^', allowed anywhere in the pattern"
+
+func! s:DocDollar(bull, hulit, item) "{{{
+ if a:bull.Rest() =~ '^$\|^\\[&|)n]'
+ call a:hulit.Print(a:item, "(assertion) require match at end of line")
+ else
+ call a:hulit.AddLiteral(a:item)
+ endif
+endfunc "}}}
+
+" let s:doc['$'] = "(assertion) require match at end of line"
+let s:doc['$'] = function("s:DocDollar")
+
+let s:doc['\_$'] = "(assertion) like `$', allowed anywhere in the pattern"
+let s:doc['.'] = "match any character"
+let s:doc['\_.'] = "match any character or newline"
+
+func! s:DocUnderscore(bull, hulit, item) "{{{
+ let cclass = a:bull.Bite('^\a')
+ if cclass != ''
+ let cclass_doc = get(s:doc, '\'. cclass, '(invalid character class)')
+ call a:hulit.Print(a:item. cclass, printf('%s or end-of-line', cclass_doc))
+ else
+ call a:hulit.Print(a:item, "(invalid) `\\_' should be followed by a letter or `[...]'")
+ " echoerr printf('ExplainPattern: cannot parse %s', a:item. matchstr(a:bull.Rest(), '.'))
+ endif
+endfunc "}}}
+
+let s:doc['\_'] = function("s:DocUnderscore")
+let s:doc['\<'] = "(assertion) require match at begin of word, :h word"
+let s:doc['\>'] = "(assertion) require match at end of word, :h word"
+let s:doc['\zs'] = "set begin of match here"
+let s:doc['\ze'] = "set end of match here"
+let s:doc['\%^'] = "(assertion) match at begin of buffer"
+let s:doc['\%$'] = "(assertion) match at end of buffer"
+let s:doc['\%V'] = "(assertion) match within the Visual area"
+let s:doc['\%#'] = "(assertion) match with cursor position"
+
+func! s:DocRegexEngine(bull, hulit, item) "{{{
+ let engine = a:bull.Bite('^[012]')
+ if engine == "0"
+ call a:hulit.Print(a:item.engine, 'Force automatic selection of the regexp engine (since v7.3.970).')
+ elseif engine == "1"
+ call a:hulit.Print(a:item.engine, 'Force using the old engine (since v7.3.970).')
+ elseif engine == "2"
+ call a:hulit.Print(a:item.engine, 'Force using the NFA engine (since v7.3.970).')
+ else
+ call a:hulit.Print(a:item, '(invalid) \%#= can only be followed by 0, 1, or 2')
+ endif
+endfunc "}}}
+
+let s:doc['\%#='] = function("s:DocRegexEngine")
+
+" \%'m \%<'m \%>'m
+" \%23l \%<23l \%>23l
+" \%23c \%<23c \%>23c
+" \%23v \%<23v \%>23v
+" backslash percent at/before/after
+func! s:DocBspercAt(bull, hulit, item) "{{{
+ let rest = a:bull.Bite('^\%(''.\|\d\+[lvc]\)\C')
+ if rest[0] == "'"
+ call a:hulit.Print(a:item.rest, "(assertion) match with position of mark ". rest[1])
+ else
+ let number = rest[:-2]
+ let type = rest[-1:]
+ if type ==# "l"
+ call a:hulit.Print(a:item.rest, "match in line ". number)
+ elseif type ==# "c"
+ call a:hulit.Print(a:item.rest, "match in column ". number)
+ elseif type ==# "v"
+ call a:hulit.Print(a:item.rest, "match in virtual column ". number)
+ else
+ call a:hulit.Print(a:item.rest, "(invalid) incomplete `\\%' item")
+ " echoerr printf('ExplainPattern: incomplete item %s', a:item. rest)
+ endif
+ endif
+endfunc "}}}
+func! s:DocBspercBefore(bull, hulit, item) "{{{
+ let rest = a:bull.Bite('^\%(''.\|\d\+[lvc]\)\C')
+ if rest[0] == "'"
+ call a:hulit.Print(a:item.rest, "(assertion) match before position of mark ". rest[1])
+ else
+ let number = rest[:-2]
+ let type = rest[-1:]
+ if type ==# "l"
+ call a:hulit.Print(a:item.rest, printf("match above line %d (towards start of buffer)", number))
+ elseif type ==# "c"
+ call a:hulit.Print(a:item.rest, "match before column ". number)
+ elseif type ==# "v"
+ call a:hulit.Print(a:item.rest, "match before virtual column ". number)
+ else
+ call a:hulit.Print(a:item.rest, "(invalid) incomplete `\\%<' item")
+ " echoerr printf('ExplainPattern: incomplete item %s', a:item. rest)
+ endif
+ endif
+endfunc "}}}
+func! s:DocBspercAfter(bull, hulit, item) "{{{
+ let rest = a:bull.Bite('^\%(''.\|\d\+[lvc]\)\C')
+ if rest[0] == "'"
+ call a:hulit.Print(a:item.rest, "(assertion) match after position of mark ". rest[1])
+ else
+ let number = rest[:-2]
+ let type = rest[-1:]
+ if type ==# "l"
+ call a:hulit.Print(a:item.rest, printf("match below line %d (towards end of buffer)", number))
+ elseif type ==# "c"
+ call a:hulit.Print(a:item.rest, "match after column ". number)
+ elseif type ==# "v"
+ call a:hulit.Print(a:item.rest, "match after virtual column ". number)
+ else
+ call a:hulit.Print(a:item.rest, "(invalid) incomplete `\\%>' item")
+ " echoerr printf('ExplainPattern: incomplete item %s', a:item. rest)
+ endif
+ endif
+endfunc "}}}
+
+let s:doc['\%'] = function("s:DocBspercAt")
+let s:doc['\%<'] = function("s:DocBspercBefore")
+let s:doc['\%>'] = function("s:DocBspercAfter")
+
+let s:doc['\i'] = "identifier character (see 'isident' option)"
+let s:doc['\I'] = "like \"\\i\", but excluding digits"
+let s:doc['\k'] = "keyword character (see 'iskeyword' option)"
+let s:doc['\K'] = "like \"\\k\", but excluding digits"
+let s:doc['\f'] = "file name character (see 'isfname' option)"
+let s:doc['\F'] = "like \"\\f\", but excluding digits"
+let s:doc['\p'] = "printable character (see 'isprint' option)"
+let s:doc['\P'] = "like \"\\p\", but excluding digits"
+let s:doc['\s'] = "whitespace character: <Space> and <Tab>"
+let s:doc['\S'] = "non-whitespace character; opposite of \\s"
+let s:doc['\d'] = "digit: [0-9]"
+let s:doc['\D'] = "non-digit: [^0-9]"
+let s:doc['\x'] = "hex digit: [0-9A-Fa-f]"
+let s:doc['\X'] = "non-hex digit: [^0-9A-Fa-f]"
+let s:doc['\o'] = "octal digit: [0-7]"
+let s:doc['\O'] = "non-octal digit: [^0-7]"
+let s:doc['\w'] = "word character: [0-9A-Za-z_]"
+let s:doc['\W'] = "non-word character: [^0-9A-Za-z_]"
+let s:doc['\h'] = "head of word character: [A-Za-z_]"
+let s:doc['\H'] = "non-head of word character: [^A-Za-z_]"
+let s:doc['\a'] = "alphabetic character: [A-Za-z]"
+let s:doc['\A'] = "non-alphabetic character: [^A-Za-z]"
+let s:doc['\l'] = "lowercase character: [a-z]"
+let s:doc['\L'] = "non-lowercase character: [^a-z]"
+let s:doc['\u'] = "uppercase character: [A-Z]"
+let s:doc['\U'] = "non-uppercase character: [^A-Z]"
+
+let s:doc['\e'] = "match <Esc>"
+let s:doc['\t'] = "match <Tab>"
+let s:doc['\r'] = "match <CR>"
+let s:doc['\b'] = "match CTRL-H"
+let s:doc['\n'] = [function("s:DocBeginOfPat"), "match a newline"]
+let s:doc['~'] = "match the last given substitute string"
+let s:doc['\1'] = "match first captured string"
+let s:doc['\2'] = "match second captured string"
+let s:doc['\3'] = "match third captured string"
+let s:doc['\4'] = "match fourth captured string "
+let s:doc['\5'] = "match fifth captured string"
+let s:doc['\6'] = "match sixth captured string"
+let s:doc['\7'] = "match seventh captured string"
+let s:doc['\8'] = "match eighth captured string"
+let s:doc['\9'] = "match ninth captured string"
+
+let s:doc['\z1'] = 'match same string matched by first "external" group'
+let s:doc['\z2'] = 'match same string matched by second "external" group'
+let s:doc['\z3'] = 'match same string matched by third "external" group'
+let s:doc['\z4'] = 'match same string matched by fourth "external" group '
+let s:doc['\z5'] = 'match same string matched by fifth "external" group'
+let s:doc['\z6'] = 'match same string matched by sixth "external" group'
+let s:doc['\z7'] = 'match same string matched by seventh "external" group'
+let s:doc['\z8'] = 'match same string matched by eighth "external" group'
+let s:doc['\z9'] = 'match same string matched by ninth "external" group'
+
+" from MakeMagic()
+" skip the rest of a collection
+let s:coll_skip_pat = '^\^\=]\=\%(\%(\\[\^\]\-\\bertn]\|\[:\w\+:]\|\[=.=]\|\[\..\.]\|[^\]]\)\@>\)*]'
+
+func! s:DocCollection(bull, hulit, item) "{{{
+ let collstr = a:bull.Bite(s:coll_skip_pat)
+ if collstr == "" || collstr == "]"
+ call a:hulit.AddLiteral('['. collstr)
+ else
+ let inverse = collstr =~ '^\^'
+ let with_nl = a:item == '\_['
+ let descr = inverse ? printf('collection not matching [%s', collstr[1:]) : 'collection'
+ let descr_nl = printf("%s%s", (inverse && with_nl ? ', but' : ''), (with_nl ? ' with end-of-line added' : ''))
+ call a:hulit.Print(a:item. collstr, descr. descr_nl)
+ endif
+endfunc "}}}
+
+let s:doc['['] = function("s:DocCollection")
+let s:doc['\_['] = function("s:DocCollection")
+
+func! s:DocOptAtoms(bull, hulit, item) "{{{
+ if a:item == '\%['
+ call a:hulit.Print(a:item, "start a sequence of optionally matched atoms")
+ let s:in_opt_atoms = 1
+ call a:hulit.AddIndent('. ')
+ else " a:item == ']'
+ if s:in_opt_atoms
+ call a:hulit.RemIndent()
+ call a:hulit.Print(a:item, "end of optionally matched atoms")
+ let s:in_opt_atoms = 0
+ else
+ call a:hulit.AddLiteral(a:item)
+ endif
+ endif
+endfunc "}}}
+
+" let s:doc['\%['] = "start a sequence of optionally matched atoms"
+let s:doc['\%['] = function("s:DocOptAtoms")
+let s:doc[']'] = function("s:DocOptAtoms")
+
+func! s:DocAnywhere(bull, hulit, item, msg) "{{{
+ call a:hulit.Print(a:item, a:msg)
+ " keep state:
+ let s:at_begin_of_pat += 1
+endfunc "}}}
+
+let s:doc['\c'] = [function("s:DocAnywhere"), "ignore case while matching the pattern"]
+let s:doc['\C'] = [function("s:DocAnywhere"), "match case while matching the pattern"]
+let s:doc['\Z'] = [function("s:DocAnywhere"), "ignore composing characters in the pattern"]
+
+" \%d 123
+" \%x 2a
+" \%o 0377
+" \%u 20AC
+" \%U 1234abcd
+
+func! s:DocBspercDecimal(bull, hulit, item) "{{{
+ let number = a:bull.Bite('^\d\{,3}')
+ let char = strtrans(nr2char(str2nr(number)))
+ call a:hulit.Print(a:item. number, printf("match character specified by decimal number %s (%s)", number, char))
+endfunc "}}}
+func! s:DocBspercHexTwo(bull, hulit, item) "{{{
+ let number = a:bull.Bite('^\x\{,2}')
+ let char = strtrans(nr2char(str2nr(number,16)))
+ call a:hulit.Print(a:item. number, printf("match character specified with hex number 0x%s (%s)", number, char))
+endfunc "}}}
+func! s:DocBspercOctal(bull, hulit, item) "{{{
+ let number = a:bull.Bite('^\o\{,4}')
+ let char = strtrans(nr2char(str2nr(number,8)))
+ call a:hulit.Print(a:item. number, printf("match character specified with octal number 0%s (%s)", substitute(number, '^0*', '', ''), char))
+endfunc "}}}
+func! s:DocBspercHexFour(bull, hulit, item) "{{{
+ let number = a:bull.Bite('^\x\{,4}')
+ let char = has("multi_byte_encoding") ? ' ('. strtrans(nr2char(str2nr(number,16))).')' : ''
+ call a:hulit.Print(a:item. number, printf("match character specified with hex number 0x%s%s", number, char))
+endfunc "}}}
+func! s:DocBspercHexEight(bull, hulit, item) "{{{
+ let number = a:bull.Bite('^\x\{,8}')
+ let char = has("multi_byte_encoding") ? ' ('. strtrans(nr2char(str2nr(number,16))).')' : ''
+ call a:hulit.Print(a:item. number, printf("match character specified with hex number 0x%s%s", number, char))
+endfunc "}}}
+
+let s:doc['\%d'] = function("s:DocBspercDecimal") " 123
+let s:doc['\%x'] = function("s:DocBspercHexTwo") " 2a
+let s:doc['\%o'] = function("s:DocBspercOctal") " 0377
+let s:doc['\%u'] = function("s:DocBspercHexFour") " 20AC
+let s:doc['\%U'] = function("s:DocBspercHexEight") " 1234abcd
+
+" \m
+" \M
+" \v
+" \V
+"}}}
+
+" {{{
+func! s:SillyCheck(digits) "{{{
+ return strlen(a:digits) < 10 ? a:digits : '{silly large number}'
+endfunc "}}}
+" }}}
+
+func! explainpat#NewHelpPrinter() "{{{
+ let obj = {}
+ let obj.literals = ''
+ let obj.indents = []
+ let obj.len = 0 " can be negative (!)
+
+ func! obj.Print(str, ...) "{{{
+ call self.FlushLiterals()
+ let indstr = join(self.indents, '')
+ echohl Comment
+ echo indstr
+ echohl None
+ if a:0 == 0
+ echon a:str
+ else
+ " echo indstr. printf("`%s' %s", a:str, a:1)
+ echohl PreProc
+ echon printf("%-10s", a:str)
+ echohl None
+ echohl Comment
+ echon printf(" %s", a:1)
+ echohl None
+ endif
+ endfunc "}}}
+
+ func! obj.AddLiteral(item) "{{{
+ let self.literals .= a:item
+ endfunc "}}}
+
+ func! obj.FlushLiterals() "{{{
+ if self.literals == ''
+ return
+ endif
+ let indstr = join(self.indents, '')
+ echohl Comment
+ echo indstr
+ echohl None
+ if self.literals =~ '^\s\|\s$'
+ echon printf("%-10s", '"'. self.literals. '"')
+ else
+ echon printf("%-10s", self.literals)
+ endif
+ echohl Comment
+ echon " literal string"
+ if exists("*strchars")
+ if self.literals =~ '\\'
+ let self.literals = substitute(self.literals, '\\\(.\)', '\1', 'g')
+ endif
+ let spconly = self.literals =~ '[^ ]' ? '' : ', spaces only'
+ let nlit = strchars(self.literals)
+ echon " (". nlit. (nlit==1 ? " atom" : " atoms"). spconly.")"
+ endif
+ echohl None
+ let self.literals = ''
+ endfunc "}}}
+
+ func! obj.AddIndent(...) "{{{
+ call self.FlushLiterals()
+ if self.len >= 0
+ call extend(self.indents, copy(a:000))
+ elseif self.len + a:0 >= 1
+ call extend(self.indents, a:000[-(self.len+a:0):])
+ endif
+ let self.len += a:0
+ endfunc "}}}
+
+ func! obj.RemIndent(...) "{{{
+ call self.FlushLiterals()
+ if a:0 == 0
+ if self.len >= 1
+ call remove(self.indents, -1)
+ endif
+ let self.len -= 1
+ else
+ if self.len > a:1
+ call remove(self.indents, -a:1, -1)
+ elseif self.len >= 1
+ call remove(self.indents, 0, -1)
+ endif
+ let self.len -= a:1
+ endif
+ endfunc "}}}
+
+ return obj
+endfunc "}}}
+
+func! s:NewTokenBiter(str) "{{{
+ " {str} string to eat pieces from
+ let obj = {'str': a:str}
+
+ " consume piece from start of input matching {pat}
+ func! obj.Bite(pat) "{{{
+ " {pat} should start with '^'
+ let bite = matchstr(self.str, a:pat)
+ let self.str = strpart(self.str, strlen(bite))
+ return bite
+ endfunc "}}}
+
+ " get the unparsed rest of input (not consuming)
+ func! obj.Rest() "{{{
+ return self.str
+ endfunc "}}}
+
+ " check if end of input reached
+ func! obj.AtEnd() "{{{
+ return self.str == ""
+ endfunc "}}}
+
+ return obj
+endfunc "}}}
+
+" Modeline: {{{1
+let &cpo = s:cpo_save
+unlet s:cpo_save
+" vim:ts=8:fdm=marker:
--- /dev/null
+" File: makemagic.vim
+" Created: 2011 Apr 18
+" Last Change: 2013 Mar 06
+" Rev Days: 6
+" Author: Andy Wokula <anwoku@yahoo.de>
+" License: Vim License, see :h license
+" Version: 0.3
+
+"" Comments {{{
+
+" nwo#magic#MakeMagic({pat})
+"
+" remove embedded switches (\v, \m, \M and \V) from pattern {pat} by
+" converting {pat} into a purely magic pattern. Return the converted
+" pattern.
+"
+
+" TODO
+" - recognize [#-\\]], with spaces: [ #-\ \] ]
+" (collection ends at second ']')
+" + \v\z( => \z(
+
+" 2011 Nov 01 copied from asneeded\makemagic.vim
+" now asneeded\nwo\makemagic.vim (comments there!)
+"}}}
+
+" Init Folklore {{{
+let s:cpo_save = &cpo
+set cpo&vim
+let g:nwo#magic#loaded = 1
+"}}}
+
+func! nwo#magic#MakeMagic(pat, ...) "{{{
+ " {pat} (string)
+ " {a:1} (boolean) initial magic mode (default follows the 'magic' option)
+
+ if a:0>=1 ? a:1 : &magic
+ let magic_mode = 'm'
+ let bracket_is_magic = 1
+ else
+ let magic_mode = 'M'
+ let bracket_is_magic = 0
+ endif
+ let result_pat = ''
+ let endpos = strlen(a:pat)
+
+ let spos = 0
+ while spos >= 0 && spos < endpos
+ let mc1 = a:pat[spos]
+ let mc2 = a:pat[spos+1]
+
+ let collection = 0
+ if mc1 == '\'
+ if mc2 == '[' && !bracket_is_magic
+ let collection = 1
+ let spos += 1
+ elseif mc2 =~ '[vmMV]'
+ let magic_mode = mc2
+ let bracket_is_magic = mc2 =~# '[vm]'
+ let spos += 2
+ elseif mc2 == '_'
+ let mc3 = a:pat[spos+2]
+ if mc3 == '['
+ let collection = 1
+ endif
+ endif
+ elseif mc1 == '[' && bracket_is_magic
+ let collection = 1
+ endif
+
+ if collection
+ let nextpos = matchend(a:pat, s:collection_skip_pat, spos)
+ if nextpos >= 0
+ let magpart = strpart(a:pat, spos, nextpos-spos)
+ else
+ let magpart = strpart(a:pat, spos)
+ endif
+ else
+ let nextpos = match(a:pat, s:switchpat[magic_mode], spos)
+ if nextpos >= 0
+ if nextpos == spos
+ continue " optional
+ endif
+ let part = strpart(a:pat, spos, nextpos-spos)
+ else
+ let part = strpart(a:pat, spos)
+ endif
+ if magic_mode ==# 'v'
+ let magpart = substitute(part, s:vmagic_items_pat, '\=s:ToggleVmagicBslash(submatch(0))', 'g')
+ elseif magic_mode ==# 'm'
+ let magpart = part
+ elseif magic_mode ==# 'M'
+ let s:rem_bslash_before = '.*[~'
+ " the first two branches are only to eat the matches:
+ let magpart = substitute(part, '\\%\[\|\\_\\\=.\|\\.\|[.*[~]', '\=s:ToggleBslash(submatch(0))', 'g')
+ elseif magic_mode ==# 'V'
+ let s:rem_bslash_before = '^$.*[~'
+ let magpart = substitute(part, '\\%\[\|\\_\\\=.\|\\.\|[\^$.*[~]', '\=s:ToggleBslash(submatch(0))', 'g')
+ endif
+ endif
+
+ let result_pat .= magpart
+ let spos = nextpos
+ endwhile
+
+ return result_pat
+endfunc "}}}
+
+" s:variables {{{
+
+" pattern to match very magic items:
+let s:vmagic_items_pat = '\C\\\%(z(\|.\)\|%\%([#$(UV[\^cdlouvx]\|[<>]\=\%(''.\|\d\+[clv]\)\)\|[&()+<=>?|]\|@\%([!=>]\|<[!=]\)\|{'
+
+" not escaped - require an even number of '\' (zero or more) to the left:
+let s:not_escaped = '\%(\%(^\|[^\\]\)\%(\\\\\)*\)\@<='
+
+" prohibit an unescaped match for '%' before what follows (used when trying
+" to find '[', but not '%[', :h /\%[ )
+let s:not_vmagic_opt_atoms = '\%(\%(^\|[^\\]\)\%(\\\\\)*%\)\@<!'
+
+" not opt atoms - (used when trying to find '[', but not '\%[')
+let s:not_opt_atoms = '\%(\%(^\|[^\\]\)\%(\\\\\)*\\%\)\@<!'
+
+" match a switch (\V,\M,\m,\v) or the start of a collection:
+let s:switchpat = {
+ \ "v": s:not_escaped.'\%('.s:not_vmagic_opt_atoms.'\[\|\\[vmMV]\)',
+ \ "m": s:not_escaped.'\%('.s:not_opt_atoms . '\[\|\\[vmMV]\)',
+ \ "M": s:not_escaped.'\%(\\_\=\[\|\\[vmMV]\)',
+ \ "V": s:not_escaped.'\%(\\_\=\[\|\\[vmMV]\)'}
+
+" skip over a collection (starting at '[' (same for all magic modes) or
+" starting at '\_[' (same for all modes))
+let s:collection_skip_pat = '^\%(\\_\)\=\[\^\=]\=\%(\%(\\[\^\]\-\\bertn]\|\[:\w\+:]\|\[=.=]\|\[\..\.]\|[^\]]\)\@>\)*]'
+
+" }}}
+
+" for magic modes 'V' and 'M'
+func! s:ToggleBslash(patitem) "{{{
+ " {patitem} magic char or '\'.char
+ if a:patitem =~ '^.$'
+ return '\'.a:patitem
+ else
+ let mchar = matchstr(a:patitem, '^\\\zs.')
+ if stridx(s:rem_bslash_before, mchar) >= 0
+ return mchar
+ else
+ return a:patitem
+ endif
+ endif
+endfunc "}}}
+
+func! s:ToggleVmagicBslash(patitem) "{{{
+ " {patitem} magic char or '\'.char
+ if a:patitem =~ '^\\'
+ let mchar = a:patitem[1]
+ if mchar =~ '[\^$.*[\]~\\[:alnum:]_]'
+ return a:patitem
+ else
+ return mchar
+ endif
+ else
+ return '\'.a:patitem
+ endif
+endfunc "}}}
+
+" Modeline: {{{1
+let &cpo = s:cpo_save
+unlet s:cpo_save
+" vim:ts=8:fdm=marker:
--- /dev/null
+*explainpat.txt* Give detailed help on a regexp pattern.
+
+ For Vim version 7.0. Last change: 2017 Dec 15
+ By Andy Wokula <anwoku@yahoo.de>
+
+ *explainpat* *explainpat.vim*
+ExplainPat is a plugin to inspect a Vim regexp pattern and show a line of help
+for each found regexp item. Purpose is to get a better view on somebody
+else's complex regexp string. It may also help with spotting mistakes.
+
+If you find that it explains something wrong, please drop me an email.
+
+URL http://vim.sourceforge.net/scripts/script.php?script_id=4364
+==============================================================================
+ *:ExplainPattern*
+:ExplainPattern {pattern}
+:ExplainPattern {register}
+ inspect the given Vim {pattern} and print a line of
+ help (with color) for each found pattern item. Nested
+ items get extra indent.
+
+ A single-char argument is used as {register} argument:
+ / explain the last search pattern
+ * explain pattern from the clipboard
+ a explain pattern from register a
+ etc.
+
+>
+ :ExplainPattern \C^\%(\\\%(@<\|%#=\|%[dxouU[(^$V#<>]\=\|z[1-9se(]\|@[>=!]\|_[[^$.]\=\|.\)\|.\)
+
+Notes:
+The pattern is first converted into a purely |magic| pattern using
+|nwo#magic#MakeMagic()|. This means that embedded |/\V| |/\M| |/\m| |/\v|
+specifiers are effectively removed from the explanation.
+
+:ExplainPattern also accepts some invalid patterns: >
+ :ExplainPattern \)
+ Pattern: \)
+ \) end of group
+
+==============================================================================
+TODO:
+? `\%[...]` can be nested? But documentation |/\%[]| says no.
+
+Ideas:
+- If the user already knows regular expressions but of a different kind,
+ explain items in that different language.
+ Other regexp idioms:
+ Perl, Python, Emacs, Java, C#, Sed, Grep;
+ Vim ... very magic, nomagic, very nomagic
+ Possible config var name:
+ g:explainpat_user_knows = "Perl"
+ g:explainpat_background = "Perl"
+ g:explainpat_in_terms_of = "Perl"
+ g:explainpat_language = "Perl"
+
+==============================================================================
+History:
+
+v0.9
++ BF accept `\@123<=` and `\@123<!`
+
+v0.8
+* s:NewHelpPrinter() => explainpat#NewHelpPrinter()
+
+v0.7
++ BF `\{3,4\}` not accepted, only `\{3,4}`
+
+v0.6
++ BF `[]` is a literal string (not a collection)
+
+v0.5
++ BF `$\n^`
++ wording: `\|` is not an "OR branch" (it separates or branches)
++ NF added tests (not part of release)
++ NF accept custom help printer (for testing purpose, could also be used to
+ export HTML etc.)
+
+v0.4
++ BF `[foo` is a literal string
++ BF for |/star|, |/^| and |/$|, distinguish position in the pattern
+ (sometimes these become literal); special cases: `^**`, `^^`, `\c^^`, `$$`,
+ `a\|^b`, `a\&*b`, `[ab`, `\_[ab`, ...
+
+v0.3
++ BF accept `\z(...\)` and `\z[N]`
++ BF accept `[=a=]` and `[.a.]` in collections
+
+v0.2
++ include vim_use suggestions [2012 Dec 19]
+ * for collections [^...], add "not matching [...]"
+ * fix `\%>'a1`
+ * more detailed `\%x31`
+
+v0.1 (initial version)
++ start of "first" capturing group, start of 2nd ...
++ `\|` should get less indent than the branches, do we need to create an
+ AST? ! no, keep it straight forward
++ `\%[...]`
++ `\{`, `\{-`
+
+==============================================================================
+vim:tw=78:fo=tcq2:sts=0:ts=8:sw=8:fdm=marker:fmr=^_\^,^\^:ft=help:
--- /dev/null
+" File: explainpat.vim
+" Created: 2011 Nov 02
+" Last Change: 2013 Mar 08
+" Rev Days: 7
+" Author: Andy Wokula <anwoku@yahoo.de>
+" License: Vim License, see :h license
+" Version: 0.5
+
+" :ExplainPattern [pattern]
+"
+" parse the given Vim [pattern] (default: text in the Visual area) and
+" print a line of help (with color!) for each found pattern item. Nested
+" items get extra indent.
+"
+" A single-char [pattern] argument is used as register argument:
+" / explain the last search pattern
+" * explain pattern from the clipboard
+" a explain pattern from register a
+"
+
+if exists("loaded_explainpat")
+ finish
+endif
+let loaded_explainpat = 1
+
+if v:version < 700
+ echomsg "explainpat: you need at least Vim 7.0"
+ finish
+endif
+
+com! -nargs=? ExplainPattern call explainpat#ExplainPattern(<q-args>)
+
+" Modeline: {{{1
+" vim:ts=8:fdm=marker:
--- /dev/null
+Same as vim's license
--- /dev/null
+# vim-password-store
+Vim niceties for password store ("pass" the standard Unix Password Manager)
+
+This is a fairly straight-forward fork of Tom Ryder's password-store plugin,
+included in the contrib folder for pass and at Tom's cgit store:
+https://git.zx2c4.com/password-store/
+
+I've added some niceties based around a fuller filetype implementation,
+in particular
+
+* unset spell
+* add simple syntax highlighting
+
+I've added some simple shoulder surfing protection via syntax highlighting.
+When loading a pass file for editing, the first line will be obscured. It is
+editable when the cursor is in place, but will be obscured while editing other
+fields.
+
+There are two commands to facilitate hiding and concealing
+
+*:Reveal*
+
+*:Conceal*
+
+These do what you might expect, reset the syntax highlighting of the password
+from obscured to cleared.
+
+There is also integration with ``pwgen`` the same utility called by
+password-store to generate passwords. By default this is mapped to vim's
+increment and decrement operators ``<C-X>`` and ``<C-A>`` but the mapping is
+available by a plug mapping ``<Plug>password_rotate``
--- /dev/null
+" setup known state
+if exists('did_password_store')
+ " || &compatible
+ " || version < 700}
+ finish
+endif
+let g:did_password_store = '1'
+let s:save_cpo = &cpoptions
+set compatible&vim
+"echo 'main code'}}
+" Return vim to users choice
+function! password_store#generate() abort
+ if executable('pwgen')
+ let l:result = systemlist('pwgen -N1 ' . password_store#setting('pw_length') )
+ return l:result[0]
+ endif
+endfunction
+
+function! password_store#replace() abort
+ execute 's/\<.*\>/' . password_store#generate() . '/'
+endfunction
+
+let s:default_settings = {
+ \ 'pw_length' : '12',
+ \ 'enable_syntax' : 'true',
+ \ }
+
+function! password_store#setting(key)
+ if exists('g:password_store_settings') && has_key(g:password_store_settings, a:key)
+ return g:password_store_settings[a:key]
+ else
+ return s:default_settings[a:key]
+ endif
+endfunction
+
+let &cpoptions = s:save_cpo
--- /dev/null
+*vim-password-store* Niceties for editing password-store files
+
+===============================================================================
+CONTENTS *password-store-contents*
+
+ 1. Intro ........................................... |password-store-intro|
+ 2. Requirements ............................. |password-store-requirements|
+ 3. Usage ........................................... |password-store-usage|
+ 4. Configuration .................................. |password-store-config|
+ 5. Licence ....................................... |password-store-licence|
+ 6. Credits ....................................... |password-store-credits|
+===============================================================================
+1. Intro *password-store-intro*
+
+Password store is a nice command line password manager, well suited to
+vim's style. Tom Ryder has written a plugin to unset the standard
+password security leakages, backup files, info files etc. This works
+well, but doesn't provide hooks for extending. I wanted to add a few
+simple enhancements, including unsetting spelling (no password should be
+spell checked :-) and some simple syntax highlighting.
+
+2. Requirements *password-store-requirements*
+
+A plugin manager (not required but the plugin is written to expect
+this) and password-store https://www.passwordstore.org/ .
+
+3. Usage *password-store-usage*
+
+The plugin automatically loads when it sees the appropriate file paths
+for password-store. This is Tom Ryders
+
+There are two functions:
+>
+ :Conceal
+ :Reveal
+<
+That apply syntax highlighting to obscure and un-obscure the password.
+By default the pass file loads in obscured mode, however when the cursor is on
+the word it should readable and editable. This offers minor "shoulder surfing"
+protection, facilitating editing of metadata, such as adding URLs etc.
+
+There's minor feedback for short passwords, with Error highlighting for
+passwords 6 or less characters long.
+
+Password store also adds password generation support via pwgen. Since
+password-store already leverages pwgen, this is a fairly safe assumption.
+There is a Plug mapping *<Plug>rotate_password*
+by default this is mapped to <C-X> and <C-A> but can be overridden via setting
+an alternate plug mapping
+>
+ nnoremap >M-a> <Plug>rotate_password
+<
+The mapped sequence will generate a random password. As neither decrement nor
+increment mean anything in this context, buth are mapped to the same plug.
+The default length of the password is 10 character, but
+modifiable by configuration This is also available via the function call(s)
+>
+ password_store#replace()
+<
+4. Configuration *password-store-config*
+
+Configuration is done through a global dictionary *g:password_store_settings*
+Initialize the dictionary and add settings as needed
+>
+ let g:password_store_settings = {}
+
+Syntax obfustaction is enabled by default. To disable it:
+>
+ let g:password_store_settings.enable_syntax = 'false"
+
+
+Auto "increment" password length is 12 characters. To change it
+>
+ let g:password_store_settings.pw_length = 20
+<
+4. Licence *password-store-licence*
+
+This plugin is licensed under the same terms as vim itself (see
+|license| )
+
+5. Credits *password-store-credits*
+
+Tom Ryder
+https://git.zx2c4.com/password-store/
+
+vim:ft=help
--- /dev/null
+" detect password-store files
+if exists('did_pass') || &compatible || version < 700
+ finish
+endif
+let g:did_pass = 'did_pass'
+let s:save_cpo = &cpoptions
+set compatible&vim
+
+" this is straight from Tom Ryders plugin
+
+autocmd VimEnter
+ \ /dev/shm/pass.?*/?*.txt
+ \,/dev/shm/gopass-edit*/secret
+ \,$TMPDIR/pass.?*/?*.txt
+ \,/tmp/pass.?*/?*.txt
+ \ setlocal filetype=pass |
+ \ if password_store#setting('enable_syntax') ==# 'true' | setlocal syntax=pass.obfuscated | endif
+
+" Cleanup at end
+let &cpoptions = s:save_cpo
--- /dev/null
+if exists('did_pass_ftplugin') || &compatible || v:version < 700
+ finish
+endif
+let g:did_pass = 'did_pass_ftplugin'
+let s:save_cpo = &cpoptions
+set compatible&vim
+
+nmap <buffer> <Plug>rotate_password :call password_store#replace()<Cr>
+if ! hasmapto( '\<Plug>rotate_password', 'n')
+ nmap <C-X> <Plug>rotate_password
+endif
+
+setlocal nospell
+
+
+" Check whether we should set redacting options or not
+function! s:CheckArgsRedact()
+
+ " Ensure there's one argument and it's the matched file
+ if argc() != 1 || fnamemodify(argv(0), ':p') !=# expand('<afile>:p')
+ return
+ endif
+
+ " Disable all the leaky options globally
+ set nobackup
+ set nowritebackup
+ set noswapfile
+ set viminfo=
+ if has('persistent_undo')
+ set noundofile
+ endif
+
+ " Tell the user what we're doing so they know this worked, via a message and
+ " a global variable they can check
+ echomsg 'Editing password file--disabled leaky options!'
+ let g:redact_pass_redacted = 1
+
+endfunction
+
+call s:CheckArgsRedact()
+
+function! s:reveal_pass() abort
+ highlight! link password_store_password Comment
+endfunction
+command! Reveal call <SID>reveal_pass()
+
+function! s:conceal_pass() abort
+ highlight! password_store_password guifg=DarkGray guibg=DarkGray ctermfg=8 ctermbg=8
+endfunction
+command! Conceal call <SID>conceal_pass()
+normal! GG
+
+augroup password_settings_late_load
+ autocmd!
+ autocmd FileReadPost if &filetype == 'pass' | echom 'autocmd triggered' | let b:load_pass_syntax = 1 | source 'syntax/pass.vim' | endif
+augroup end
+" Cleanup at end
+let &cpoptions = s:save_cpo
--- /dev/null
+if exists('b:current_syntax') | finish| endif
+
+setlocal cursorline
+
+" set redacted colors from colorscheme
+let s:error_highlight_str = execute( 'highlight Error' )
+let s:error_fg = matchstr(s:error_highlight_str, 'guifg=\zs\S*')
+
+let s:comment_highlight_str = execute( 'highlight Comment' )
+let s:comment_fg = matchstr(s:comment_highlight_str, 'guifg=\zs\S*')
+
+execute 'highlight password_store_password ' .
+ \ ' guibg=' . s:comment_fg .
+ \ ' guifg=' . s:comment_fg .
+ \ ' ctermfg=1 ctermbg=1'
+
+execute 'highlight password_store_password_short ' .
+ \ ' guibg=' . s:error_fg .
+ \ ' guifg=' . s:error_fg .
+ \ ' ctermfg=1 ctermbg=1'
+
--- /dev/null
+if exists('b:current_syntax') | finish| endif
+
+" first line (by convention always a single pasword)
+syntax match password_store_password /\%1l.*/
+highlight link password_store_password Comment
+
+" highlight short passwords
+syntax match password_store_password_short /\%1l.\{,6\}$/
+highlight link password_store_password_short Error
+
+" colon field value is the suggested path for additional information
+syntax match password_store_header '\v^[^:]+:'
+highlight link password_store_header PreProc
+
+
--- /dev/null
+Given pass (short password):
+ pass
+
+Execute (test short password syntax):
+ AssertEqual SyntaxAt(2), 'password_store_password_short'
+
+Given pass (longer password):
+ passwordlonger
+
+Execute (test longer password syntax):
+ AssertEqual SyntaxAt(2), 'password_store_password'
+
+Given pass (another password):
+ passwordlonger
+
+Before (disable syntax):
+ let g:password_store_settings = {}
+ let g:password_store_settings.enable_syntax = 'false'
+
+Execute (test disable syntax ):
+ AssertEqual &filetype, 'pass'
+
+Execute (test increment password length):
+ AssertEqual len( password_store#generate()), 12
+
+Execute (test new generates do not match):
+ AssertNotEqual password_store#generate(), password_store#generate()
+
+Given text (test ftdetect):
+ passwordtesting
+
+Before (mimic settings):
+ let g:password_store_settings = {}
+ let g:password_store_settings.enable_syntax = 'false'
+ let g:password_store_settings.pw_length = '16'
+
+Execute (test ftdetect trigger):
+ set filetype=pass
+ AssertEqual password_store#setting('enable_syntax'), 'false'
+ AssertEqual len( password_store#generate() ), 16
+
+
--- /dev/null
+build
+/doc/tags
--- /dev/null
+language: vim
+
+os:
+ - linux
+ - osx
+
+env:
+ - TEST=package
+ - TEST=latest
+
+before_script: |
+ if [ "$TEST" = "package" ]; then
+ if [ "$TRAVIS_OS_NAME" = "linux" ]; then
+ sudo apt-get -y update
+ sudo apt-get -y install vim
+ fi
+ else
+ cd ..
+ git clone --depth 1 https://github.com/vim/vim
+ cd vim
+ ./configure --with-features=huge
+ make
+ sudo make install
+ export PATH="/usr/local/bin:$PATH"
+ cd "$TRAVIS_BUILD_DIR"
+ fi
+ if [ "$TRAVIS_OS_NAME" = "osx" ]; then
+ curl https://bootstrap.pypa.io/get-pip.py | sudo python
+ fi
+ sudo -H pip install virtualenv
+
+script:
+ - make test
+ - make doc
--- /dev/null
+# CONTRIBUTING
+
+These contributing guidelines were accepted rather late in the history of this plugin, after much code had already been written.
+
+If you find any existing behavior which does not conform to these guidelines, please correct it and send a pull request.
+
+## General Rules
+
+Every non local identifier must start with `g:vim_markdown_`.
+
+## Documentation
+
+Every new feature must be documented under in the [README.md](README.md). Documentation must be written in [GFM](https://help.github.com/articles/github-flavored-markdown) since GitHub itself is the primary to HTML converter used. In particular, remember that GFM adds line breaks at single newlines, so just forget about the 70 characters wide rule.
+
+Vim help file [doc/vim-markdown.txt](doc/vim-markdown.txt) will be generated from [README.md](README.md) by `make doc` using [vim-tools](https://github.com/xolox/vim-tools).
+
+## Markdown Flavors
+
+There are many flavors of markdown, each one with an unique feature set. This plugin uses the following strategy to deal with all those flavors:
+
+- Features from the [original markdown](http://daringfireball.net/projects/markdown/syntax) are turned on by default. They may not even have an option that turns them off.
+
+- Features from other markdown flavors *must* have an option that turns them on or off. If the feature is common enough across multiple versions of markdown, it may be turned on by default. This shall be decided by the community when the merge request is done.
+
+- If possible, cite the exact point in the documentation of the flavor where a feature is specified. If the feature is not documented, you may also reference the source code itself of the implementation. This way, people who do not know that flavor can check if your implementation is correct.
+
+- Do not use the name of a flavor for a feature that is used across multiple flavors. Instead, create a separate flavor option, that automatically sets each feature.
+
+ For example, fenced code blocks (putting code between pairs of three backticks) is not part of the original markdown, but is supported by [GFM](https://help.github.com/articles/github-flavored-markdown#fenced-code-blocks) and [Jekyll](http://jekyllrb.com/docs/configuration/).
+
+ Therefore, instead of creating an option `g:vim_markdown_gfm_fenced_code_block`, and an option `g:vim_markdown_jekyll_fenced_code_block`, create a single option `g:vim_markdown_fenced_code_block`.
+
+ Next, if there are many more than one Jekyll feature options, create a `g:vim_markdown_jekyll` option that turns them all on at once.
+
+## Style
+
+When choosing between multiple valid Markdown syntaxes, the default behavior must be that specified at: <http://www.cirosantilli.com/markdown-styleguide>
+
+If you wish to have a behavior that differs from that style guide, add an option to turn it on or off, and leave it off by default.
+
+## Tests
+
+All new features must have unit tests.
+
+## Issues
+
+Issues are tracked within GitHub.
+
+When reporting issues, your report is more effective if you include a minimal example file that reproduces the problem. Try to trim out as much as possible, until you have the smallest possible file that still reproduces the issue. Paste the example inline into your issue report, quoted using four spaces at the beginning of each line, like this example from issue [#189](https://github.com/plasticboy/vim-markdown/issues/189):
+
+```
+Minimal example:
+
+ ```
+ =
+ ```
+ bad!
+```
--- /dev/null
+VIMDIR=$(DESTDIR)/usr/share/vim
+ADDONS=${VIMDIR}/addons
+REGISTRY=${VIMDIR}/registry
+
+all:
+
+install:
+ mkdir -pv ${ADDONS}/ftdetect
+ cp -v ftdetect/markdown.vim ${ADDONS}/ftdetect/markdown.vim
+ mkdir -pv ${ADDONS}/ftplugin
+ cp -v ftplugin/markdown.vim ${ADDONS}/ftplugin/markdown.vim
+ mkdir -pv ${ADDONS}/syntax
+ cp -v syntax/markdown.vim ${ADDONS}/syntax/markdown.vim
+ mkdir -pv ${ADDONS}/after/ftplugin
+ cp -v after/ftplugin/markdown.vim ${ADDONS}/after/ftplugin/markdown.vim
+ mkdir -pv ${ADDONS}/indent
+ cp -v indent/markdown.vim ${ADDONS}/indent/markdown.vim
+ mkdir -pv ${ADDONS}/doc
+ cp -v doc/vim-markdown.txt ${ADDONS}/doc/vim-markdown.txt
+ mkdir -pv ${REGISTRY}
+ cp -v registry/markdown.yaml ${REGISTRY}/markdown.yaml
+
+test: build/tabular build/vim-toml build/vim-json build/vader.vim
+ test/run-tests.sh
+.PHONY: test
+
+update: build/tabular build/vim-toml build/vim-json build/vader.vim
+ cd build/tabular && git pull
+ cd build/vim-toml && git pull
+ cd build/vim-json && git pull
+ cd build/vader.vim && git pull
+.PHONY: update
+
+build/tabular: | build
+ git clone https://github.com/godlygeek/tabular build/tabular
+
+build/vim-toml: | build
+ git clone https://github.com/cespare/vim-toml build/vim-toml
+
+build/vim-json: | build
+ git clone https://github.com/elzr/vim-json build/vim-json
+
+build/vader.vim: | build
+ git clone https://github.com/junegunn/vader.vim build/vader.vim
+
+build:
+ mkdir build
+
+doc: build/html2vimdoc build/vim-tools
+ sed -e '/^\[!\[Build Status\]/d' \
+ -e '/^1\. \[/d' README.md > doc/tmp.md # remove table of contents
+ build/html2vimdoc/bin/python build/vim-tools/html2vimdoc.py -f vim-markdown \
+ doc/tmp.md | \
+ sed -E -e "s/[[:space:]]*$$//" -e "# remove trailing spaces" \
+ -e "/^.{79,}\|$$/ {" -e "# wrap table of contents over 79" \
+ -e "h" -e "# save the matched line to the hold space" \
+ -e "s/^(.*) (\|[^|]*\|)$$/\1/" -e "# make content title" \
+ -e "p" -e "# print title" \
+ -e "g" -e "# restore the matched line" \
+ -e "s/^.* (\|[^|]*\|)$$/ \1/" -e "# make link" \
+ -e ":c" -e "s/^(.{1,78})$$/ \1/" -e "tc" -e "# align right" \
+ -e "}" \
+ -e "/^- '[^']*':( |$$)/ {" \
+ -e "h" -e "# save the matched line to the hold space" \
+ -e "s/^- '([^']{3,})':.*/ \*\1\*/" -e "# make command reference" \
+ -e "s/^- '([^']{1,2})':.*/ \*vim-markdown-\1\*/" -e "# short command" \
+ -e ":a" -e "s/^(.{1,78})$$/ \1/" -e "ta" -e "# align right" \
+ -e "G" -e "# append the matched line after the command reference" \
+ -e "}" \
+ -e "/^- 'g:vim_markdown_[[:alnum:]_]*'$$/ {" \
+ -e "h" -e "# save the matched line to the hold space" \
+ -e "s/^- '([^']*)'$$/ \*\1\*/" -e "# make global variable reference" \
+ -e ":g" -e "s/^(.{1,78})$$/ \1/" -e "tg" -e "# align right" \
+ -e "G" -e "# append the matched line after the global variable reference" \
+ -e "}" > doc/vim-markdown.txt && rm -f doc/tmp.md
+
+.PHONY: doc
+
+# Prerequire Python and virtualenv.
+# $ sudo pip install virtualenv
+# Create the virtual environment.
+# Install the dependencies.
+build/html2vimdoc: | build
+ virtualenv build/html2vimdoc
+ build/html2vimdoc/bin/pip install beautifulsoup coloredlogs==4.0 markdown
+
+build/vim-tools: | build
+ git clone https://github.com/xolox/vim-tools.git build/vim-tools
--- /dev/null
+# Vim Markdown
+
+[![Build Status](https://travis-ci.org/plasticboy/vim-markdown.svg)](https://travis-ci.org/plasticboy/vim-markdown)
+
+Syntax highlighting, matching rules and mappings for [the original Markdown](http://daringfireball.net/projects/markdown/) and extensions.
+
+1. [Installation](#installation)
+1. [Basic usage](#basic-usage)
+1. [Options](#options)
+1. [Mappings](#mappings)
+1. [Commands](#commands)
+1. [Credits](#credits)
+1. [License](#license)
+
+## Installation
+
+If you use [Vundle](https://github.com/gmarik/vundle), add the following lines to your `~/.vimrc`:
+
+```vim
+Plugin 'godlygeek/tabular'
+Plugin 'plasticboy/vim-markdown'
+```
+
+The `tabular` plugin must come *before* `vim-markdown`.
+
+Then run inside Vim:
+
+```vim
+:so ~/.vimrc
+:PluginInstall
+```
+
+If you use [Pathogen](https://github.com/tpope/vim-pathogen), do this:
+
+```sh
+cd ~/.vim/bundle
+git clone https://github.com/plasticboy/vim-markdown.git
+```
+
+To install without Pathogen using the Debian [vim-addon-manager](http://packages.qa.debian.org/v/vim-addon-manager.html), do this:
+
+```sh
+git clone https://github.com/plasticboy/vim-markdown.git
+cd vim-markdown
+sudo make install
+vim-addon-manager install markdown
+```
+
+If you are not using any package manager, download the [tarball](https://github.com/plasticboy/vim-markdown/archive/master.tar.gz) and do this:
+
+```sh
+cd ~/.vim
+tar --strip=1 -zxf vim-markdown-master.tar.gz
+```
+
+## Basic usage
+
+### Folding
+
+Folding is enabled for headers by default.
+
+The following commands are useful to open and close folds:
+
+- `zr`: reduces fold level throughout the buffer
+- `zR`: opens all folds
+- `zm`: increases fold level throughout the buffer
+- `zM`: folds everything all the way
+- `za`: open a fold your cursor is on
+- `zA`: open a fold your cursor is on recursively
+- `zc`: close a fold your cursor is on
+- `zC`: close a fold your cursor is on recursively
+
+[Options](#options) are available to disable folding or change folding style.
+
+Try `:help fold-expr` and `:help fold-commands` for details.
+
+### Concealing
+
+Concealing is set for some syntax such as bold, italic, code block and link.
+
+Concealing lets you conceal text with other text. The actual source text is not modified. If you put your cursor on the concealed line, the conceal goes away.
+
+[Options](#options) are available to disable or change concealing.
+
+Try `:help concealcursor` and `:help conceallevel` for details.
+
+## Options
+
+### Disable Folding
+
+- `g:vim_markdown_folding_disabled`
+
+ Add the following line to your `.vimrc` to disable the folding configuration:
+
+ let g:vim_markdown_folding_disabled = 1
+
+ This option only controls Vim Markdown specific folding configuration.
+
+ To enable/disable folding use Vim's standard folding configuration.
+
+ set [no]foldenable
+
+### Change fold style
+
+- `g:vim_markdown_folding_style_pythonic`
+
+ To fold in a style like [python-mode](https://github.com/klen/python-mode), add the following to your `.vimrc`:
+
+ let g:vim_markdown_folding_style_pythonic = 1
+
+ `g:vim_markdown_folding_level` setting (default 1) is set to `foldlevel`.
+ Thus level 1 heading which is served as a document title is expanded by default.
+
+- `g:vim_markdown_override_foldtext`
+
+ To prevent foldtext from being set add the following to your `.vimrc`:
+
+ let g:vim_markdown_override_foldtext = 0
+
+### Set header folding level
+
+- `g:vim_markdown_folding_level`
+
+ Folding level is a number between 1 and 6. By default, if not specified, it is set to 1.
+
+ let g:vim_markdown_folding_level = 6
+
+ Tip: it can be changed on the fly with:
+
+ :let g:vim_markdown_folding_level = 1
+ :edit
+
+### Disable Default Key Mappings
+
+- `g:vim_markdown_no_default_key_mappings`
+
+ Add the following line to your `.vimrc` to disable default key mappings:
+
+ let g:vim_markdown_no_default_key_mappings = 1
+
+ You can also map them by yourself with `<Plug>` mappings.
+
+### Enable TOC window auto-fit
+
+- `g:vim_markdown_toc_autofit`
+
+ Allow for the TOC window to auto-fit when it's possible for it to shrink.
+ It never increases its default size (half screen), it only shrinks.
+
+ let g:vim_markdown_toc_autofit = 1
+
+### Text emphasis restriction to single-lines
+
+- `g:vim_markdown_emphasis_multiline`
+
+ By default text emphasis works across multiple lines until a closing token is found. However, it's possible to restrict text emphasis to a single line (i.e., for it to be applied a closing token must be found on the same line). To do so:
+
+ let g:vim_markdown_emphasis_multiline = 0
+
+### Syntax Concealing
+
+- `g:vim_markdown_conceal`
+
+ Concealing is set for some syntax.
+
+ For example, conceal `[link text](link url)` as just `link text`.
+ Also, `_italic_` and `*italic*` will conceal to just _italic_.
+ Similarly `__bold__`, `**bold**`, `___italic bold___`, and `***italic bold***`
+ will conceal to just __bold__, **bold**, ___italic bold___, and ***italic bold*** respectively.
+
+ To enable conceal use Vim's standard conceal configuration.
+
+ set conceallevel=2
+
+ To disable conceal regardless of `conceallevel` setting, add the following to your `.vimrc`:
+
+ let g:vim_markdown_conceal = 0
+
+ To disable math conceal with LaTeX math syntax enabled, add the following to your `.vimrc`:
+
+ let g:tex_conceal = ""
+ let g:vim_markdown_math = 1
+
+- `g:vim_markdown_conceal_code_blocks`
+
+ Disabling conceal for code fences requires an additional setting:
+
+ let g:vim_markdown_conceal_code_blocks = 0
+
+### Fenced code block languages
+
+- `g:vim_markdown_fenced_languages`
+
+ You can use filetype name as fenced code block languages for syntax highlighting.
+ If you want to use different name from filetype, you can add it in your `.vimrc` like so:
+
+ let g:vim_markdown_fenced_languages = ['csharp=cs']
+
+ This will cause the following to be highlighted using the `cs` filetype syntax.
+
+ ```csharp
+ ...
+ ```
+
+ Default is `['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini']`.
+
+### Follow named anchors
+
+- `g:vim_markdown_follow_anchor`
+
+ This feature allows the `ge` command to follow named anchors in links of the form
+ `file#anchor` or just `#anchor`, where file may omit the `.md` extension as
+ usual. Two variables control its operation:
+
+ let g:vim_markdown_follow_anchor = 1
+
+ This tells vim-markdown whether to attempt to follow a named anchor in a link or
+ not. When it is 1, and only if a link can be split in two parts by the pattern
+ '#', then the first part is interpreted as the file and the second one as the
+ named anchor. This also includes urls of the form `#anchor`, for which the first
+ part is considered empty, meaning that the target file is the current one. After
+ the file is opened, the anchor will be searched.
+
+ Default is `0`.
+
+- `g:vim_markdown_anchorexpr`
+
+ let g:vim_markdown_anchorexpr = "'<<'.v:anchor.'>>'"
+
+ This expression will be evaluated substituting `v:anchor` with a quoted string
+ that contains the anchor to visit. The result of the evaluation will become the
+ real anchor to search in the target file. This is useful in order to convert
+ anchors of the form, say, `my-section-title` to searches of the form `My Section
+ Title` or `<<my-section-title>>`.
+
+ Default is `''`.
+
+### Syntax extensions
+
+The following options control which syntax extensions will be turned on. They are off by default.
+
+#### LaTeX math
+
+- `g:vim_markdown_math`
+
+ Used as `$x^2$`, `$$x^2$$`, escapable as `\$x\$` and `\$\$x\$\$`.
+
+ let g:vim_markdown_math = 1
+
+#### YAML Front Matter
+
+- `g:vim_markdown_frontmatter`
+
+ Highlight YAML front matter as used by Jekyll or [Hugo](https://gohugo.io/content/front-matter/).
+
+ let g:vim_markdown_frontmatter = 1
+
+#### TOML Front Matter
+
+- `g:vim_markdown_toml_frontmatter`
+
+ Highlight TOML front matter as used by [Hugo](https://gohugo.io/content/front-matter/).
+
+ TOML syntax highlight requires [vim-toml](https://github.com/cespare/vim-toml).
+
+ let g:vim_markdown_toml_frontmatter = 1
+
+#### JSON Front Matter
+
+- `g:vim_markdown_json_frontmatter`
+
+ Highlight JSON front matter as used by [Hugo](https://gohugo.io/content/front-matter/).
+
+ JSON syntax highlight requires [vim-json](https://github.com/elzr/vim-json).
+
+ let g:vim_markdown_json_frontmatter = 1
+
+#### Strikethrough
+
+- `g:vim_markdown_strikethrough`
+
+ Strikethrough uses two tildes. `~~Scratch this.~~`
+
+ let g:vim_markdown_strikethrough = 1
+
+### Adjust new list item indent
+
+- `g:vim_markdown_new_list_item_indent`
+
+ You can adjust a new list indent. For example, you insert a single line like below:
+
+ * item1
+
+ Then if you type `o` to insert new line in vim and type `* item2`, the result will be:
+
+ * item1
+ * item2
+
+ vim-markdown automatically insert the indent. By default, the number of spaces of indent is 4. If you'd like to change the number as 2, just write:
+
+ let g:vim_markdown_new_list_item_indent = 2
+
+### Do not require .md extensions for Markdown links
+
+- `g:vim_markdown_no_extensions_in_markdown`
+
+ If you want to have a link like this `[link text](link-url)` and follow it for editing in vim using the `ge` command, but have it open the file "link-url.md" instead of the file "link-url", then use this option:
+
+ let g:vim_markdown_no_extensions_in_markdown = 1
+
+ This is super useful for GitLab and GitHub wiki repositories.
+
+ Normal behaviour would be that vim-markup required you to do this `[link text](link-url.md)`, but this is not how the Gitlab and GitHub wiki repositories work. So this option adds some consistency between the two.
+
+### Auto-write when following link
+
+- `g:vim_markdown_autowrite`
+
+ If you follow a link like this `[link text](link-url)` using the `ge` shortcut, this option will automatically save any edits you made before moving you:
+
+ let g:vim_markdown_autowrite = 1
+
+### Change default file extension
+
+- `g:vim_markdown_auto_extension_ext`
+
+ If you would like to use a file extension other than `.md` you may do so using the `vim_markdown_auto_extension_ext` variable:
+
+ let g:vim_markdown_auto_extension_ext = 'txt'
+
+### Do not automatically insert bulletpoints
+
+- `g:vim_markdown_auto_insert_bullets`
+
+ Automatically inserting bulletpoints can lead to problems when wrapping text
+ (see issue #232 for details), so it can be disabled:
+
+ let g:vim_markdown_auto_insert_bullets = 0
+
+ In that case, you probably also want to set the new list item indent to 0 as
+ well, or you will have to remove an indent each time you add a new list item:
+
+ let g:vim_markdown_new_list_item_indent = 0
+
+### Change how to open new files
+
+- `g:vim_markdown_edit_url_in`
+
+ By default when following a link the target file will be opened in your current buffer. This behavior can change if you prefer using splits or tabs by using the `vim_markdown_edit_url_in` variable. Possible values are `tab`, `vsplit`, `hsplit`, `current` opening in a new tab, vertical split, horizontal split, and current buffer respectively. Defaults to current buffer if not set:
+
+ let g:vim_markdown_edit_url_in = 'tab'
+
+## Mappings
+
+The following work on normal and visual modes:
+
+- `gx`: open the link under the cursor in the same browser as the standard `gx` command. `<Plug>Markdown_OpenUrlUnderCursor`
+
+ The standard `gx` is extended by allowing you to put your cursor anywhere inside a link.
+
+ For example, all the following cursor positions will work:
+
+ [Example](http://example.com)
+ ^ ^ ^^ ^ ^
+ 1 2 34 5 6
+
+ <http://example.com>
+ ^ ^ ^
+ 1 2 3
+
+ Known limitation: does not work for links that span multiple lines.
+
+- `ge`: open the link under the cursor in Vim for editing. Useful for relative markdown links. `<Plug>Markdown_EditUrlUnderCursor`
+
+ The rules for the cursor position are the same as the `gx` command.
+
+- `]]`: go to next header. `<Plug>Markdown_MoveToNextHeader`
+
+- `[[`: go to previous header. Contrast with `]c`. `<Plug>Markdown_MoveToPreviousHeader`
+
+- `][`: go to next sibling header if any. `<Plug>Markdown_MoveToNextSiblingHeader`
+
+- `[]`: go to previous sibling header if any. `<Plug>Markdown_MoveToPreviousSiblingHeader`
+
+- `]c`: go to Current header. `<Plug>Markdown_MoveToCurHeader`
+
+- `]u`: go to parent header (Up). `<Plug>Markdown_MoveToParentHeader`
+
+This plugin follows the recommended Vim plugin mapping interface, so to change the map `]u` to `asdf`, add to your `.vimrc`:
+
+ map asdf <Plug>Markdown_MoveToParentHeader
+
+To disable a map use:
+
+ map <Plug> <Plug>Markdown_MoveToParentHeader
+
+## Commands
+
+The following requires `:filetype plugin on`.
+
+- `:HeaderDecrease`:
+
+ Decrease level of all headers in buffer: `h2` to `h1`, `h3` to `h2`, etc.
+
+ If range is given, only operate in the range.
+
+ If an `h1` would be decreased, abort.
+
+ For simplicity of implementation, Setex headers are converted to Atx.
+
+- `:HeaderIncrease`: Analogous to `:HeaderDecrease`, but increase levels instead.
+
+- `:SetexToAtx`:
+
+ Convert all Setex style headers in buffer to Atx.
+
+ If a range is given, e.g. hit `:` from visual mode, only operate on the range.
+
+- `:TableFormat`: Format the table under the cursor [like this](http://www.cirosantilli.com/markdown-style-guide/#tables).
+
+ Requires [Tabular](https://github.com/godlygeek/tabular).
+
+ The input table *must* already have a separator line as the second line of the table.
+ That line only needs to contain the correct pipes `|`, nothing else is required.
+
+- `:Toc`: create a quickfix vertical window navigable table of contents with the headers.
+
+ Hit `<Enter>` on a line to jump to the corresponding line of the markdown file.
+
+- `:Toch`: Same as `:Toc` but in an horizontal window.
+
+- `:Toct`: Same as `:Toc` but in a new tab.
+
+- `:Tocv`: Same as `:Toc` for symmetry with `:Toch` and `:Tocv`.
+
+## Credits
+
+The main contributors of vim-markdown are:
+
+- **Ben Williams** (A.K.A. **plasticboy**). The original developer of vim-markdown. [Homepage](http://plasticboy.com/).
+
+If you feel that your name should be on this list, please make a pull request listing your contributions.
+
+## License
+
+The MIT License (MIT)
+
+Copyright (c) 2012 Benjamin D. Williams
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+" vim: ts=4 sw=4:
+" folding for Markdown headers, both styles (atx- and setex-)
+" http://daringfireball.net/projects/markdown/syntax#header
+"
+" this code can be placed in file
+" $HOME/.vim/after/ftplugin/markdown.vim
+"
+" original version from Steve Losh's gist: https://gist.github.com/1038710
+
+function! s:is_mkdCode(lnum)
+ let name = synIDattr(synID(a:lnum, 1, 0), 'name')
+ return (name =~ '^mkd\%(Code$\|Snippet\)' || name != '' && name !~ '^\%(mkd\|html\)')
+endfunction
+
+if get(g:, "vim_markdown_folding_style_pythonic", 0)
+ function! Foldexpr_markdown(lnum)
+ let l1 = getline(a:lnum)
+ "~~~~~ keep track of fenced code blocks ~~~~~
+ "If we hit a code block fence
+ if l1 =~ '````*' || l1 =~ '\~\~\~\~*'
+ " toggle the variable that says if we're in a code block
+ if b:fenced_block == 0
+ let b:fenced_block = 1
+ elseif b:fenced_block == 1
+ let b:fenced_block = 0
+ endif
+ " else, if we're caring about front matter
+ elseif g:vim_markdown_frontmatter == 1
+ " if we're in front matter and not on line 1
+ if b:front_matter == 1 && a:lnum > 2
+ let l0 = getline(a:lnum-1)
+ " if the previous line fenced front matter
+ if l0 == '---'
+ " we must not be in front matter
+ let b:front_matter = 0
+ endif
+ " else, if we're on line one
+ elseif a:lnum == 1
+ " if we hit a front matter fence
+ if l1 == '---'
+ " we're in the front matter
+ let b:front_matter = 1
+ endif
+ endif
+ endif
+
+ " if we're in a code block or front matter
+ if b:fenced_block == 1 || b:front_matter == 1
+ if a:lnum == 1
+ " fold any 'preamble'
+ return '>1'
+ else
+ " keep previous foldlevel
+ return '='
+ endif
+ endif
+
+ let l2 = getline(a:lnum+1)
+ " if the next line starts with two or more '='
+ " and is not code
+ if l2 =~ '^==\+\s*' && !s:is_mkdCode(a:lnum+1)
+ " next line is underlined (level 1)
+ return '>0'
+ " else, if the nex line starts with two or more '-'
+ " and is not code
+ elseif l2 =~ '^--\+\s*' && !s:is_mkdCode(a:lnum+1)
+ " next line is underlined (level 2)
+ return '>1'
+ endif
+
+ "if we're on a non-code line starting with a pound sign
+ if l1 =~ '^#' && !s:is_mkdCode(a:lnum)
+ " set the fold level to the number of hashes -1
+ " return '>'.(matchend(l1, '^#\+') - 1)
+ " set the fold level to the number of hashes
+ return '>'.(matchend(l1, '^#\+'))
+ " else, if we're on line 1
+ elseif a:lnum == 1
+ " fold any 'preamble'
+ return '>1'
+ else
+ " keep previous foldlevel
+ return '='
+ endif
+ endfunction
+
+ function! Foldtext_markdown()
+ let line = getline(v:foldstart)
+ let has_numbers = &number || &relativenumber
+ let nucolwidth = &fdc + has_numbers * &numberwidth
+ let windowwidth = winwidth(0) - nucolwidth - 6
+ let foldedlinecount = v:foldend - v:foldstart
+ let line = strpart(line, 0, windowwidth - 2 -len(foldedlinecount))
+ let line = substitute(line, '\%("""\|''''''\)', '', '')
+ let fillcharcount = windowwidth - len(line) - len(foldedlinecount) + 1
+ return line . ' ' . repeat("-", fillcharcount) . ' ' . foldedlinecount
+ endfunction
+else " vim_markdown_folding_style_pythonic == 0
+ function! Foldexpr_markdown(lnum)
+ if (a:lnum == 1)
+ let l0 = ''
+ else
+ let l0 = getline(a:lnum-1)
+ endif
+
+ " keep track of fenced code blocks
+ if l0 =~ '````*' || l0 =~ '\~\~\~\~*'
+ if b:fenced_block == 0
+ let b:fenced_block = 1
+ elseif b:fenced_block == 1
+ let b:fenced_block = 0
+ endif
+ elseif g:vim_markdown_frontmatter == 1
+ if b:front_matter == 1
+ if l0 == '---'
+ let b:front_matter = 0
+ endif
+ elseif a:lnum == 2
+ if l0 == '---'
+ let b:front_matter = 1
+ endif
+ endif
+ endif
+
+ if b:fenced_block == 1 || b:front_matter == 1
+ " keep previous foldlevel
+ return '='
+ endif
+
+ let l2 = getline(a:lnum+1)
+ if l2 =~ '^==\+\s*' && !s:is_mkdCode(a:lnum+1)
+ " next line is underlined (level 1)
+ return '>1'
+ elseif l2 =~ '^--\+\s*' && !s:is_mkdCode(a:lnum+1)
+ " next line is underlined (level 2)
+ if s:vim_markdown_folding_level >= 2
+ return '>1'
+ else
+ return '>2'
+ endif
+ endif
+
+ let l1 = getline(a:lnum)
+ if l1 =~ '^#' && !s:is_mkdCode(a:lnum)
+ " fold level according to option
+ if s:vim_markdown_folding_level == 1 || matchend(l1, '^#\+') > s:vim_markdown_folding_level
+ if a:lnum == line('$')
+ return matchend(l1, '^#\+') - 1
+ else
+ return -1
+ endif
+ else
+ " headers are not folded
+ return 0
+ endif
+ endif
+
+ if l0 =~ '^#' && !s:is_mkdCode(a:lnum-1)
+ " previous line starts with hashes
+ return '>'.matchend(l0, '^#\+')
+ else
+ " keep previous foldlevel
+ return '='
+ endif
+ endfunction
+endif
+
+
+let b:fenced_block = 0
+let b:front_matter = 0
+let s:vim_markdown_folding_level = get(g:, "vim_markdown_folding_level", 1)
+
+function! s:MarkdownSetupFolding()
+ if !get(g:, "vim_markdown_folding_disabled", 0)
+ if get(g:, "vim_markdown_folding_style_pythonic", 0)
+ if get(g:, "vim_markdown_override_foldtext", 1)
+ setlocal foldtext=Foldtext_markdown()
+ endif
+ endif
+ setlocal foldexpr=Foldexpr_markdown(v:lnum)
+ setlocal foldmethod=expr
+ endif
+endfunction
+
+function! s:MarkdownSetupFoldLevel()
+ if get(g:, "vim_markdown_folding_style_pythonic", 0)
+ " set default foldlevel
+ execute "setlocal foldlevel=".s:vim_markdown_folding_level
+ endif
+endfunction
+
+call s:MarkdownSetupFoldLevel()
+call s:MarkdownSetupFolding()
+
+augroup Mkd
+ " These autocmds need to be kept in sync with the autocmds calling
+ " s:MarkdownRefreshSyntax in ftplugin/markdown.vim.
+ autocmd BufWinEnter,BufWritePost <buffer> call s:MarkdownSetupFolding()
+ autocmd InsertEnter,InsertLeave <buffer> call s:MarkdownSetupFolding()
+ autocmd CursorHold,CursorHoldI <buffer> call s:MarkdownSetupFolding()
+augroup END
--- /dev/null
+*vim-markdown* Vim Markdown
+
+===============================================================================
+Contents ~
+
+ 1. Introduction |vim-markdown-introduction|
+ 2. Installation |vim-markdown-installation|
+ 3. Basic usage |vim-markdown-basic-usage|
+ 1. Folding |vim-markdown-folding|
+ 2. Concealing |vim-markdown-concealing|
+ 4. Options |vim-markdown-options|
+ 1. Disable Folding |vim-markdown-disable-folding|
+ 2. Change fold style |vim-markdown-change-fold-style|
+ 3. Set header folding level |vim-markdown-set-header-folding-level|
+ 4. Disable Default Key Mappings |vim-markdown-disable-default-key-mappings|
+ 5. Enable TOC window auto-fit |vim-markdown-enable-toc-window-auto-fit|
+ 6. Text emphasis restriction to single-lines
+ |vim-markdown-text-emphasis-restriction-to-single-lines|
+ 7. Syntax Concealing |vim-markdown-syntax-concealing|
+ 8. Fenced code block languages |vim-markdown-fenced-code-block-languages|
+ 9. Follow named anchors |vim-markdown-follow-named-anchors|
+ 10. Syntax extensions |vim-markdown-syntax-extensions|
+ 1. LaTeX math |vim-markdown-latex-math|
+ 2. YAML Front Matter |vim-markdown-yaml-front-matter|
+ 3. TOML Front Matter |vim-markdown-toml-front-matter|
+ 4. JSON Front Matter |vim-markdown-json-front-matter|
+ 5. Strikethrough |vim-markdown-strikethrough|
+ 11. Adjust new list item indent |vim-markdown-adjust-new-list-item-indent|
+ 12. Do not require .md extensions for Markdown links
+ |vim-markdown-do-not-require-.md-extensions-for-markdown-links|
+ 13. Auto-write when following link
+ |vim-markdown-auto-write-when-following-link|
+ 14. Change default file extension
+ |vim-markdown-change-default-file-extension|
+ 15. Do not automatically insert bulletpoints
+ |vim-markdown-do-not-automatically-insert-bulletpoints|
+ 16. Change how to open new files |vim-markdown-change-how-to-open-new-files|
+ 5. Mappings |vim-markdown-mappings|
+ 6. Commands |vim-markdown-commands|
+ 7. Credits |vim-markdown-credits|
+ 8. License |vim-markdown-license|
+ 9. References |vim-markdown-references|
+
+===============================================================================
+ *vim-markdown-introduction*
+Introduction ~
+
+Syntax highlighting, matching rules and mappings for the original Markdown [1]
+and extensions.
+
+===============================================================================
+ *vim-markdown-installation*
+Installation ~
+
+If you use Vundle [2], add the following lines to your '~/.vimrc':
+>
+ Plugin 'godlygeek/tabular'
+ Plugin 'plasticboy/vim-markdown'
+<
+The 'tabular' plugin must come _before_ 'vim-markdown'.
+
+Then run inside Vim:
+>
+ :so ~/.vimrc
+ :PluginInstall
+<
+If you use Pathogen [3], do this:
+>
+ cd ~/.vim/bundle
+ git clone https://github.com/plasticboy/vim-markdown.git
+<
+To install without Pathogen using the Debian vim-addon-manager [4], do this:
+>
+ git clone https://github.com/plasticboy/vim-markdown.git
+ cd vim-markdown
+ sudo make install
+ vim-addon-manager install markdown
+<
+If you are not using any package manager, download the tarball [5] and do this:
+>
+ cd ~/.vim
+ tar --strip=1 -zxf vim-markdown-master.tar.gz
+<
+===============================================================================
+ *vim-markdown-basic-usage*
+Basic usage ~
+
+-------------------------------------------------------------------------------
+ *vim-markdown-folding*
+Folding ~
+
+Folding is enabled for headers by default.
+
+The following commands are useful to open and close folds:
+
+ *vim-markdown-zr*
+- 'zr': reduces fold level throughout the buffer
+ *vim-markdown-zR*
+- 'zR': opens all folds
+ *vim-markdown-zm*
+- 'zm': increases fold level throughout the buffer
+ *vim-markdown-zM*
+- 'zM': folds everything all the way
+ *vim-markdown-za*
+- 'za': open a fold your cursor is on
+ *vim-markdown-zA*
+- 'zA': open a fold your cursor is on recursively
+ *vim-markdown-zc*
+- 'zc': close a fold your cursor is on
+ *vim-markdown-zC*
+- 'zC': close a fold your cursor is on recursively
+
+Options are available to disable folding or change folding style.
+
+Try ':help fold-expr' and ':help fold-commands' for details.
+
+-------------------------------------------------------------------------------
+ *vim-markdown-concealing*
+Concealing ~
+
+Concealing is set for some syntax such as bold, italic, code block and link.
+
+Concealing lets you conceal text with other text. The actual source text is not
+modified. If you put your cursor on the concealed line, the conceal goes away.
+
+Options are available to disable or change concealing.
+
+Try ':help concealcursor' and ':help conceallevel' for details.
+
+===============================================================================
+ *vim-markdown-options*
+Options ~
+
+-------------------------------------------------------------------------------
+ *vim-markdown-disable-folding*
+Disable Folding ~
+
+ *g:vim_markdown_folding_disabled*
+- 'g:vim_markdown_folding_disabled'
+
+ Add the following line to your '.vimrc' to disable the folding
+ configuration:
+>
+ let g:vim_markdown_folding_disabled = 1
+<
+ This option only controls Vim Markdown specific folding configuration.
+
+ To enable/disable folding use Vim's standard folding configuration.
+>
+ set [no]foldenable
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-change-fold-style*
+Change fold style ~
+
+ *g:vim_markdown_folding_style_pythonic*
+- 'g:vim_markdown_folding_style_pythonic'
+
+ To fold in a style like python-mode [6], add the following to your
+ '.vimrc':
+>
+ let g:vim_markdown_folding_style_pythonic = 1
+<
+ 'g:vim_markdown_folding_level' setting (default 1) is set to 'foldlevel'.
+ Thus level 1 heading which is served as a document title is expanded by
+ default.
+
+ *g:vim_markdown_override_foldtext*
+- 'g:vim_markdown_override_foldtext'
+
+ To prevent foldtext from being set add the following to your '.vimrc':
+>
+ let g:vim_markdown_override_foldtext = 0
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-set-header-folding-level*
+Set header folding level ~
+
+ *g:vim_markdown_folding_level*
+- 'g:vim_markdown_folding_level'
+
+ Folding level is a number between 1 and 6. By default, if not specified, it
+ is set to 1.
+>
+ let g:vim_markdown_folding_level = 6
+<
+ Tip: it can be changed on the fly with:
+>
+ :let g:vim_markdown_folding_level = 1
+ :edit
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-disable-default-key-mappings*
+Disable Default Key Mappings ~
+
+ *g:vim_markdown_no_default_key_mappings*
+- 'g:vim_markdown_no_default_key_mappings'
+
+ Add the following line to your '.vimrc' to disable default key mappings:
+>
+ let g:vim_markdown_no_default_key_mappings = 1
+<
+ You can also map them by yourself with '<Plug>' mappings.
+
+-------------------------------------------------------------------------------
+ *vim-markdown-enable-toc-window-auto-fit*
+Enable TOC window auto-fit ~
+
+ *g:vim_markdown_toc_autofit*
+- 'g:vim_markdown_toc_autofit'
+
+ Allow for the TOC window to auto-fit when it's possible for it to shrink.
+ It never increases its default size (half screen), it only shrinks.
+>
+ let g:vim_markdown_toc_autofit = 1
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-text-emphasis-restriction-to-single-lines*
+Text emphasis restriction to single-lines ~
+
+ *g:vim_markdown_emphasis_multiline*
+- 'g:vim_markdown_emphasis_multiline'
+
+ By default text emphasis works across multiple lines until a closing token
+ is found. However, it's possible to restrict text emphasis to a single line
+ (i.e., for it to be applied a closing token must be found on the same
+ line). To do so:
+>
+ let g:vim_markdown_emphasis_multiline = 0
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-syntax-concealing*
+Syntax Concealing ~
+
+ *g:vim_markdown_conceal*
+- 'g:vim_markdown_conceal'
+
+ Concealing is set for some syntax.
+
+ For example, conceal '[link text](link url)' as just 'link text'. Also,
+ '_italic_' and '*italic*' will conceal to just _italic_. Similarly
+ '__bold__', '**bold**', '___italic bold___', and '***italic bold***' will
+ conceal to just **bold**, **bold**, **_italic bold_**, and **_italic
+ bold_** respectively.
+
+ To enable conceal use Vim's standard conceal configuration.
+>
+ set conceallevel=2
+<
+ To disable conceal regardless of 'conceallevel' setting, add the following
+ to your '.vimrc':
+>
+ let g:vim_markdown_conceal = 0
+<
+ To disable math conceal with LaTeX math syntax enabled, add the following
+ to your '.vimrc':
+>
+ let g:tex_conceal = ""
+ let g:vim_markdown_math = 1
+<
+ *g:vim_markdown_conceal_code_blocks*
+- 'g:vim_markdown_conceal_code_blocks'
+
+ Disabling conceal for code fences requires an additional setting:
+>
+ let g:vim_markdown_conceal_code_blocks = 0
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-fenced-code-block-languages*
+Fenced code block languages ~
+
+ *g:vim_markdown_fenced_languages*
+- 'g:vim_markdown_fenced_languages'
+
+ You can use filetype name as fenced code block languages for syntax
+ highlighting. If you want to use different name from filetype, you can add
+ it in your '.vimrc' like so:
+>
+ let g:vim_markdown_fenced_languages = ['csharp=cs']
+<
+ This will cause the following to be highlighted using the 'cs' filetype
+ syntax.
+>
+ ```csharp
+ ...
+ ```
+<
+ Default is "['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini']".
+
+-------------------------------------------------------------------------------
+ *vim-markdown-follow-named-anchors*
+Follow named anchors ~
+
+ *g:vim_markdown_follow_anchor*
+- 'g:vim_markdown_follow_anchor'
+
+ This feature allows the 'ge' command to follow named anchors in links of
+ the form 'file#anchor' or just '#anchor', where file may omit the '.md'
+ extension as usual. Two variables control its operation:
+>
+ let g:vim_markdown_follow_anchor = 1
+<
+ This tells vim-markdown whether to attempt to follow a named anchor in a
+ link or not. When it is 1, and only if a link can be split in two parts by
+ the pattern '#', then the first part is interpreted as the file and the
+ second one as the named anchor. This also includes urls of the form
+ '#anchor', for which the first part is considered empty, meaning that the
+ target file is the current one. After the file is opened, the anchor will
+ be searched.
+
+ Default is '0'.
+
+ *g:vim_markdown_anchorexpr*
+- 'g:vim_markdown_anchorexpr'
+>
+ let g:vim_markdown_anchorexpr = "'<<'.v:anchor.'>>'"
+<
+ This expression will be evaluated substituting 'v:anchor' with a quoted
+ string that contains the anchor to visit. The result of the evaluation will
+ become the real anchor to search in the target file. This is useful in
+ order to convert anchors of the form, say, 'my-section-title' to searches
+ of the form 'My Section Title' or '<<my-section-title>>'.
+
+ Default is "''".
+
+-------------------------------------------------------------------------------
+ *vim-markdown-syntax-extensions*
+Syntax extensions ~
+
+The following options control which syntax extensions will be turned on. They
+are off by default.
+
+-------------------------------------------------------------------------------
+ *vim-markdown-latex-math*
+LaTeX math ~
+
+ *g:vim_markdown_math*
+- 'g:vim_markdown_math'
+
+ Used as '$x^2$', '$$x^2$$', escapable as '\$x\$' and '\$\$x\$\$'.
+>
+ let g:vim_markdown_math = 1
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-yaml-front-matter*
+YAML Front Matter ~
+
+ *g:vim_markdown_frontmatter*
+- 'g:vim_markdown_frontmatter'
+
+ Highlight YAML front matter as used by Jekyll or Hugo [7].
+>
+ let g:vim_markdown_frontmatter = 1
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-toml-front-matter*
+TOML Front Matter ~
+
+ *g:vim_markdown_toml_frontmatter*
+- 'g:vim_markdown_toml_frontmatter'
+
+ Highlight TOML front matter as used by Hugo [7].
+
+ TOML syntax highlight requires vim-toml [8].
+>
+ let g:vim_markdown_toml_frontmatter = 1
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-json-front-matter*
+JSON Front Matter ~
+
+ *g:vim_markdown_json_frontmatter*
+- 'g:vim_markdown_json_frontmatter'
+
+ Highlight JSON front matter as used by Hugo [7].
+
+ JSON syntax highlight requires vim-json [9].
+>
+ let g:vim_markdown_json_frontmatter = 1
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-strikethrough*
+Strikethrough ~
+
+ *g:vim_markdown_strikethrough*
+- 'g:vim_markdown_strikethrough'
+
+ Strikethrough uses two tildes. '~~Scratch this.~~'
+>
+ let g:vim_markdown_strikethrough = 1
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-adjust-new-list-item-indent*
+Adjust new list item indent ~
+
+ *g:vim_markdown_new_list_item_indent*
+- 'g:vim_markdown_new_list_item_indent'
+
+ You can adjust a new list indent. For example, you insert a single line
+ like below:
+>
+ * item1
+<
+ Then if you type 'o' to insert new line in vim and type '* item2', the
+ result will be:
+>
+ * item1
+ * item2
+<
+ vim-markdown automatically insert the indent. By default, the number of
+ spaces of indent is 4. If you'd like to change the number as 2, just write:
+>
+ let g:vim_markdown_new_list_item_indent = 2
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-do-not-require-.md-extensions-for-markdown-links*
+Do not require .md extensions for Markdown links ~
+
+ *g:vim_markdown_no_extensions_in_markdown*
+- 'g:vim_markdown_no_extensions_in_markdown'
+
+ If you want to have a link like this '[link text](link-url)' and follow it
+ for editing in vim using the 'ge' command, but have it open the file "link-
+ url.md" instead of the file "link-url", then use this option:
+>
+ let g:vim_markdown_no_extensions_in_markdown = 1
+<
+ This is super useful for GitLab and GitHub wiki repositories.
+
+ Normal behaviour would be that vim-markup required you to do this '[link
+ text](link-url.md)', but this is not how the Gitlab and GitHub wiki
+ repositories work. So this option adds some consistency between the two.
+
+-------------------------------------------------------------------------------
+ *vim-markdown-auto-write-when-following-link*
+Auto-write when following link ~
+
+ *g:vim_markdown_autowrite*
+- 'g:vim_markdown_autowrite'
+
+ If you follow a link like this '[link text](link-url)' using the 'ge'
+ shortcut, this option will automatically save any edits you made before
+ moving you:
+>
+ let g:vim_markdown_autowrite = 1
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-change-default-file-extension*
+Change default file extension ~
+
+ *g:vim_markdown_auto_extension_ext*
+- 'g:vim_markdown_auto_extension_ext'
+
+ If you would like to use a file extension other than '.md' you may do so
+ using the 'vim_markdown_auto_extension_ext' variable:
+>
+ let g:vim_markdown_auto_extension_ext = 'txt'
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-do-not-automatically-insert-bulletpoints*
+Do not automatically insert bulletpoints ~
+
+ *g:vim_markdown_auto_insert_bullets*
+- 'g:vim_markdown_auto_insert_bullets'
+
+ Automatically inserting bulletpoints can lead to problems when wrapping
+ text (see issue #232 for details), so it can be disabled:
+>
+ let g:vim_markdown_auto_insert_bullets = 0
+<
+ In that case, you probably also want to set the new list item indent to 0
+ as well, or you will have to remove an indent each time you add a new list
+ item:
+>
+ let g:vim_markdown_new_list_item_indent = 0
+<
+-------------------------------------------------------------------------------
+ *vim-markdown-change-how-to-open-new-files*
+Change how to open new files ~
+
+ *g:vim_markdown_edit_url_in*
+- 'g:vim_markdown_edit_url_in'
+
+ By default when following a link the target file will be opened in your
+ current buffer. This behavior can change if you prefer using splits or tabs
+ by using the 'vim_markdown_edit_url_in' variable. Possible values are
+ 'tab', 'vsplit', 'hsplit', 'current' opening in a new tab, vertical split,
+ horizontal split, and current buffer respectively. Defaults to current
+ buffer if not set:
+>
+ let g:vim_markdown_edit_url_in = 'tab'
+<
+===============================================================================
+ *vim-markdown-mappings*
+Mappings ~
+
+The following work on normal and visual modes:
+
+ *vim-markdown-gx*
+- 'gx': open the link under the cursor in the same browser as the standard
+ 'gx' command. '<Plug>Markdown_OpenUrlUnderCursor'
+
+ The standard 'gx' is extended by allowing you to put your cursor anywhere
+ inside a link.
+
+ For example, all the following cursor positions will work:
+>
+ [Example](http://example.com)
+ ^ ^ ^^ ^ ^
+ 1 2 34 5 6
+
+ <http://example.com>
+ ^ ^ ^
+ 1 2 3
+<
+ Known limitation: does not work for links that span multiple lines.
+
+ *vim-markdown-ge*
+- 'ge': open the link under the cursor in Vim for editing. Useful for
+ relative markdown links. '<Plug>Markdown_EditUrlUnderCursor'
+
+ The rules for the cursor position are the same as the 'gx' command.
+
+ *vim-markdown-]]*
+- ']]': go to next header. '<Plug>Markdown_MoveToNextHeader'
+
+ *vim-markdown-[[*
+- '[[': go to previous header. Contrast with ']c'.
+ '<Plug>Markdown_MoveToPreviousHeader'
+
+ *vim-markdown-][*
+- '][': go to next sibling header if any.
+ '<Plug>Markdown_MoveToNextSiblingHeader'
+
+ *vim-markdown-[]*
+- '[]': go to previous sibling header if any.
+ '<Plug>Markdown_MoveToPreviousSiblingHeader'
+
+ *vim-markdown-]c*
+- ']c': go to Current header. '<Plug>Markdown_MoveToCurHeader'
+
+ *vim-markdown-]u*
+- ']u': go to parent header (Up). '<Plug>Markdown_MoveToParentHeader'
+
+This plugin follows the recommended Vim plugin mapping interface, so to change
+the map ']u' to 'asdf', add to your '.vimrc':
+>
+ map asdf <Plug>Markdown_MoveToParentHeader
+<
+To disable a map use:
+>
+ map <Plug> <Plug>Markdown_MoveToParentHeader
+<
+===============================================================================
+ *vim-markdown-commands*
+Commands ~
+
+The following requires ':filetype plugin on'.
+
+ *:HeaderDecrease*
+- ':HeaderDecrease':
+
+ Decrease level of all headers in buffer: 'h2' to 'h1', 'h3' to 'h2', etc.
+
+ If range is given, only operate in the range.
+
+ If an 'h1' would be decreased, abort.
+
+ For simplicity of implementation, Setex headers are converted to Atx.
+
+ *:HeaderIncrease*
+- ':HeaderIncrease': Analogous to ':HeaderDecrease', but increase levels
+ instead.
+
+ *:SetexToAtx*
+- ':SetexToAtx':
+
+ Convert all Setex style headers in buffer to Atx.
+
+ If a range is given, e.g. hit ':' from visual mode, only operate on the
+ range.
+
+ *:TableFormat*
+- ':TableFormat': Format the table under the cursor like this [10].
+
+ Requires Tabular [11].
+
+ The input table _must_ already have a separator line as the second line of
+ the table. That line only needs to contain the correct pipes '|', nothing
+ else is required.
+
+ *:Toc*
+- ':Toc': create a quickfix vertical window navigable table of contents with
+ the headers.
+
+ Hit '<Enter>' on a line to jump to the corresponding line of the markdown
+ file.
+
+ *:Toch*
+- ':Toch': Same as ':Toc' but in an horizontal window.
+
+ *:Toct*
+- ':Toct': Same as ':Toc' but in a new tab.
+
+ *:Tocv*
+- ':Tocv': Same as ':Toc' for symmetry with ':Toch' and ':Tocv'.
+
+===============================================================================
+ *vim-markdown-credits*
+Credits ~
+
+The main contributors of vim-markdown are:
+
+- **Ben Williams** (A.K.A. **plasticboy**). The original developer of vim-
+ markdown. Homepage [12].
+
+If you feel that your name should be on this list, please make a pull request
+listing your contributions.
+
+===============================================================================
+ *vim-markdown-license*
+License ~
+
+The MIT License (MIT)
+
+Copyright (c) 2012 Benjamin D. Williams
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+===============================================================================
+ *vim-markdown-references*
+References ~
+
+[1] http://daringfireball.net/projects/markdown/
+[2] https://github.com/gmarik/vundle
+[3] https://github.com/tpope/vim-pathogen
+[4] http://packages.qa.debian.org/v/vim-addon-manager.html
+[5] https://github.com/plasticboy/vim-markdown/archive/master.tar.gz
+[6] https://github.com/klen/python-mode
+[7] https://gohugo.io/content/front-matter/
+[8] https://github.com/cespare/vim-toml
+[9] https://github.com/elzr/vim-json
+[10] http://www.cirosantilli.com/markdown-style-guide/#tables
+[11] https://github.com/godlygeek/tabular
+[12] http://plasticboy.com/
+
+vim: ft=help
--- /dev/null
+if !has('patch-7.4.480')
+ " Before this patch, vim used modula2 for .md.
+ au! filetypedetect BufRead,BufNewFile *.md
+endif
+
+" markdown filetype file
+au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} setfiletype markdown
+au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx} setfiletype markdown
--- /dev/null
+"TODO print messages when on visual mode. I only see VISUAL, not the messages.
+
+" Function interface phylosophy:
+"
+" - functions take arbitrary line numbers as parameters.
+" Current cursor line is only a suitable default parameter.
+"
+" - only functions that bind directly to user actions:
+"
+" - print error messages.
+" All intermediate functions limit themselves return `0` to indicate an error.
+"
+" - move the cursor. All other functions do not move the cursor.
+"
+" This is how you should view headers for the header mappings:
+"
+" |BUFFER
+" |
+" |Outside any header
+" |
+" a-+# a
+" |
+" |Inside a
+" |
+" a-+
+" b-+## b
+" |
+" |inside b
+" |
+" b-+
+" c-+### c
+" |
+" |Inside c
+" |
+" c-+
+" d-|# d
+" |
+" |Inside d
+" |
+" d-+
+" e-|e
+" |====
+" |
+" |Inside e
+" |
+" e-+
+
+" For each level, contains the regexp that matches at that level only.
+"
+let s:levelRegexpDict = {
+ \ 1: '\v^(#[^#]@=|.+\n\=+$)',
+ \ 2: '\v^(##[^#]@=|.+\n-+$)',
+ \ 3: '\v^###[^#]@=',
+ \ 4: '\v^####[^#]@=',
+ \ 5: '\v^#####[^#]@=',
+ \ 6: '\v^######[^#]@='
+\ }
+
+" Maches any header level of any type.
+"
+" This could be deduced from `s:levelRegexpDict`, but it is more
+" efficient to have a single regexp for this.
+"
+let s:headersRegexp = '\v^(#|.+\n(\=+|-+)$)'
+
+" Returns the line number of the first header before `line`, called the
+" current header.
+"
+" If there is no current header, return `0`.
+"
+" @param a:1 The line to look the header of. Default value: `getpos('.')`.
+"
+function! s:GetHeaderLineNum(...)
+ if a:0 == 0
+ let l:l = line('.')
+ else
+ let l:l = a:1
+ endif
+ while(l:l > 0)
+ if join(getline(l:l, l:l + 1), "\n") =~ s:headersRegexp
+ return l:l
+ endif
+ let l:l -= 1
+ endwhile
+ return 0
+endfunction
+
+" - if inside a header goes to it.
+" Return its line number.
+"
+" - if on top level outside any headers,
+" print a warning
+" Return `0`.
+"
+function! s:MoveToCurHeader()
+ let l:lineNum = s:GetHeaderLineNum()
+ if l:lineNum != 0
+ call cursor(l:lineNum, 1)
+ else
+ echo 'outside any header'
+ "normal! gg
+ endif
+ return l:lineNum
+endfunction
+
+" Move cursor to next header of any level.
+"
+" If there are no more headers, print a warning.
+"
+function! s:MoveToNextHeader()
+ if search(s:headersRegexp, 'W') == 0
+ "normal! G
+ echo 'no next header'
+ endif
+endfunction
+
+" Move cursor to previous header (before current) of any level.
+"
+" If it does not exist, print a warning.
+"
+function! s:MoveToPreviousHeader()
+ let l:curHeaderLineNumber = s:GetHeaderLineNum()
+ let l:noPreviousHeader = 0
+ if l:curHeaderLineNumber <= 1
+ let l:noPreviousHeader = 1
+ else
+ let l:previousHeaderLineNumber = s:GetHeaderLineNum(l:curHeaderLineNumber - 1)
+ if l:previousHeaderLineNumber == 0
+ let l:noPreviousHeader = 1
+ else
+ call cursor(l:previousHeaderLineNumber, 1)
+ endif
+ endif
+ if l:noPreviousHeader
+ echo 'no previous header'
+ endif
+endfunction
+
+" - if line is inside a header, return the header level (h1 -> 1, h2 -> 2, etc.).
+"
+" - if line is at top level outside any headers, return `0`.
+"
+function! s:GetHeaderLevel(...)
+ if a:0 == 0
+ let l:line = line('.')
+ else
+ let l:line = a:1
+ endif
+ let l:linenum = s:GetHeaderLineNum(l:line)
+ if l:linenum != 0
+ return s:GetLevelOfHeaderAtLine(l:linenum)
+ else
+ return 0
+ endif
+endfunction
+
+" Returns the level of the header at the given line.
+"
+" If there is no header at the given line, returns `0`.
+"
+function! s:GetLevelOfHeaderAtLine(linenum)
+ let l:lines = join(getline(a:linenum, a:linenum + 1), "\n")
+ for l:key in keys(s:levelRegexpDict)
+ if l:lines =~ get(s:levelRegexpDict, l:key)
+ return l:key
+ endif
+ endfor
+ return 0
+endfunction
+
+" Move cursor to parent header of the current header.
+"
+" If it does not exit, print a warning and do nothing.
+"
+function! s:MoveToParentHeader()
+ let l:linenum = s:GetParentHeaderLineNumber()
+ if l:linenum != 0
+ call cursor(l:linenum, 1)
+ else
+ echo 'no parent header'
+ endif
+endfunction
+
+" Return the line number of the parent header of line `line`.
+"
+" If it has no parent, return `0`.
+"
+function! s:GetParentHeaderLineNumber(...)
+ if a:0 == 0
+ let l:line = line('.')
+ else
+ let l:line = a:1
+ endif
+ let l:level = s:GetHeaderLevel(l:line)
+ if l:level > 1
+ let l:linenum = s:GetPreviousHeaderLineNumberAtLevel(l:level - 1, l:line)
+ return l:linenum
+ endif
+ return 0
+endfunction
+
+" Return the line number of the previous header of given level.
+" in relation to line `a:1`. If not given, `a:1 = getline()`
+"
+" `a:1` line is included, and this may return the current header.
+"
+" If none return 0.
+"
+function! s:GetNextHeaderLineNumberAtLevel(level, ...)
+ if a:0 < 1
+ let l:line = line('.')
+ else
+ let l:line = a:1
+ endif
+ let l:l = l:line
+ while(l:l <= line('$'))
+ if join(getline(l:l, l:l + 1), "\n") =~ get(s:levelRegexpDict, a:level)
+ return l:l
+ endif
+ let l:l += 1
+ endwhile
+ return 0
+endfunction
+
+" Return the line number of the previous header of given level.
+" in relation to line `a:1`. If not given, `a:1 = getline()`
+"
+" `a:1` line is included, and this may return the current header.
+"
+" If none return 0.
+"
+function! s:GetPreviousHeaderLineNumberAtLevel(level, ...)
+ if a:0 == 0
+ let l:line = line('.')
+ else
+ let l:line = a:1
+ endif
+ let l:l = l:line
+ while(l:l > 0)
+ if join(getline(l:l, l:l + 1), "\n") =~ get(s:levelRegexpDict, a:level)
+ return l:l
+ endif
+ let l:l -= 1
+ endwhile
+ return 0
+endfunction
+
+" Move cursor to next sibling header.
+"
+" If there is no next siblings, print a warning and don't move.
+"
+function! s:MoveToNextSiblingHeader()
+ let l:curHeaderLineNumber = s:GetHeaderLineNum()
+ let l:curHeaderLevel = s:GetLevelOfHeaderAtLine(l:curHeaderLineNumber)
+ let l:curHeaderParentLineNumber = s:GetParentHeaderLineNumber()
+ let l:nextHeaderSameLevelLineNumber = s:GetNextHeaderLineNumberAtLevel(l:curHeaderLevel, l:curHeaderLineNumber + 1)
+ let l:noNextSibling = 0
+ if l:nextHeaderSameLevelLineNumber == 0
+ let l:noNextSibling = 1
+ else
+ let l:nextHeaderSameLevelParentLineNumber = s:GetParentHeaderLineNumber(l:nextHeaderSameLevelLineNumber)
+ if l:curHeaderParentLineNumber == l:nextHeaderSameLevelParentLineNumber
+ call cursor(l:nextHeaderSameLevelLineNumber, 1)
+ else
+ let l:noNextSibling = 1
+ endif
+ endif
+ if l:noNextSibling
+ echo 'no next sibling header'
+ endif
+endfunction
+
+" Move cursor to previous sibling header.
+"
+" If there is no previous siblings, print a warning and do nothing.
+"
+function! s:MoveToPreviousSiblingHeader()
+ let l:curHeaderLineNumber = s:GetHeaderLineNum()
+ let l:curHeaderLevel = s:GetLevelOfHeaderAtLine(l:curHeaderLineNumber)
+ let l:curHeaderParentLineNumber = s:GetParentHeaderLineNumber()
+ let l:previousHeaderSameLevelLineNumber = s:GetPreviousHeaderLineNumberAtLevel(l:curHeaderLevel, l:curHeaderLineNumber - 1)
+ let l:noPreviousSibling = 0
+ if l:previousHeaderSameLevelLineNumber == 0
+ let l:noPreviousSibling = 1
+ else
+ let l:previousHeaderSameLevelParentLineNumber = s:GetParentHeaderLineNumber(l:previousHeaderSameLevelLineNumber)
+ if l:curHeaderParentLineNumber == l:previousHeaderSameLevelParentLineNumber
+ call cursor(l:previousHeaderSameLevelLineNumber, 1)
+ else
+ let l:noPreviousSibling = 1
+ endif
+ endif
+ if l:noPreviousSibling
+ echo 'no previous sibling header'
+ endif
+endfunction
+
+function! s:Toc(...)
+ if a:0 > 0
+ let l:window_type = a:1
+ else
+ let l:window_type = 'vertical'
+ endif
+
+
+ let l:bufnr = bufnr('%')
+ let l:cursor_line = line('.')
+ let l:cursor_header = 0
+ let l:fenced_block = 0
+ let l:front_matter = 0
+ let l:header_list = []
+ let l:header_max_len = 0
+ let l:vim_markdown_toc_autofit = get(g:, "vim_markdown_toc_autofit", 0)
+ let l:vim_markdown_frontmatter = get(g:, "vim_markdown_frontmatter", 0)
+ for i in range(1, line('$'))
+ let l:lineraw = getline(i)
+ let l:l1 = getline(i+1)
+ let l:line = substitute(l:lineraw, "#", "\\\#", "g")
+ if l:line =~ '````*' || l:line =~ '\~\~\~\~*'
+ if l:fenced_block == 0
+ let l:fenced_block = 1
+ elseif l:fenced_block == 1
+ let l:fenced_block = 0
+ endif
+ elseif l:vim_markdown_frontmatter == 1
+ if l:front_matter == 1
+ if l:line == '---'
+ let l:front_matter = 0
+ endif
+ elseif i == 1
+ if l:line == '---'
+ let l:front_matter = 1
+ endif
+ endif
+ endif
+ if l:line =~ '^#\+' || (l:l1 =~ '^=\+\s*$' || l:l1 =~ '^-\+\s*$') && l:line =~ '^\S'
+ let l:is_header = 1
+ else
+ let l:is_header = 0
+ endif
+ if l:is_header == 1 && l:fenced_block == 0 && l:front_matter == 0
+ " append line to location list
+ let l:item = {'lnum': i, 'text': l:line, 'valid': 1, 'bufnr': l:bufnr, 'col': 1}
+ let l:header_list = l:header_list + [l:item]
+ " set header number of the cursor position
+ if l:cursor_header == 0
+ if i == l:cursor_line
+ let l:cursor_header = len(l:header_list)
+ elseif i > l:cursor_line
+ let l:cursor_header = len(l:header_list) - 1
+ endif
+ endif
+ " keep track of the longest header size (heading level + title)
+ let l:total_len = stridx(l:line, ' ') + strdisplaywidth(l:line)
+ if l:total_len > l:header_max_len
+ let l:header_max_len = l:total_len
+ endif
+ endif
+ endfor
+ call setloclist(0, l:header_list)
+ if len(l:header_list) == 0
+ echom "Toc: No headers."
+ return
+ endif
+
+ if l:window_type ==# 'horizontal'
+ lopen
+ elseif l:window_type ==# 'vertical'
+ vertical lopen
+ " auto-fit toc window when possible to shrink it
+ if (&columns/2) > l:header_max_len && l:vim_markdown_toc_autofit == 1
+ execute 'vertical resize ' . (l:header_max_len + 1)
+ else
+ execute 'vertical resize ' . (&columns/2)
+ endif
+ elseif l:window_type ==# 'tab'
+ tab lopen
+ else
+ lopen
+ endif
+ setlocal modifiable
+ for i in range(1, line('$'))
+ " this is the location-list data for the current item
+ let d = getloclist(0)[i-1]
+ " atx headers
+ if match(d.text, "^#") > -1
+ let l:level = len(matchstr(d.text, '#*', 'g'))-1
+ let d.text = substitute(d.text, '\v^#*[ ]*', '', '')
+ let d.text = substitute(d.text, '\v[ ]*#*$', '', '')
+ " setex headers
+ else
+ let l:next_line = getbufline(d.bufnr, d.lnum+1)
+ if match(l:next_line, "=") > -1
+ let l:level = 0
+ elseif match(l:next_line, "-") > -1
+ let l:level = 1
+ endif
+ endif
+ call setline(i, repeat(' ', l:level). d.text)
+ endfor
+ setlocal nomodified
+ setlocal nomodifiable
+ execute 'normal! ' . l:cursor_header . 'G'
+endfunction
+
+" Convert Setex headers in range `line1 .. line2` to Atx.
+"
+" Return the number of conversions.
+"
+function! s:SetexToAtx(line1, line2)
+ let l:originalNumLines = line('$')
+ execute 'silent! ' . a:line1 . ',' . a:line2 . 'substitute/\v(.*\S.*)\n\=+$/# \1/'
+ execute 'silent! ' . a:line1 . ',' . a:line2 . 'substitute/\v(.*\S.*)\n-+$/## \1/'
+ return l:originalNumLines - line('$')
+endfunction
+
+" If `a:1` is 0, decrease the level of all headers in range `line1 .. line2`.
+"
+" Otherwise, increase the level. `a:1` defaults to `0`.
+"
+function! s:HeaderDecrease(line1, line2, ...)
+ if a:0 > 0
+ let l:increase = a:1
+ else
+ let l:increase = 0
+ endif
+ if l:increase
+ let l:forbiddenLevel = 6
+ let l:replaceLevels = [5, 1]
+ let l:levelDelta = 1
+ else
+ let l:forbiddenLevel = 1
+ let l:replaceLevels = [2, 6]
+ let l:levelDelta = -1
+ endif
+ for l:line in range(a:line1, a:line2)
+ if join(getline(l:line, l:line + 1), "\n") =~ s:levelRegexpDict[l:forbiddenLevel]
+ echomsg 'There is an h' . l:forbiddenLevel . ' at line ' . l:line . '. Aborting.'
+ return
+ endif
+ endfor
+ let l:numSubstitutions = s:SetexToAtx(a:line1, a:line2)
+ let l:flags = (&gdefault ? '' : 'g')
+ for l:level in range(replaceLevels[0], replaceLevels[1], -l:levelDelta)
+ execute 'silent! ' . a:line1 . ',' . (a:line2 - l:numSubstitutions) . 'substitute/' . s:levelRegexpDict[l:level] . '/' . repeat('#', l:level + l:levelDelta) . '/' . l:flags
+ endfor
+endfunction
+
+" Format table under cursor.
+"
+" Depends on Tabularize.
+"
+function! s:TableFormat()
+ let l:pos = getpos('.')
+ normal! {
+ " Search instead of `normal! j` because of the table at beginning of file edge case.
+ call search('|')
+ normal! j
+ " Remove everything that is not a pipe, colon or hyphen next to a colon othewise
+ " well formated tables would grow because of addition of 2 spaces on the separator
+ " line by Tabularize /|.
+ let l:flags = (&gdefault ? '' : 'g')
+ execute 's/\(:\@<!-:\@!\|[^|:-]\)//e' . l:flags
+ execute 's/--/-/e' . l:flags
+ Tabularize /|
+ " Move colons for alignment to left or right side of the cell.
+ execute 's/:\( \+\)|/\1:|/e' . l:flags
+ execute 's/|\( \+\):/|:\1/e' . l:flags
+ execute 's/ /-/' . l:flags
+ call setpos('.', l:pos)
+endfunction
+
+" Wrapper to do move commands in visual mode.
+"
+function! s:VisMove(f)
+ norm! gv
+ call function(a:f)()
+endfunction
+
+" Map in both normal and visual modes.
+"
+function! s:MapNormVis(rhs,lhs)
+ execute 'nn <buffer><silent> ' . a:rhs . ' :call ' . a:lhs . '()<cr>'
+ execute 'vn <buffer><silent> ' . a:rhs . ' <esc>:call <sid>VisMove(''' . a:lhs . ''')<cr>'
+endfunction
+
+" Parameters:
+"
+" - step +1 for right, -1 for left
+"
+" TODO: multiple lines.
+"
+function! s:FindCornerOfSyntax(lnum, col, step)
+ let l:col = a:col
+ let l:syn = synIDattr(synID(a:lnum, l:col, 1), 'name')
+ while synIDattr(synID(a:lnum, l:col, 1), 'name') ==# l:syn
+ let l:col += a:step
+ endwhile
+ return l:col - a:step
+endfunction
+
+" Return the next position of the given syntax name,
+" inclusive on the given position.
+"
+" TODO: multiple lines
+"
+function! s:FindNextSyntax(lnum, col, name)
+ let l:col = a:col
+ let l:step = 1
+ while synIDattr(synID(a:lnum, l:col, 1), 'name') !=# a:name
+ let l:col += l:step
+ endwhile
+ return [a:lnum, l:col]
+endfunction
+
+function! s:FindCornersOfSyntax(lnum, col)
+ return [<sid>FindLeftOfSyntax(a:lnum, a:col), <sid>FindRightOfSyntax(a:lnum, a:col)]
+endfunction
+
+function! s:FindRightOfSyntax(lnum, col)
+ return <sid>FindCornerOfSyntax(a:lnum, a:col, 1)
+endfunction
+
+function! s:FindLeftOfSyntax(lnum, col)
+ return <sid>FindCornerOfSyntax(a:lnum, a:col, -1)
+endfunction
+
+" Returns:
+"
+" - a string with the the URL for the link under the cursor
+" - an empty string if the cursor is not on a link
+"
+" TODO
+"
+" - multiline support
+" - give an error if the separator does is not on a link
+"
+function! s:Markdown_GetUrlForPosition(lnum, col)
+ let l:lnum = a:lnum
+ let l:col = a:col
+ let l:syn = synIDattr(synID(l:lnum, l:col, 1), 'name')
+
+ if l:syn ==# 'mkdInlineURL' || l:syn ==# 'mkdURL' || l:syn ==# 'mkdLinkDefTarget'
+ " Do nothing.
+ elseif l:syn ==# 'mkdLink'
+ let [l:lnum, l:col] = <sid>FindNextSyntax(l:lnum, l:col, 'mkdURL')
+ let l:syn = 'mkdURL'
+ elseif l:syn ==# 'mkdDelimiter'
+ let l:line = getline(l:lnum)
+ let l:char = l:line[col - 1]
+ if l:char ==# '<'
+ let l:col += 1
+ elseif l:char ==# '>' || l:char ==# ')'
+ let l:col -= 1
+ elseif l:char ==# '[' || l:char ==# ']' || l:char ==# '('
+ let [l:lnum, l:col] = <sid>FindNextSyntax(l:lnum, l:col, 'mkdURL')
+ else
+ return ''
+ endif
+ else
+ return ''
+ endif
+
+ let [l:left, l:right] = <sid>FindCornersOfSyntax(l:lnum, l:col)
+ return getline(l:lnum)[l:left - 1 : l:right - 1]
+endfunction
+
+" Front end for GetUrlForPosition.
+"
+function! s:OpenUrlUnderCursor()
+ let l:url = s:Markdown_GetUrlForPosition(line('.'), col('.'))
+ if l:url != ''
+ call s:VersionAwareNetrwBrowseX(l:url)
+ else
+ echomsg 'The cursor is not on a link.'
+ endif
+endfunction
+
+" We need a definition guard because we invoke 'edit' which will reload this
+" script while this function is running. We must not replace it.
+if !exists('*s:EditUrlUnderCursor')
+ function s:EditUrlUnderCursor()
+ let l:url = s:Markdown_GetUrlForPosition(line('.'), col('.'))
+ if l:url != ''
+ if get(g:, 'vim_markdown_autowrite', 0)
+ write
+ endif
+ let l:anchor = ''
+ if get(g:, 'vim_markdown_follow_anchor', 0)
+ let l:parts = split(l:url, '#', 1)
+ if len(l:parts) == 2
+ let [l:url, l:anchor] = parts
+ let l:anchorexpr = get(g:, 'vim_markdown_anchorexpr', '')
+ if l:anchorexpr != ''
+ let l:anchor = eval(substitute(
+ \ l:anchorexpr, 'v:anchor',
+ \ escape('"'.l:anchor.'"', '"'), ''))
+ endif
+ endif
+ endif
+ if l:url != ''
+ let l:ext = ''
+ if get(g:, 'vim_markdown_no_extensions_in_markdown', 0)
+ " use another file extension if preferred
+ if exists('g:vim_markdown_auto_extension_ext')
+ let l:ext = '.'.g:vim_markdown_auto_extension_ext
+ else
+ let l:ext = '.md'
+ endif
+ endif
+ let l:url = fnameescape(fnamemodify(expand('%:h').'/'.l:url.l:ext, ':.'))
+ let l:editmethod = ''
+ " determine how to open the linked file (split, tab, etc)
+ if exists('g:vim_markdown_edit_url_in')
+ if g:vim_markdown_edit_url_in == 'tab'
+ let l:editmethod = 'tabnew'
+ elseif g:vim_markdown_edit_url_in == 'vsplit'
+ let l:editmethod = 'vsp'
+ elseif g:vim_markdown_edit_url_in == 'hsplit'
+ let l:editmethod = 'sp'
+ else
+ let l:editmethod = 'edit'
+ endif
+ else
+ " default to current buffer
+ let l:editmethod = 'edit'
+ endif
+ execute l:editmethod l:url
+ endif
+ if l:anchor != ''
+ silent! execute '/'.l:anchor
+ endif
+ else
+ echomsg 'The cursor is not on a link.'
+ endif
+ endfunction
+endif
+
+function! s:VersionAwareNetrwBrowseX(url)
+ if has('patch-7.4.567')
+ call netrw#BrowseX(a:url, 0)
+ else
+ call netrw#NetrwBrowseX(a:url, 0)
+ endif
+endf
+
+function! s:MapNotHasmapto(lhs, rhs)
+ if !hasmapto('<Plug>' . a:rhs)
+ execute 'nmap <buffer>' . a:lhs . ' <Plug>' . a:rhs
+ execute 'vmap <buffer>' . a:lhs . ' <Plug>' . a:rhs
+ endif
+endfunction
+
+call <sid>MapNormVis('<Plug>Markdown_MoveToNextHeader', '<sid>MoveToNextHeader')
+call <sid>MapNormVis('<Plug>Markdown_MoveToPreviousHeader', '<sid>MoveToPreviousHeader')
+call <sid>MapNormVis('<Plug>Markdown_MoveToNextSiblingHeader', '<sid>MoveToNextSiblingHeader')
+call <sid>MapNormVis('<Plug>Markdown_MoveToPreviousSiblingHeader', '<sid>MoveToPreviousSiblingHeader')
+call <sid>MapNormVis('<Plug>Markdown_MoveToParentHeader', '<sid>MoveToParentHeader')
+call <sid>MapNormVis('<Plug>Markdown_MoveToCurHeader', '<sid>MoveToCurHeader')
+nnoremap <Plug>Markdown_OpenUrlUnderCursor :call <sid>OpenUrlUnderCursor()<cr>
+nnoremap <Plug>Markdown_EditUrlUnderCursor :call <sid>EditUrlUnderCursor()<cr>
+
+if !get(g:, 'vim_markdown_no_default_key_mappings', 0)
+ call <sid>MapNotHasmapto(']]', 'Markdown_MoveToNextHeader')
+ call <sid>MapNotHasmapto('[[', 'Markdown_MoveToPreviousHeader')
+ call <sid>MapNotHasmapto('][', 'Markdown_MoveToNextSiblingHeader')
+ call <sid>MapNotHasmapto('[]', 'Markdown_MoveToPreviousSiblingHeader')
+ call <sid>MapNotHasmapto(']u', 'Markdown_MoveToParentHeader')
+ call <sid>MapNotHasmapto(']c', 'Markdown_MoveToCurHeader')
+ call <sid>MapNotHasmapto('gx', 'Markdown_OpenUrlUnderCursor')
+ call <sid>MapNotHasmapto('ge', 'Markdown_EditUrlUnderCursor')
+endif
+
+command! -buffer -range=% HeaderDecrease call s:HeaderDecrease(<line1>, <line2>)
+command! -buffer -range=% HeaderIncrease call s:HeaderDecrease(<line1>, <line2>, 1)
+command! -buffer -range=% SetexToAtx call s:SetexToAtx(<line1>, <line2>)
+command! -buffer TableFormat call s:TableFormat()
+command! -buffer Toc call s:Toc()
+command! -buffer Toch call s:Toc('horizontal')
+command! -buffer Tocv call s:Toc('vertical')
+command! -buffer Toct call s:Toc('tab')
+
+" Heavily based on vim-notes - http://peterodding.com/code/vim/notes/
+if exists('g:vim_markdown_fenced_languages')
+ let s:filetype_dict = {}
+ for s:filetype in g:vim_markdown_fenced_languages
+ let key = matchstr(s:filetype, "[^=]*")
+ let val = matchstr(s:filetype, "[^=]*$")
+ let s:filetype_dict[key] = val
+ endfor
+else
+ let s:filetype_dict = {
+ \ 'c++': 'cpp',
+ \ 'viml': 'vim',
+ \ 'bash': 'sh',
+ \ 'ini': 'dosini'
+ \ }
+endif
+
+function! s:MarkdownHighlightSources(force)
+ " Syntax highlight source code embedded in notes.
+ " Look for code blocks in the current file
+ let filetypes = {}
+ for line in getline(1, '$')
+ let ft = matchstr(line, '```\s*\zs[0-9A-Za-z_+-]*')
+ if !empty(ft) && ft !~ '^\d*$' | let filetypes[ft] = 1 | endif
+ endfor
+ if !exists('b:mkd_known_filetypes')
+ let b:mkd_known_filetypes = {}
+ endif
+ if !exists('b:mkd_included_filetypes')
+ " set syntax file name included
+ let b:mkd_included_filetypes = {}
+ endif
+ if !a:force && (b:mkd_known_filetypes == filetypes || empty(filetypes))
+ return
+ endif
+
+ " Now we're ready to actually highlight the code blocks.
+ let startgroup = 'mkdCodeStart'
+ let endgroup = 'mkdCodeEnd'
+ for ft in keys(filetypes)
+ if a:force || !has_key(b:mkd_known_filetypes, ft)
+ if has_key(s:filetype_dict, ft)
+ let filetype = s:filetype_dict[ft]
+ else
+ let filetype = ft
+ endif
+ let group = 'mkdSnippet' . toupper(substitute(filetype, "[+-]", "_", "g"))
+ if !has_key(b:mkd_included_filetypes, filetype)
+ let include = s:SyntaxInclude(filetype)
+ let b:mkd_included_filetypes[filetype] = 1
+ else
+ let include = '@' . toupper(filetype)
+ endif
+ let command = 'syntax region %s matchgroup=%s start="^\s*```\s*%s$" matchgroup=%s end="\s*```$" keepend contains=%s%s'
+ execute printf(command, group, startgroup, ft, endgroup, include, has('conceal') && get(g:, 'vim_markdown_conceal', 1) && get(g:, 'vim_markdown_conceal_code_blocks', 1) ? ' concealends' : '')
+ execute printf('syntax cluster mkdNonListItem add=%s', group)
+
+ let b:mkd_known_filetypes[ft] = 1
+ endif
+ endfor
+endfunction
+
+function! s:SyntaxInclude(filetype)
+ " Include the syntax highlighting of another {filetype}.
+ let grouplistname = '@' . toupper(a:filetype)
+ " Unset the name of the current syntax while including the other syntax
+ " because some syntax scripts do nothing when "b:current_syntax" is set
+ if exists('b:current_syntax')
+ let syntax_save = b:current_syntax
+ unlet b:current_syntax
+ endif
+ try
+ execute 'syntax include' grouplistname 'syntax/' . a:filetype . '.vim'
+ execute 'syntax include' grouplistname 'after/syntax/' . a:filetype . '.vim'
+ catch /E484/
+ " Ignore missing scripts
+ endtry
+ " Restore the name of the current syntax
+ if exists('syntax_save')
+ let b:current_syntax = syntax_save
+ elseif exists('b:current_syntax')
+ unlet b:current_syntax
+ endif
+ return grouplistname
+endfunction
+
+
+function! s:MarkdownRefreshSyntax(force)
+ if &filetype =~ 'markdown' && line('$') > 1
+ call s:MarkdownHighlightSources(a:force)
+ endif
+endfunction
+
+function! s:MarkdownClearSyntaxVariables()
+ if &filetype =~ 'markdown'
+ unlet! b:mkd_included_filetypes
+ endif
+endfunction
+
+augroup Mkd
+ " These autocmd calling s:MarkdownRefreshSyntax need to be kept in sync with
+ " the autocmds calling s:MarkdownSetupFolding in after/ftplugin/markdown.vim.
+ autocmd! * <buffer>
+ autocmd BufWinEnter <buffer> call s:MarkdownRefreshSyntax(1)
+ autocmd BufUnload <buffer> call s:MarkdownClearSyntaxVariables()
+ autocmd BufWritePost <buffer> call s:MarkdownRefreshSyntax(0)
+ autocmd InsertEnter,InsertLeave <buffer> call s:MarkdownRefreshSyntax(0)
+ autocmd CursorHold,CursorHoldI <buffer> call s:MarkdownRefreshSyntax(0)
+augroup END
--- /dev/null
+if exists("b:did_indent") | finish | endif
+let b:did_indent = 1
+
+setlocal indentexpr=GetMarkdownIndent()
+setlocal nolisp
+setlocal autoindent
+
+" Automatically continue blockquote on line break
+setlocal formatoptions+=r
+setlocal comments=b:>
+if get(g:, "vim_markdown_auto_insert_bullets", 1)
+ " Do not automatically insert bullets when auto-wrapping with text-width
+ setlocal formatoptions-=c
+ " Accept various markers as bullets
+ setlocal comments+=b:*,b:+,b:-
+endif
+
+" Only define the function once
+if exists("*GetMarkdownIndent") | finish | endif
+
+function! s:IsMkdCode(lnum)
+ let name = synIDattr(synID(a:lnum, 1, 0), 'name')
+ return (name =~ '^mkd\%(Code$\|Snippet\)' || name != '' && name !~ '^\%(mkd\|html\)')
+endfunction
+
+function! s:IsLiStart(line)
+ return a:line !~ '^ *\([*-]\)\%( *\1\)\{2}\%( \|\1\)*$' &&
+ \ a:line =~ '^\s*[*+-] \+'
+endfunction
+
+function! s:IsHeaderLine(line)
+ return a:line =~ '^\s*#'
+endfunction
+
+function! s:IsBlankLine(line)
+ return a:line =~ '^$'
+endfunction
+
+function! s:PrevNonBlank(lnum)
+ let i = a:lnum
+ while i > 1 && s:IsBlankLine(getline(i))
+ let i -= 1
+ endwhile
+ return i
+endfunction
+
+function GetMarkdownIndent()
+ if v:lnum > 2 && s:IsBlankLine(getline(v:lnum - 1)) && s:IsBlankLine(getline(v:lnum - 2))
+ return 0
+ endif
+ let list_ind = get(g:, "vim_markdown_new_list_item_indent", 4)
+ " Find a non-blank line above the current line.
+ let lnum = s:PrevNonBlank(v:lnum - 1)
+ " At the start of the file use zero indent.
+ if lnum == 0 | return 0 | endif
+ let ind = indent(lnum)
+ let line = getline(lnum) " Last line
+ let cline = getline(v:lnum) " Current line
+ if s:IsLiStart(cline)
+ " Current line is the first line of a list item, do not change indent
+ return indent(v:lnum)
+ elseif s:IsHeaderLine(cline) && !s:IsMkdCode(v:lnum)
+ " Current line is the header, do not indent
+ return 0
+ elseif s:IsLiStart(line)
+ if s:IsMkdCode(lnum)
+ return ind
+ else
+ " Last line is the first line of a list item, increase indent
+ return ind + list_ind
+ end
+ else
+ return ind
+ endif
+endfunction
--- /dev/null
+addon: markdown
+description: "Markdown syntax highlighting"
+files:
+ - ftdetect/markdown.vim
+ - ftplugin/markdown.vim
+ - syntax/markdown.vim
+ - after/ftplugin/markdown.vim
+ - indent/markdown.vim
+ - doc/vim-markdown.txt
--- /dev/null
+" Vim syntax file
+" Language: Markdown
+" Maintainer: Ben Williams <benw@plasticboy.com>
+" URL: http://plasticboy.com/markdown-vim-mode/
+" Remark: Uses HTML syntax file
+" TODO: Handle stuff contained within stuff (e.g. headings within blockquotes)
+
+
+" Read the HTML syntax to start with
+if version < 600
+ so <sfile>:p:h/html.vim
+else
+ runtime! syntax/html.vim
+
+ if exists('b:current_syntax')
+ unlet b:current_syntax
+ endif
+endif
+
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+endif
+
+" don't use standard HiLink, it will not work with included syntax files
+if version < 508
+ command! -nargs=+ HtmlHiLink hi link <args>
+else
+ command! -nargs=+ HtmlHiLink hi def link <args>
+endif
+
+syn spell toplevel
+syn case ignore
+syn sync linebreaks=1
+
+let s:conceal = ''
+let s:concealends = ''
+let s:concealcode = ''
+if has('conceal') && get(g:, 'vim_markdown_conceal', 1)
+ let s:conceal = ' conceal'
+ let s:concealends = ' concealends'
+endif
+if has('conceal') && get(g:, 'vim_markdown_conceal_code_blocks', 1)
+ let s:concealcode = ' concealends'
+endif
+
+" additions to HTML groups
+if get(g:, 'vim_markdown_emphasis_multiline', 1)
+ let s:oneline = ''
+else
+ let s:oneline = ' oneline'
+endif
+syn region mkdItalic matchgroup=mkdItalic start="\%(\*\|_\)" end="\%(\*\|_\)"
+syn region mkdBold matchgroup=mkdBold start="\%(\*\*\|__\)" end="\%(\*\*\|__\)"
+syn region mkdBoldItalic matchgroup=mkdBoldItalic start="\%(\*\*\*\|___\)" end="\%(\*\*\*\|___\)"
+execute 'syn region htmlItalic matchgroup=mkdItalic start="\%(^\|\s\)\zs\*\ze[^\\\*\t ]\%(\%([^*]\|\\\*\|\n\)*[^\\\*\t ]\)\?\*\_W" end="[^\\\*\t ]\zs\*\ze\_W" keepend contains=@Spell' . s:oneline . s:concealends
+execute 'syn region htmlItalic matchgroup=mkdItalic start="\%(^\|\s\)\zs_\ze[^\\_\t ]" end="[^\\_\t ]\zs_\ze\_W" keepend contains=@Spell' . s:oneline . s:concealends
+execute 'syn region htmlBold matchgroup=mkdBold start="\%(^\|\s\)\zs\*\*\ze\S" end="\S\zs\*\*" keepend contains=@Spell' . s:oneline . s:concealends
+execute 'syn region htmlBold matchgroup=mkdBold start="\%(^\|\s\)\zs__\ze\S" end="\S\zs__" keepend contains=@Spell' . s:oneline . s:concealends
+execute 'syn region htmlBoldItalic matchgroup=mkdBoldItalic start="\%(^\|\s\)\zs\*\*\*\ze\S" end="\S\zs\*\*\*" keepend contains=@Spell' . s:oneline . s:concealends
+execute 'syn region htmlBoldItalic matchgroup=mkdBoldItalic start="\%(^\|\s\)\zs___\ze\S" end="\S\zs___" keepend contains=@Spell' . s:oneline . s:concealends
+
+" [link](URL) | [link][id] | [link][] | ![image](URL)
+syn region mkdFootnotes matchgroup=mkdDelimiter start="\[^" end="\]"
+execute 'syn region mkdID matchgroup=mkdDelimiter start="\[" end="\]" contained oneline' . s:conceal
+execute 'syn region mkdURL matchgroup=mkdDelimiter start="(" end=")" contained oneline' . s:conceal
+execute 'syn region mkdLink matchgroup=mkdDelimiter start="\\\@<!!\?\[\ze[^]\n]*\n\?[^]\n]*\][[(]" end="\]" contains=@mkdNonListItem,@Spell nextgroup=mkdURL,mkdID skipwhite' . s:concealends
+
+" Autolink without angle brackets.
+" mkd inline links: protocol optional user:pass@ sub/domain .com, .co.uk, etc optional port path/querystring/hash fragment
+" ------------ _____________________ ----------------------------- _________________________ ----------------- __
+syn match mkdInlineURL /https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z0-9][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*/
+
+" Autolink with parenthesis.
+syn region mkdInlineURL matchgroup=mkdDelimiter start="(\(https\?:\/\/\(\w\+\(:\w\+\)\?@\)\?\([A-Za-z0-9][-_0-9A-Za-z]*\.\)\{1,}\(\w\{2,}\.\?\)\{1,}\(:[0-9]\{1,5}\)\?\S*)\)\@=" end=")"
+
+" Autolink with angle brackets.
+syn region mkdInlineURL matchgroup=mkdDelimiter start="\\\@<!<\ze[a-z][a-z0-9,.-]\{1,22}:\/\/[^> ]*>" end=">"
+
+" Link definitions: [id]: URL (Optional Title)
+syn region mkdLinkDef matchgroup=mkdDelimiter start="^ \{,3}\zs\[\^\@!" end="]:" oneline nextgroup=mkdLinkDefTarget skipwhite
+syn region mkdLinkDefTarget start="<\?\zs\S" excludenl end="\ze[>[:space:]\n]" contained nextgroup=mkdLinkTitle,mkdLinkDef skipwhite skipnl oneline
+syn region mkdLinkTitle matchgroup=mkdDelimiter start=+"+ end=+"+ contained
+syn region mkdLinkTitle matchgroup=mkdDelimiter start=+'+ end=+'+ contained
+syn region mkdLinkTitle matchgroup=mkdDelimiter start=+(+ end=+)+ contained
+
+"HTML headings
+syn region htmlH1 matchgroup=mkdHeading start="^\s*#" end="$" contains=mkdLink,mkdInlineURL,@Spell
+syn region htmlH2 matchgroup=mkdHeading start="^\s*##" end="$" contains=mkdLink,mkdInlineURL,@Spell
+syn region htmlH3 matchgroup=mkdHeading start="^\s*###" end="$" contains=mkdLink,mkdInlineURL,@Spell
+syn region htmlH4 matchgroup=mkdHeading start="^\s*####" end="$" contains=mkdLink,mkdInlineURL,@Spell
+syn region htmlH5 matchgroup=mkdHeading start="^\s*#####" end="$" contains=mkdLink,mkdInlineURL,@Spell
+syn region htmlH6 matchgroup=mkdHeading start="^\s*######" end="$" contains=mkdLink,mkdInlineURL,@Spell
+syn match htmlH1 /^.\+\n=\+$/ contains=mkdLink,mkdInlineURL,@Spell
+syn match htmlH2 /^.\+\n-\+$/ contains=mkdLink,mkdInlineURL,@Spell
+
+"define Markdown groups
+syn match mkdLineBreak / \+$/
+syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLink,mkdInlineURL,mkdLineBreak,@Spell
+execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@<!`/ end=/`/' . s:concealcode
+execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@<!``/ skip=/[^`]`[^`]/ end=/``/' . s:concealcode
+execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/^\s*\z(`\{3,}\)[^`]*$/ end=/^\s*\z1`*\s*$/' . s:concealcode
+execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/\(\([^\\]\|^\)\\\)\@<!\~\~/ end=/\(\([^\\]\|^\)\\\)\@<!\~\~/' . s:concealcode
+execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start=/^\s*\z(\~\{3,}\)\s*[0-9A-Za-z_+-]*\s*$/ end=/^\s*\z1\~*\s*$/' . s:concealcode
+execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="<pre[^>]*\\\@<!>" end="</pre>"' . s:concealcode
+execute 'syn region mkdCode matchgroup=mkdCodeDelimiter start="<code[^>]*\\\@<!>" end="</code>"' . s:concealcode
+syn region mkdFootnote start="\[^" end="\]"
+syn match mkdCode /^\s*\n\(\(\s\{8,}[^ ]\|\t\t\+[^\t]\).*\n\)\+/
+syn match mkdCode /\%^\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/
+syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ contained
+syn match mkdListItem /^\s*\%([-*+]\|\d\+\.\)\ze\s\+/ contained
+syn region mkdListItemLine start="^\s*\%([-*+]\|\d\+\.\)\s\+" end="$" oneline contains=@mkdNonListItem,mkdListItem,@Spell
+syn region mkdNonListItemBlock start="\(\%^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@!\|\n\(\_^\_$\|\s\{4,}[^ ]\|\t+[^\t]\)\@!\)" end="^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@=" contains=@mkdNonListItem,@Spell
+syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*\(\*\|\s\)*$/
+syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-\(-\|\s\)*$/
+syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_\(_\|\s\)*$/
+
+" YAML frontmatter
+if get(g:, 'vim_markdown_frontmatter', 0)
+ syn include @yamlTop syntax/yaml.vim
+ syn region Comment matchgroup=mkdDelimiter start="\%^---$" end="^\(---\|\.\.\.\)$" contains=@yamlTop keepend
+ unlet! b:current_syntax
+endif
+
+if get(g:, 'vim_markdown_toml_frontmatter', 0)
+ try
+ syn include @tomlTop syntax/toml.vim
+ syn region Comment matchgroup=mkdDelimiter start="\%^+++$" end="^+++$" transparent contains=@tomlTop keepend
+ unlet! b:current_syntax
+ catch /E484/
+ syn region Comment matchgroup=mkdDelimiter start="\%^+++$" end="^+++$"
+ endtry
+endif
+
+if get(g:, 'vim_markdown_json_frontmatter', 0)
+ try
+ syn include @jsonTop syntax/json.vim
+ syn region Comment matchgroup=mkdDelimiter start="\%^{$" end="^}$" contains=@jsonTop keepend
+ unlet! b:current_syntax
+ catch /E484/
+ syn region Comment matchgroup=mkdDelimiter start="\%^{$" end="^}$"
+ endtry
+endif
+
+if get(g:, 'vim_markdown_math', 0)
+ syn include @tex syntax/tex.vim
+ syn region mkdMath start="\\\@<!\$" end="\$" skip="\\\$" contains=@tex keepend
+ syn region mkdMath start="\\\@<!\$\$" end="\$\$" skip="\\\$" contains=@tex keepend
+endif
+
+" Strike through
+if get(g:, 'vim_markdown_strikethrough', 0)
+ execute 'syn region mkdStrike matchgroup=htmlStrike start="\%(\~\~\)" end="\%(\~\~\)"' . s:concealends
+ HtmlHiLink mkdStrike htmlStrike
+endif
+
+syn cluster mkdNonListItem contains=@htmlTop,htmlItalic,htmlBold,htmlBoldItalic,mkdFootnotes,mkdInlineURL,mkdLink,mkdLinkDef,mkdLineBreak,mkdBlockquote,mkdCode,mkdRule,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6,mkdMath,mkdStrike
+
+"highlighting for Markdown groups
+HtmlHiLink mkdString String
+HtmlHiLink mkdCode String
+HtmlHiLink mkdCodeDelimiter String
+HtmlHiLink mkdCodeStart String
+HtmlHiLink mkdCodeEnd String
+HtmlHiLink mkdFootnote Comment
+HtmlHiLink mkdBlockquote Comment
+HtmlHiLink mkdListItem Identifier
+HtmlHiLink mkdRule Identifier
+HtmlHiLink mkdLineBreak Visual
+HtmlHiLink mkdFootnotes htmlLink
+HtmlHiLink mkdLink htmlLink
+HtmlHiLink mkdURL htmlString
+HtmlHiLink mkdInlineURL htmlLink
+HtmlHiLink mkdID Identifier
+HtmlHiLink mkdLinkDef mkdID
+HtmlHiLink mkdLinkDefTarget mkdURL
+HtmlHiLink mkdLinkTitle htmlString
+HtmlHiLink mkdDelimiter Delimiter
+
+let b:current_syntax = "mkd"
+
+delcommand HtmlHiLink
+" vim: ts=8
--- /dev/null
+You can run the tests using the Makefile from the top directory:
+
+ make test
+
+To run them manually please refer to the instructions/commands in the Makefile.
--- /dev/null
+" Tests atx and setext folding, and :Toc.
+
+Before:
+ source ../after/ftplugin/markdown.vim
+
+After:
+ setlocal foldexpr=0
+ setlocal foldmethod=manual
+
+Given markdown;
+# chap 1
+
+hello
+world
+
+```bash
+# some bash scripting
+pwd
+
+# this is another comment
+# other
+echo "foo"
+```
+
+## chap 1.1
+
+- dog
+- cat
+
+~~~~bash
+mkdir foo
+# comment in ~
+~~~~
+
+### chap 1.1.1
+
+- dragons
+- fenixs
+
+# chap 2
+
+another
+
+## chap 2.1
+
+- uk
+- japan
+- china
+
+
+# chap 3
+
+nothing here
+
+chap 4
+======
+
+setext are evil
+
+chap 4.1
+--------
+
+evil indeed
+
+````bash
+# get system info
+uname -a
+````
+
+Execute (fold level):
+ AssertEqual foldlevel(1), 0, '# chap 1'
+ AssertEqual foldlevel(3), 1, 'hello'
+ AssertEqual foldlevel(6), 1, '```bash'
+ AssertEqual foldlevel(7), 1, '# some bash scripting'
+ AssertEqual foldlevel(15), 1, '## chap 1.1'
+ AssertEqual foldlevel(21), 2, 'mkdir foo'
+ AssertEqual foldlevel(22), 2, 'comment in ~'
+ AssertEqual foldlevel(25), 2, '### chap 1.1.1'
+ AssertEqual foldlevel(27), 3, '- dragons'
+ AssertEqual foldlevel(30), 1, '# chap 2'
+ AssertEqual foldlevel(32), 1, 'another'
+ AssertEqual foldlevel(34), 1, '# chap 2.1'
+ AssertEqual foldlevel(37), 2, '- japan'
+ AssertEqual foldlevel(41), 1, '# chap 3'
+ AssertEqual foldlevel(45), 1, 'chap 4\n======'
+ AssertEqual foldlevel(48), 1, 'setext are evil'
+ AssertEqual foldlevel(50), 2, 'chap 4.1\n------'
+
+Execute (fold text result):
+ AssertEqual foldtextresult(2), '+-- 28 lines: hello'
+ AssertEqual foldtextresult(31), '+-- 10 lines: another'
+ AssertEqual foldtextresult(42), '+-- 3 lines: nothing here'
+ AssertEqual foldtextresult(45), '+-- 14 lines: chap 4'
+
+Execute (fold level with setting):
+ let g:vim_markdown_folding_level = 2
+ source ../after/ftplugin/markdown.vim
+ AssertEqual foldlevel(1), 0, '# chap 1'
+ AssertEqual foldlevel(3), 1, 'hello'
+ AssertEqual foldlevel(6), 1, '```bash'
+ AssertEqual foldlevel(7), 1, '# some bash scripting'
+ AssertEqual foldlevel(15), 0, '## chap 1.1'
+ AssertEqual foldlevel(21), 2, 'mkdir foo'
+ AssertEqual foldlevel(22), 2, 'comment in ~'
+ AssertEqual foldlevel(25), 2, '### chap 1.1.1'
+ AssertEqual foldlevel(27), 3, '- dragons'
+ AssertEqual foldlevel(30), 0, '# chap 2'
+ AssertEqual foldlevel(32), 1, 'another'
+ AssertEqual foldlevel(34), 0, '# chap 2.1'
+ AssertEqual foldlevel(37), 2, '- japan'
+ AssertEqual foldlevel(41), 0, '# chap 3'
+ AssertEqual foldlevel(45), 1, 'chap 4\n======'
+ AssertEqual foldlevel(48), 1, 'setext are evil'
+ AssertEqual foldlevel(50), 1, 'chap 4.1\n------'
+ let g:vim_markdown_folding_level = 0
+
+Execute (check TOC):
+ :Toc
+ :lclose
+ let res = getloclist(0)
+ let elem = res[0]
+ AssertEqual elem.lnum, 1
+ AssertEqual elem.text, '# chap 1'
+ let elem = res[1]
+ AssertEqual elem.lnum, 15
+ AssertEqual elem.text, '## chap 1.1'
+ let elem = res[2]
+ AssertEqual elem.lnum, 25
+ AssertEqual elem.text, '### chap 1.1.1'
+ let elem = res[3]
+ AssertEqual elem.lnum, 30
+ AssertEqual elem.text, '# chap 2'
+ let elem = res[4]
+ AssertEqual elem.lnum, 34
+ AssertEqual elem.text, '## chap 2.1'
+ let elem = res[5]
+ AssertEqual elem.lnum, 41
+ AssertEqual elem.text, '# chap 3'
+ let elem = res[6]
+ AssertEqual elem.lnum, 45
+ AssertEqual elem.text, 'chap 4'
+ let elem = res[7]
+ AssertEqual elem.lnum, 50
+ AssertEqual elem.text, 'chap 4.1'
+
+Given markdown;
+---
+layout: article
+title: A test of the heading folding when there is YAML frontmatter
+tags: markdown yaml vim-markdown
+---
+body
+
+heading
+-------
+
+Execute (fold level of yaml front matter):
+ let g:vim_markdown_frontmatter = 1
+ source ../after/ftplugin/markdown.vim
+ AssertEqual foldlevel(1), 0, '---'
+ AssertEqual foldlevel(2), 0, 'layout: article'
+ AssertEqual foldlevel(4), 0, 'tags: markdown yaml vim-markdown'
+ AssertEqual foldlevel(5), 0, '---'
+ AssertEqual foldlevel(6), 0, 'body'
+ AssertEqual foldlevel(8), 2, 'heading'
+ AssertEqual foldlevel(9), 2, '-------'
+ unlet g:vim_markdown_frontmatter
+
+Execute (check Toc of yaml front matter):
+ let g:vim_markdown_frontmatter = 1
+ :Toc
+ :lclose
+ let res = getloclist(0)
+ AssertEqual len(res), 1
+ let elem = res[0]
+ AssertEqual elem.lnum, 8
+ AssertEqual elem.text, 'heading'
+ unlet g:vim_markdown_frontmatter
--- /dev/null
+Before:
+ source ../after/ftplugin/markdown.vim
+
+After:
+ setlocal foldexpr=0
+ setlocal foldmethod=manual
+
+Given markdown;
+# Title
+
+## Chapter 1
+
+```
+This is code block
+# This is just a comment
+```
+
+## Capter 2
+
+foobar
+
+Execute (fold level # in code block):
+ AssertEqual foldlevel(1), 0, '# Title'
+ AssertEqual foldlevel(3), 1, '## Chapter 1'
+ AssertEqual foldlevel(7), 2, '# This is just a comment'
+ AssertEqual foldlevel(8), 2, '```'
+ AssertEqual foldlevel(10), 1, '## Chapter 2'
+ AssertEqual foldlevel(12), 2, 'foobar'
+
+Given markdown;
+Fold Level 1
+============
+Fold Level 2
+------------
+
+Execute (fold level ==, --):
+ AssertEqual foldlevel(2), 1, '=='
+ AssertEqual foldlevel(4), 2, '--'
+
+Given markdown;
+# H1
+
+## H1.1
+
+## H1.2
+
+# H2
+
+Execute (fold level # in last line):
+ AssertEqual foldlevel(1), 0, '# H1'
+ AssertEqual foldlevel(3), 1, '## H1.1'
+ AssertEqual foldlevel(5), 1, '## H1.2'
+ AssertEqual foldlevel(7), 0, '# H2'
--- /dev/null
+Before:
+ let g:vim_markdown_new_list_item_indent = 2
+
+After:
+ unlet g:vim_markdown_new_list_item_indent
+
+Given markdown;
+* item1
+
+Do (new line from the first item of the list and add the second item):
+ o* item2
+
+Expect (insert 2 spaces to the head of second item):
+ * item1
+ * item2
--- /dev/null
+1. Confirm indent with new line insert after list items
+
+'\' is not list item.
+\ foo
+
+If only space and three '*' or '-' character are in the line,
+this line means horizontal item.
+If current line is below horizontal item, it need not to indent.
+Following example is horizontal item.
+
+---
+***
+- - -
+* * *
+
+And list item must be specified space after [*-+].
+Following example is list item.
+
+* foo
+- bar
++ baz
+
+But following example is not list item.
+*foo
+-bar
++baz
--- /dev/null
+Given markdown;
+* item1
+
+Do (insert enter at list end):
+ A\<cr>item2
+
+Expect (auto insert * and indent level is same):
+ * item1
+ * item2
+
+Given markdown;
+
+Execute:
+ syntax off
+
+Do (insert enter at list end with syntax off):
+ i* item1\<cr>item2
+
+Expect (auto insert * and indent level is same):
+ * item1
+ * item2
+
+Execute:
+ syntax on
+
+Given markdown;
+```
+* item1
+
+Do (insert after list items in code block):
+ jotext
+
+Expect (no autoindent in code block):
+ ```
+ * item1
+ text
+
+Given markdown;
+* item1
+
+a
+
+Do (insert enter after list):
+ jji\<cr>b
+
+Expect (no autoindent outside list):
+ * item1
+
+
+ ba
+
+Given markdown;
+- a
+
+ # b
+
+Do (insert header after list):
+ jjwi#
+
+Expect (no indent header after list):
+ - a
+
+ ## b
+
+Given markdown;
+* item1
+
+Do (new line from the first item of the list and add the second item):
+ o* item2
+
+Expect (insert 4 spaces to the head of second item):
+ * item1
+ * item2
--- /dev/null
+Given markdown;
+a <http://b> c
+
+Execute (gx autolink):
+ let b:url = 'http://b'
+ let b:line = getline(1)
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
+ AssertEqual b:func(1, match(b:line, 'a') + 1), ''
+ AssertEqual b:func(1, match(b:line, '<') + 1), b:url
+ AssertEqual b:func(1, match(b:line, 'h') + 1), b:url
+ AssertEqual b:func(1, match(b:line, '>') + 1), b:url
+ AssertEqual b:func(1, match(b:line, 'c') + 1), ''
+
+Given markdown;
+a http://b.bb c
+
+Execute (gx implicit autolink):
+ let b:url = 'http://b.bb'
+ let b:line = getline(1)
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
+ AssertEqual b:func(1, match(b:line, 'a') + 1), ''
+ AssertEqual b:func(1, match(b:line, 'h') + 1), b:url
+ AssertEqual b:func(1, match(b:line, 'c') + 1), ''
+
+Given markdown;
+[a]: http://b "c"
+
+Execute (gx link reference definition):
+ let b:url = 'http://b'
+ let b:line = getline(1)
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
+ " TODO would be cool if all of the following gave the link.
+ AssertEqual b:func(1, match(b:line, 'a') + 1), ''
+ AssertEqual b:func(1, match(b:line, 'h') + 1), b:url
+ AssertEqual b:func(1, match(b:line, 'c') + 1), ''
+
+Given markdown;
+a [b](c) d
+
+Execute (gx autolink):
+ let b:url = 'c'
+ let b:line = getline(1)
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
+ AssertEqual b:func(1, match(b:line, 'a') + 1), ''
+ AssertEqual b:func(1, match(b:line, '[') + 1), b:url
+ AssertEqual b:func(1, match(b:line, 'b') + 1), b:url
+ AssertEqual b:func(1, match(b:line, ']') + 1), b:url
+ AssertEqual b:func(1, match(b:line, '(') + 1), b:url
+ AssertEqual b:func(1, match(b:line, 'c') + 1), b:url
+ AssertEqual b:func(1, match(b:line, ')') + 1), b:url
+ AssertEqual b:func(1, match(b:line, 'd') + 1), ''
+
+Given markdown;
+[ge_test.md](ge_test.md)
+
+Execute (ge opens file):
+ normal ge
+ AssertEqual @%, 'ge_test.md'
+ AssertEqual getline(1), 'ge test'
+
+Given markdown;
+[ge_test](ge_test)
+
+Execute (ge opens file without .md extensions):
+ let g:vim_markdown_no_extensions_in_markdown = 1
+ normal ge
+ AssertEqual @%, 'ge_test.md'
+ AssertEqual getline(1), 'ge test'
+ unlet g:vim_markdown_no_extensions_in_markdown
+
+Given markdown;
+[ge_test.md](ge_test.md)
+
+Execute (ge does not write before opening file):
+ normal ia
+ normal l
+ normal ge
+ AssertEqual @%, 'ge_test.md'
+ AssertEqual getline(1), 'ge test'
+
+Given markdown;
+[ge_test.md](ge_test.md)
+
+Execute (ge auto-write before opening file):
+ let g:vim_markdown_autowrite = 1
+ normal ia
+ normal l
+ AssertThrows normal ge
+ AssertEqual g:vader_exception, 'Vim(write):E382: Cannot write, ''buftype'' option is set'
+ unlet g:vim_markdown_autowrite
+
+Given markdown;
+# a
+
+b
+
+# c
+
+d
+
+Execute (]] same level):
+ AssertEqual line('.'), 1
+ normal ]]
+ AssertEqual line('.'), 5
+ normal [[
+ AssertEqual line('.'), 1
+
+Given markdown;
+# a
+
+b
+
+## c
+
+d
+
+Execute (]] different levels level):
+ AssertEqual line('.'), 1
+ normal ]]
+ AssertEqual line('.'), 5
+ normal [[
+ AssertEqual line('.'), 1
+
+Given markdown;
+# a
+
+b
+
+## c
+
+d
+
+# e
+
+f
+
+Execute (][ different levels level):
+ AssertEqual line('.'), 1
+ normal ][
+ AssertEqual line('.'), 9
+ normal []
+ AssertEqual line('.'), 1
+
+Given markdown;
+# a
+
+b
+
+Execute (]c):
+ normal! 3G
+ AssertEqual line('.'), 3
+ normal ]c
+ AssertEqual line('.'), 1
--- /dev/null
+Before:
+ let g:vim_markdown_folding_style_pythonic = 1
+ source ../after/ftplugin/markdown.vim
+
+After:
+ setlocal foldexpr=0
+ setlocal foldmethod=manual
+
+Given markdown;
+# Title
+
+## Chapter 1
+
+```
+This is code block
+# This is just a comment
+```
+
+## Chapter 2
+
+foobar
+
+Execute (fold level # in code block):
+ AssertEqual foldlevel(1), 1, '# Title'
+ AssertEqual foldlevel(3), 2, '## Chapter 1'
+ AssertEqual foldlevel(7), 2, '# This is just a comment'
+ AssertEqual foldlevel(8), 2, '```'
+ AssertEqual foldlevel(10), 2, '## Chapter 2'
+ AssertEqual foldlevel(12), 2, 'foobar'
+
+Execute (fold text of chapters):
+ let b:width = winwidth(0)
+ let b:hyphen = repeat('-', b:width - 18 > 2 ? b:width - 18 : b:width - 9 > 0 ? 3 : 2)
+ AssertEqual foldtextresult(10), strpart('## Chapter 2', 0, b:width - 9) . ' ' . b:hyphen . ' 2'
+
+Given markdown;
+Fold text 1
+===========
+Fold text 2
+-----------
+
+Execute (fold level ==, --):
+ AssertEqual foldlevel(2), 0, '=='
+ AssertEqual foldlevel(4), 1, '--'
+
+Execute (fold text of ==, --):
+ let b:width = winwidth(0)
+ let b:hyphen = repeat('-', b:width - 17 > 2 ? b:width - 17 : b:width - 9 > 0 ? 3 : 2)
+ AssertEqual foldtextresult(3), strpart('Fold text 2', 0, b:width - 9) . ' ' . b:hyphen . ' 1'
+
+Given markdown;
+Headline
+
+foobar
+
+# Title
+
+Execute (fold any preamble):
+ AssertEqual foldlevel(1), 1, 'Headline'
+ AssertEqual foldlevel(3), 1, 'foobar'
+ AssertEqual foldlevel(5), 1, '# Title'
+
+Given markdown;
+---
+layout: article
+title: A test of the heading folding when there is YAML frontmatter
+tags: markdown yaml vim-markdown
+---
+body
+
+heading
+-------
+
+Execute (fold level of yaml front matter):
+ let g:vim_markdown_frontmatter = 1
+ source ../after/ftplugin/markdown.vim
+ AssertEqual foldlevel(1), 1, '---'
+ AssertEqual foldlevel(2), 1, 'layout: article'
+ AssertEqual foldlevel(4), 1, 'tags: markdown yaml vim-markdown'
+ AssertEqual foldlevel(5), 1, '---'
+ AssertEqual foldlevel(6), 1, 'body'
+ AssertEqual foldlevel(8), 1, 'heading'
+ AssertEqual foldlevel(9), 1, '-------'
+ unlet g:vim_markdown_frontmatter
--- /dev/null
+#!/usr/bin/env bash
+
+# Exit on error.
+set -e
+
+cd "$( dirname "${BASH_SOURCE[0]}" )"
+
+for dep in ../build/tabular ../build/vim-toml ../build/vim-json ../build/vader.vim; do
+ if [[ ! -d $dep ]]; then
+ echo "Missing dependency: $dep"
+ echo "You may just want to use 'make test'."
+ exit 1
+ fi
+done
+
+vim -Nu vimrc -c 'Vader! *' > /dev/null
--- /dev/null
+Before:
+ let g:vim_markdown_emphasis_multiline = 0
+ syn off | syn on
+
+After:
+ let g:vim_markdown_emphasis_multiline = 1
+ syn off | syn on
+
+Given markdown;
+a **b** c
+
+Execute (bold):
+ AssertNotEqual SyntaxOf('a'), 'htmlBold'
+ AssertEqual SyntaxOf('b'), 'htmlBold'
+ AssertNotEqual SyntaxOf('c'), 'htmlBold'
+
+Given markdown;
+a __b__ c
+
+Execute (bold):
+ AssertNotEqual SyntaxOf('a'), 'htmlBold'
+ AssertEqual SyntaxOf('b'), 'htmlBold'
+ AssertNotEqual SyntaxOf('c'), 'htmlBold'
+
+Given markdown;
+a *b* c
+
+Execute (italic):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertEqual SyntaxOf('b'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('c'), 'htmlItalic'
+
+Given markdown;
+a _b_ c
+
+Execute (italic):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertEqual SyntaxOf('b'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('c'), 'htmlItalic'
+
+Given markdown;
+_a_b_
+
+Execute (italic text has underscores):
+ AssertEqual SyntaxOf('a'), 'htmlItalic'
+ AssertEqual SyntaxOf('b'), 'htmlItalic'
+
+Given markdown;
+a \*b\* c
+
+Execute (not italic with escaped asterisks):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('b'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('c'), 'htmlItalic'
+
+Given markdown;
+a \_b\_ c
+
+Execute (not italic with escaped underscores):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('b'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('c'), 'htmlItalic'
+
+Given markdown;
+a _b\_c_ d
+
+Execute (italic with escaped underscores):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertEqual SyntaxOf('b'), 'htmlItalic'
+ AssertEqual SyntaxOf('c'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('d'), 'htmlItalic'
+
+Given markdown;
+a_b_c
+
+Execute (not italic underscores within text):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('b'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('c'), 'htmlItalic'
+
+Given markdown;
+a *b\*c* d
+
+Execute (italic with escaped asterisks):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertEqual SyntaxOf('b'), 'htmlItalic'
+ AssertEqual SyntaxOf('c'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('d'), 'htmlItalic'
+
+Given markdown;
+a __b\_\_c__ d
+
+Execute (bold with escaped underscores):
+ AssertNotEqual SyntaxOf('a'), 'htmlBold'
+ AssertEqual SyntaxOf('b'), 'htmlBold'
+ AssertEqual SyntaxOf('c'), 'htmlBold'
+ AssertNotEqual SyntaxOf('d'), 'htmlBold'
+
+Given markdown;
+_a b
+c_ d
+
+Execute (italic with underscores in multiple lines):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('b'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('c'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('d'), 'htmlItalic'
+
+Given markdown;
+__a b
+c__ d
+
+Execute (bold with underscores in multiple lines):
+ AssertNotEqual SyntaxOf('a'), 'htmlBold'
+ AssertNotEqual SyntaxOf('b'), 'htmlBold'
+ AssertNotEqual SyntaxOf('c'), 'htmlBold'
+ AssertNotEqual SyntaxOf('d'), 'htmlBold'
+
+Given markdown;
+___a b
+c___ d
+
+Execute (bold italic with underscores in multiple lines):
+ AssertNotEqual SyntaxOf('a'), 'htmlBoldItalic'
+ AssertNotEqual SyntaxOf('b'), 'htmlBoldItalic'
+ AssertNotEqual SyntaxOf('c'), 'htmlBoldItalic'
+ AssertNotEqual SyntaxOf('d'), 'htmlBoldItalic'
+
+Given markdown;
+*a b
+c* d
+
+Execute (italic with asterisks in multiple lines):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('b'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('c'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('d'), 'htmlItalic'
+
+Given markdown;
+**a b
+c** d
+
+Execute (bold with asterisks in multiple lines):
+ AssertNotEqual SyntaxOf('a'), 'htmlBold'
+ AssertNotEqual SyntaxOf('b'), 'htmlBold'
+ AssertNotEqual SyntaxOf('c'), 'htmlBold'
+ AssertNotEqual SyntaxOf('d'), 'htmlBold'
+
+Given markdown;
+***a b
+c*** d
+
+Execute (bold italic with asterisks in multiple lines):
+ AssertNotEqual SyntaxOf('a'), 'htmlBoldItalic'
+ AssertNotEqual SyntaxOf('b'), 'htmlBoldItalic'
+ AssertNotEqual SyntaxOf('c'), 'htmlBoldItalic'
+ AssertNotEqual SyntaxOf('d'), 'htmlBoldItalic'
+
--- /dev/null
+# Fenced code living in an indented environment is correctly highlighted
+
+1. run this command to do this:
+
+ ```
+some command
+ ```
+
+2. Subsequent list items are correctly highlighted.
+
+Fenced code block with language:
+
+```ruby
+def f
+ 0
+end
+```
+
+# Links
+
+[a](b "c")
+
+[a]()
+
+[good spell](a)
+
+[badd spell](a)
+
+[a](b "c")
+
+[a]( b
+"c" )
+
+a (`a`) b. Fix: <https://github.com/plasticboy/vim-markdown/issues/113>
+
+Escaped:
+
+\[a](b)
+
+[a\]b](c)
+
+## Known failures
+
+Escape does not work:
+
+[a\](b)
+
+Should not be links because of whitespace:
+
+[a] (b)
+
+[a](a
+b)
+
+[a](a b)
+
+# Reference links
+
+Single links:
+
+[a][b]
+
+[good spell][a]
+
+[badd spell][a]
+
+[a][]
+
+[a] []
+
+[a][b] c [d][e]
+
+Reference link followed by inline link:
+
+[a] [b](c)
+
+## Known failures
+
+Should be shortcut reference links:
+
+[a]
+
+[a] b [c]
+
+Should be a single link:
+
+[a] [b]
+
+[a] b [c](d)
--- /dev/null
+Before:
+ unlet! b:mkd_known_filetypes
+ unlet! b:mkd_included_filetypes
+ unlet! g:vim_markdown_math
+
+Given markdown;
+a **b** c
+
+Execute (bold):
+ AssertNotEqual SyntaxOf('a'), 'htmlBold'
+ AssertEqual SyntaxOf('b'), 'htmlBold'
+ AssertNotEqual SyntaxOf('c'), 'htmlBold'
+
+Given markdown;
+a __b__ c
+
+Execute (bold):
+ AssertNotEqual SyntaxOf('a'), 'htmlBold'
+ AssertEqual SyntaxOf('b'), 'htmlBold'
+ AssertNotEqual SyntaxOf('c'), 'htmlBold'
+
+Given markdown;
+a *b* c
+
+Execute (italic):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertEqual SyntaxOf('b'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('c'), 'htmlItalic'
+
+Given markdown;
+a _b_ c
+
+Execute (italic):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertEqual SyntaxOf('b'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('c'), 'htmlItalic'
+
+Given markdown;
+_a_b_
+
+Execute (italic text has underscores):
+ AssertEqual SyntaxOf('a'), 'htmlItalic'
+ AssertEqual SyntaxOf('b'), 'htmlItalic'
+
+Given markdown;
+a \*b\* c
+
+Execute (not italic with escaped asterisks):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('b'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('c'), 'htmlItalic'
+
+Given markdown;
+a \_b\_ c
+
+Execute (not italic with escaped underscores):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('b'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('c'), 'htmlItalic'
+
+Given markdown;
+a _b\_c_ d
+
+Execute (italic with escaped underscores):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertEqual SyntaxOf('b'), 'htmlItalic'
+ AssertEqual SyntaxOf('c'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('d'), 'htmlItalic'
+
+Given markdown;
+a_b_c
+
+Execute (not italic underscores within text):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('b'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('c'), 'htmlItalic'
+
+Given markdown;
+a *b\*c* d
+
+Execute (italic with escaped asterisks):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+ AssertEqual SyntaxOf('b'), 'htmlItalic'
+ AssertEqual SyntaxOf('c'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('d'), 'htmlItalic'
+
+Given markdown;
+a __b\_\_c__ d
+
+Execute (bold with escaped underscores):
+ AssertNotEqual SyntaxOf('a'), 'htmlBold'
+ AssertEqual SyntaxOf('b'), 'htmlBold'
+ AssertEqual SyntaxOf('c'), 'htmlBold'
+ AssertNotEqual SyntaxOf('d'), 'htmlBold'
+
+Given markdown;
+_a b
+c_ d
+
+Execute (italic with underscores in multiple lines):
+ AssertEqual SyntaxOf('a'), 'htmlItalic'
+ AssertEqual SyntaxOf('b'), 'htmlItalic'
+ AssertEqual SyntaxOf('c'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('d'), 'htmlItalic'
+
+Given markdown;
+__a b
+c__ d
+
+Execute (bold with underscores in multiple lines):
+ AssertEqual SyntaxOf('a'), 'htmlBold'
+ AssertEqual SyntaxOf('b'), 'htmlBold'
+ AssertEqual SyntaxOf('c'), 'htmlBold'
+ AssertNotEqual SyntaxOf('d'), 'htmlBold'
+
+Given markdown;
+___a b
+c___ d
+
+Execute (bold italic with underscores in multiple lines):
+ AssertEqual SyntaxOf('a'), 'htmlBoldItalic'
+ AssertEqual SyntaxOf('b'), 'htmlBoldItalic'
+ AssertEqual SyntaxOf('c'), 'htmlBoldItalic'
+ AssertNotEqual SyntaxOf('d'), 'htmlBoldItalic'
+
+Given markdown;
+*a b
+c* d
+
+Execute (italic with asterisks in multiple lines):
+ AssertEqual SyntaxOf('a'), 'htmlItalic'
+ AssertEqual SyntaxOf('b'), 'htmlItalic'
+ AssertEqual SyntaxOf('c'), 'htmlItalic'
+ AssertNotEqual SyntaxOf('d'), 'htmlItalic'
+
+Given markdown;
+**a b
+c** d
+
+Execute (bold with asterisks in multiple lines):
+ AssertEqual SyntaxOf('a'), 'htmlBold'
+ AssertEqual SyntaxOf('b'), 'htmlBold'
+ AssertEqual SyntaxOf('c'), 'htmlBold'
+ AssertNotEqual SyntaxOf('d'), 'htmlBold'
+
+Given markdown;
+***a b
+c*** d
+
+Execute (bold italic with asterisks in multiple lines):
+ AssertEqual SyntaxOf('a'), 'htmlBoldItalic'
+ AssertEqual SyntaxOf('b'), 'htmlBoldItalic'
+ AssertEqual SyntaxOf('c'), 'htmlBoldItalic'
+ AssertNotEqual SyntaxOf('d'), 'htmlBoldItalic'
+
+Given markdown;
+*a
+
+Execute (not italic with an asterisk):
+ AssertNotEqual SyntaxOf('a'), 'htmlItalic'
+
+Given markdown;
+[__](a) b
+
+Execute (not bold with double underscores):
+ AssertNotEqual SyntaxOf('_'), 'htmlBold'
+ AssertNotEqual SyntaxOf('a'), 'htmlBold'
+ AssertNotEqual SyntaxOf('b'), 'htmlBold'
+
+Given markdown;
+_a_
+
+Execute (conceal italic):
+ if has('conceal')
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 1
+ setlocal conceallevel=0
+ endif
+
+Execute (disable conceal):
+ if has('conceal')
+ let g:vim_markdown_conceal=0
+ syn off | syn on
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 0
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 0
+
+ let g:vim_markdown_conceal=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 1
+
+ setlocal conceallevel=0
+ unlet g:vim_markdown_conceal
+ syn off | syn on
+ endif
+
+Given markdown;
+*a*
+
+Execute (conceal italic):
+ if has('conceal')
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 1
+ setlocal conceallevel=0
+ endif
+
+Execute (disable conceal):
+ if has('conceal')
+ let g:vim_markdown_conceal=0
+ syn off | syn on
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 0
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 0
+
+ let g:vim_markdown_conceal=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 1
+
+ setlocal conceallevel=0
+ unlet g:vim_markdown_conceal
+ syn off | syn on
+ endif
+
+Given markdown;
+__a__
+
+Execute (conceal bold):
+ if has('conceal')
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 1
+ AssertEqual synconcealed(1, 5)[0], 1
+ setlocal conceallevel=0
+ endif
+
+Execute (disable conceal):
+ if has('conceal')
+ let g:vim_markdown_conceal=0
+ syn off | syn on
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 0
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 0
+
+ let g:vim_markdown_conceal=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 1
+ AssertEqual synconcealed(1, 5)[0], 1
+
+ setlocal conceallevel=0
+ unlet g:vim_markdown_conceal
+ syn off | syn on
+ endif
+
+Given markdown;
+**a**
+
+Execute (conceal bold):
+ if has('conceal')
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 1
+ AssertEqual synconcealed(1, 5)[0], 1
+ setlocal conceallevel=0
+ endif
+
+Execute (disable conceal):
+ if has('conceal')
+ let g:vim_markdown_conceal=0
+ syn off | syn on
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 0
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 0
+
+ let g:vim_markdown_conceal=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 1
+ AssertEqual synconcealed(1, 5)[0], 1
+
+ setlocal conceallevel=0
+ unlet g:vim_markdown_conceal
+ syn off | syn on
+ endif
+
+Given markdown;
+___a___
+
+Execute (conceal italic bold):
+ if has('conceal')
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 1
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 1
+ AssertEqual synconcealed(1, 6)[0], 1
+ AssertEqual synconcealed(1, 7)[0], 1
+ setlocal conceallevel=0
+ endif
+
+Execute (disable conceal):
+ if has('conceal')
+ let g:vim_markdown_conceal=0
+ syn off | syn on
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 0
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 0
+ AssertEqual synconcealed(1, 6)[0], 0
+ AssertEqual synconcealed(1, 7)[0], 0
+
+ let g:vim_markdown_conceal=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 1
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 1
+ AssertEqual synconcealed(1, 6)[0], 1
+ AssertEqual synconcealed(1, 7)[0], 1
+
+ setlocal conceallevel=0
+ unlet g:vim_markdown_conceal
+ syn off | syn on
+ endif
+
+Given markdown;
+***a***
+
+Execute (conceal italic bold):
+ if has('conceal')
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 1
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 1
+ AssertEqual synconcealed(1, 6)[0], 1
+ AssertEqual synconcealed(1, 7)[0], 1
+ setlocal conceallevel=0
+ endif
+
+Execute (disable conceal):
+ if has('conceal')
+ let g:vim_markdown_conceal=0
+ syn off | syn on
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 0
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 0
+ AssertEqual synconcealed(1, 6)[0], 0
+ AssertEqual synconcealed(1, 7)[0], 0
+
+ let g:vim_markdown_conceal=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 1
+ AssertEqual synconcealed(1, 3)[0], 1
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 1
+ AssertEqual synconcealed(1, 6)[0], 1
+ AssertEqual synconcealed(1, 7)[0], 1
+
+ setlocal conceallevel=0
+ unlet g:vim_markdown_conceal
+ syn off | syn on
+ endif
+
+# Links
+
+Given markdown;
+[a](b)
+
+Execute (link with title):
+ AssertEqual SyntaxOf('a'), 'mkdLink'
+ AssertEqual SyntaxOf('b'), 'mkdURL'
+
+Given markdown;
+[a
+b](c)
+
+Execute (link text with newline):
+ AssertEqual SyntaxOf('a'), 'mkdLink'
+ AssertEqual SyntaxOf('b'), 'mkdLink'
+ AssertEqual SyntaxOf('c'), 'mkdURL'
+
+Given markdown;
+[a] b [c](d)
+
+Execute (link text with bracket sections):
+ AssertNotEqual SyntaxOf('a'), 'mkdLink'
+ AssertNotEqual SyntaxOf('b'), 'mkdLink'
+ AssertEqual SyntaxOf('c'), 'mkdLink'
+ AssertEqual SyntaxOf('d'), 'mkdURL'
+
+Given markdown;
+[^a]: b
+
+Execute (footnote is not link):
+ AssertNotEqual SyntaxOf('a'), 'mkdLinkDef'
+
+Given markdown;
+(a)
+
+(b)
+
+Execute (parenthesis not in link):
+ AssertNotEqual SyntaxOf('a'), 'mkdURL'
+ AssertNotEqual SyntaxOf('b'), 'mkdURL'
+
+Given markdown;
+[a](b) c [d](e)
+
+Execute (multiple links on a line):
+ AssertNotEqual SyntaxOf('c'), 'mkdLink'
+ AssertNotEqual SyntaxOf('c'), 'mkdURL'
+
+Given markdown;
+[a] (b)
+
+Execute (space is not allowed between link text and parenthesis):
+ AssertNotEqual SyntaxOf('a'), 'mkdLink'
+ AssertNotEqual SyntaxOf('b'), 'mkdURL'
+
+Given markdown;
+[a](b)
+
+Execute (conceal link):
+ if has('conceal')
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 1
+ AssertEqual synconcealed(1, 4)[0], 1
+ AssertEqual synconcealed(1, 4)[0], 1
+ AssertEqual synconcealed(1, 5)[0], 1
+ AssertEqual synconcealed(1, 6)[0], 1
+ setlocal conceallevel=0
+ endif
+
+Execute (disable conceal):
+ if has('conceal')
+ let g:vim_markdown_conceal=0
+ syn off | syn on
+ setlocal conceallevel=2
+ AssertEqual synconcealed(1, 1)[0], 0
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 0
+ AssertEqual synconcealed(1, 6)[0], 0
+
+ let g:vim_markdown_conceal=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 1
+ AssertEqual synconcealed(1, 4)[0], 1
+ AssertEqual synconcealed(1, 4)[0], 1
+ AssertEqual synconcealed(1, 5)[0], 1
+ AssertEqual synconcealed(1, 6)[0], 1
+
+ setlocal conceallevel=0
+ unlet g:vim_markdown_conceal
+ syn off | syn on
+ endif
+
+# Autolinks
+
+Given markdown;
+a <http://b> c
+
+Execute (autolink):
+ AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('<'), 'mkdDelimiter'
+ AssertEqual SyntaxOf('b'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('>'), 'mkdDelimiter'
+ AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
+
+Given markdown;
+http://12monkeys.foo
+
+Execute (autolink with domain starting with a number):
+ AssertEqual SyntaxOf('12monkeys'), 'mkdInlineURL'
+
+Given markdown;
+<HtTp://a>
+
+Execute (autolink with scheme case is insensitive):
+ AssertEqual SyntaxOf('a'), 'mkdInlineURL'
+
+Given markdown;
+<a>
+
+Execute (autolink without scheme is not a link):
+ AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
+
+Given markdown;
+< http://a >
+<http://b c>
+<http://d
+e>
+
+Execute (autolink with space is not a link):
+ AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
+ AssertNotEqual SyntaxOf('b'), 'mkdInlineURL'
+ AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
+ AssertNotEqual SyntaxOf('d'), 'mkdInlineURL'
+ AssertNotEqual SyntaxOf('e'), 'mkdInlineURL'
+
+Given markdown;
+\<http://a>
+
+Execute (autolinks can be backslash escaped):
+ AssertNotEqual SyntaxOf('<'), 'mkdDelimiter'
+
+Given markdown;
+a (http://b.bb) c
+
+Execute (autolink in parenthesis):
+ AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('('), 'mkdDelimiter'
+ AssertEqual SyntaxOf('b'), 'mkdInlineURL'
+ AssertEqual SyntaxOf(')'), 'mkdDelimiter'
+ AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
+
+Given markdown;
+[![a](http://b)](http://c)
+
+Execute (autolink in link text):
+ AssertEqual SyntaxOf('!'), 'mkdDelimiter'
+ AssertEqual SyntaxOf('a'), 'mkdLink'
+ AssertEqual SyntaxOf('b'), 'mkdURL'
+ AssertEqual SyntaxOf('c'), 'mkdURL'
+
+Given markdown;
+# [h1link](url)
+
+## [h2link](url)
+
+### [h3link](url)
+
+#### [h4link](url)
+
+##### [h5link](url)
+
+###### [h6link](url)
+
+[h1link_b](url)
+===============
+
+[h2link_b](url)
+---------------
+
+Execute (link in headers):
+ AssertEqual SyntaxOf('h1link'), 'mkdLink'
+ AssertEqual SyntaxOf('h2link'), 'mkdLink'
+ AssertEqual SyntaxOf('h3link'), 'mkdLink'
+ AssertEqual SyntaxOf('h4link'), 'mkdLink'
+ AssertEqual SyntaxOf('h5link'), 'mkdLink'
+ AssertEqual SyntaxOf('h6link'), 'mkdLink'
+ AssertEqual SyntaxOf('h1link_b'), 'mkdLink'
+ AssertEqual SyntaxOf('h2link_b'), 'mkdLink'
+
+Given markdown;
+# http://h1link.foo
+
+## http://h2link.foo
+
+### http://h3link.foo
+
+#### http://h4link.foo
+
+##### http://h5link.foo
+
+###### http://h6link.foo
+
+http://h1link_b.foo
+===================
+
+http://h2link_b.foo
+-------------------
+
+Execute (inline url in headers):
+ AssertEqual SyntaxOf('h1link'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('h2link'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('h3link'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('h4link'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('h5link'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('h6link'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('h1link_b'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('h2link_b'), 'mkdInlineURL'
+
+Given markdown;
+> [a](b)
+> http://foo.bar
+
+Execute (link in blockquote):
+ AssertEqual SyntaxOf('a'), 'mkdLink'
+ AssertEqual SyntaxOf('foo'), 'mkdInlineURL'
+
+Given markdown;
+[https://domain.tld](https://domain.com) not_a_link
+
+Execute (link with url title):
+ AssertEqual SyntaxOf('https://domain.tld'), 'mkdInlineURL'
+ AssertEqual SyntaxOf('https://domain.com'), 'mkdInlineURL'
+ AssertNotEqual SyntaxOf('not_a_link'), 'mkdInlineURL'
+
+# Code Blocks
+
+Given markdown;
+~~~
+code
+~~~
+
+Execute (code blocks can be fenced with tildes):
+ AssertEqual SyntaxOf('c'), 'mkdCode'
+
+Given markdown;
+~~~~
+code
+~~~~~
+
+Execute (code blocks can be fenced with tildes longer than 3):
+ AssertEqual SyntaxOf('c'), 'mkdCode'
+
+Given markdown;
+````
+code
+`````
+
+Execute (code blocks can be fenced with backticks longer than 3):
+ AssertEqual SyntaxOf('c'), 'mkdCode'
+
+Given markdown;
+~~~ruby
+code
+~~~
+
+Execute (code blocks can have a language specifier):
+ AssertEqual SyntaxOf('c'), 'mkdCode'
+
+Given markdown;
+```c++
+code
+```
+
+text
+
+Execute (code blocks can be fenced with backticks and a language specifier):
+ AssertEqual SyntaxOf('code'), 'mkdCode'
+ AssertNotEqual SyntaxOf('text'), 'mkdCode'
+
+# Indent Code Blocks
+
+Given markdown;
+a
+
+ b
+ c
+
+Execute (indent code blocks):
+ AssertNotEqual SyntaxOf('a'), 'mkdCode'
+ AssertEqual SyntaxOf('b'), 'mkdCode'
+ AssertEqual SyntaxOf('c'), 'mkdCode'
+
+Given markdown;
+# a
+
+b
+
+ c
+
+Execute (indent code blocks after header):
+ AssertNotEqual SyntaxOf('a'), 'mkdCode'
+ AssertNotEqual SyntaxOf('b'), 'mkdCode'
+ AssertEqual SyntaxOf('c'), 'mkdCode'
+
+Given markdown;
+- a
+
+ b
+
+ c
+
+Execute (indent code blocks after list):
+ AssertNotEqual SyntaxOf('a'), 'mkdCode'
+ AssertNotEqual SyntaxOf('b'), 'mkdCode'
+ AssertEqual SyntaxOf('c'), 'mkdCode'
+
+Given markdown;
+ a
+ b
+
+Execute (indent code block at beginning of file):
+ AssertEqual SyntaxOf('a'), 'mkdCode'
+ AssertEqual SyntaxOf('b'), 'mkdCode'
+
+Given markdown;
+```c++
+#include <iostream>
+code
+```
+
+```ruby
+def a
+end
+```
+
+Execute (fenced code block syntax with a language specifier):
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
+ call b:func(0)
+ AssertEqual SyntaxOf('include'), 'cInclude'
+ AssertEqual SyntaxOf('code'), 'mkdSnippetCPP'
+ AssertEqual SyntaxOf('def'), 'rubyDefine'
+
+Given markdown;
+``` c++
+#include <iostream>
+code
+```
+
+``` vim
+let g:a = 1
+```
+
+``` ruby
+def a
+end
+```
+
+```
+ruby
+class B
+end
+```
+
+Execute (fenced code block syntax with a language specifier after whitespace):
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
+ call b:func(0)
+ AssertEqual SyntaxOf('include'), 'cInclude'
+ AssertEqual SyntaxOf('code'), 'mkdSnippetCPP'
+ AssertEqual SyntaxOf('g:a'), 'vimVar'
+ AssertEqual SyntaxOf('def'), 'rubyDefine'
+ AssertNotEqual SyntaxOf('class'), 'rubyClass'
+
+Given markdown;
+```vim
+let g:a = 1
+```
+
+```viml
+let g:b = 1
+```
+
+Execute (fenced code block syntax with alias language specifier):
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
+ call b:func(0)
+ AssertEqual SyntaxOf('g:a'), 'vimVar'
+ AssertEqual SyntaxOf('g:b'), 'vimVar'
+
+Given markdown;
+```csharp
+var s = "foo";
+```
+
+Execute (fenced code block languages setting):
+ let g:vim_markdown_fenced_languages = ['csharp=cs']
+ source ../ftplugin/markdown.vim
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
+ call b:func(0)
+ AssertEqual SyntaxOf('foo'), 'csString'
+ unlet g:vim_markdown_fenced_languages
+
+Given markdown;
+```vim
+let g:a = 1
+```
+
+Execute (fenced code block includes language syntax with reopening same buffer):
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
+ call b:func(0)
+ split
+ quit
+ edit
+ set filetype=markdown
+ execute "normal! i```vim\<cr>let g:a = 1\<cr>```"
+ call b:func(1)
+ AssertEqual SyntaxOf('g:a'), 'vimVar'
+
+Given markdown;
+```a+b-
+code
+```
+
+Execute (fenced code block syntax with an unknown language specifier):
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
+ call b:func(0)
+ AssertEqual SyntaxOf('code'), 'mkdSnippetA_B_'
+
+Given markdown;
+```
+=
+a
+-
+```
+
+Execute (first = or - in fenced code block is not setex headers):
+ AssertEqual SyntaxOf('='), 'mkdCode'
+ AssertEqual SyntaxOf('-'), 'mkdCode'
+
+Given markdown;
+``` {style=""}
+a
+```
+
+Execute (fenced code block with extended info strings):
+ AssertEqual SyntaxOf('a'), 'mkdCode'
+
+# Code Blocks in pre and code tag
+
+Given markdown;
+<pre>
+a
+</pre>
+
+Execute (code block in pre tag):
+ AssertEqual SyntaxOf('a'), 'mkdCode'
+
+Given markdown;
+<code>
+a
+</code>
+
+Execute (code block in code tag):
+ AssertEqual SyntaxOf('a'), 'mkdCode'
+
+Given markdown;
+\<pre\>
+a
+\</pre\>
+
+Execute (not code block in escaped pre tag):
+ AssertNotEqual SyntaxOf('a'), 'mkdCode'
+
+Given markdown;
+\<code\>
+a
+\</code\>
+
+Execute (not code block in escaped code tag):
+ AssertNotEqual SyntaxOf('a'), 'mkdCode'
+
+# Code quotes
+
+Given markdown;
+`a`
+
+Execute (code in code quotes):
+ AssertEqual SyntaxOf('a'), 'mkdCode'
+
+Given markdown;
+`a\` b `c\` d
+
+Execute (code quotes not escaped ending with backslash):
+ AssertEqual SyntaxOf('a\'), 'mkdCode'
+ AssertNotEqual SyntaxOf('b'), 'mkdCode'
+ AssertEqual SyntaxOf('c\'), 'mkdCode'
+ AssertNotEqual SyntaxOf('d'), 'mkdCode'
+
+Given markdown;
+``a\`` b ``c`\`1`` d
+
+Execute (double code quotes not escaped ending with backslash):
+ AssertEqual SyntaxOf('a\'), 'mkdCode'
+ AssertNotEqual SyntaxOf('b'), 'mkdCode'
+ AssertEqual SyntaxOf('c`\\`1'), 'mkdCode'
+ AssertNotEqual SyntaxOf('d'), 'mkdCode'
+
+# Math
+
+Given markdown;
+a $x$ b
+c $$y$$ d
+\$e\$
+\$\$f\$\$
+
+Execute (math):
+ AssertNotEqual SyntaxOf('x')[0:2], 'tex'
+ AssertNotEqual SyntaxOf('y')[0:2], 'tex'
+ let g:vim_markdown_math=1
+ syn off | syn on
+ AssertNotEqual SyntaxOf('a')[0:2], 'tex'
+ AssertNotEqual SyntaxOf('b')[0:2], 'tex'
+ AssertNotEqual SyntaxOf('c')[0:2], 'tex'
+ AssertNotEqual SyntaxOf('d')[0:2], 'tex'
+ AssertNotEqual SyntaxOf('e')[0:2], 'tex'
+ AssertNotEqual SyntaxOf('f')[0:2], 'tex'
+ AssertEqual SyntaxOf('x')[0:2], 'tex'
+ AssertEqual SyntaxOf('y')[0:2], 'tex'
+ let g:vim_markdown_math=0
+ syn off | syn on
+ AssertNotEqual SyntaxOf('x')[0:2], 'tex'
+ AssertNotEqual SyntaxOf('y')[0:2], 'tex'
+
+Given markdown;
+a
+
+$
+b
+$
+
+c
+
+Execute (multiline math):
+ let g:vim_markdown_math=1
+ syn off | syn on
+ AssertNotEqual SyntaxOf('a')[0:2], 'tex'
+ AssertEqual SyntaxOf('b')[0:2], 'tex'
+ AssertNotEqual SyntaxOf('c')[0:2], 'tex'
+
+Given markdown;
+$ \sqrt{a}{b} $
+$$ \frac{a}{b} $$
+
+Execute (math tex highlighting):
+ let g:vim_markdown_math=0
+ syn off | syn on
+ AssertNotEqual SyntaxOf('sqrt'), 'texStatement'
+ AssertNotEqual SyntaxOf('frac'), 'texStatement'
+ let g:vim_markdown_math=1
+ syn off | syn on
+ AssertEqual SyntaxOf('sqrt'), 'texStatement'
+ AssertEqual SyntaxOf('frac'), 'texStatement'
+
+Given markdown;
+$a b[$ c
+
+Execute (math ends with $):
+ let g:vim_markdown_math=1
+ syn off | syn on
+ AssertEqual SyntaxOf('a')[0:2], 'tex'
+ AssertEqual SyntaxOf('b')[0:2], 'tex'
+ AssertNotEqual SyntaxOf('c')[0:2], 'tex'
+
+Given markdown;
+$$a b[$$ c
+
+Execute (math ends with $$):
+ let g:vim_markdown_math=1
+ syn off | syn on
+ AssertEqual SyntaxOf('a')[0:2], 'tex'
+ AssertEqual SyntaxOf('b')[0:2], 'tex'
+ AssertNotEqual SyntaxOf('c')[0:2], 'tex'
+
+Given markdown;
+$(0 \le 1)$
+
+Execute (math conceal in $):
+ if has('conceal')
+ setlocal conceallevel=2
+ let g:vim_markdown_math=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1, '$'
+ AssertEqual synconcealed(1, 2)[0], 0
+ AssertEqual synconcealed(1, 3)[0], 0
+ AssertEqual synconcealed(1, 4)[0], 0
+ AssertEqual synconcealed(1, 5)[0], 1, '\le'
+ AssertEqual synconcealed(1, 6)[0], 1
+ AssertEqual synconcealed(1, 7)[0], 1
+ AssertEqual synconcealed(1, 8)[0], 0
+ AssertEqual synconcealed(1, 9)[0], 0
+ AssertEqual synconcealed(1, 10)[0], 0
+ AssertEqual synconcealed(1, 11)[0], 1, '$'
+ setlocal conceallevel=0
+ endif
+
+Given markdown;
+$$
+\omega
+0 \le 1
+$$
+
+Execute (math conceal in $$):
+ if has('conceal')
+ setlocal conceallevel=2
+ let g:vim_markdown_math=1
+ syn off | syn on
+ AssertEqual synconcealed(1, 1)[0], 1, '$$'
+ AssertEqual synconcealed(2, 1)[0], 1, '\omega'
+ AssertEqual synconcealed(3, 1)[0], 0, '0'
+ AssertEqual synconcealed(3, 3)[0], 1, '\le'
+ AssertEqual synconcealed(3, 7)[0], 0, '1'
+ AssertEqual synconcealed(4, 1)[0], 1, '$$'
+ setlocal conceallevel=0
+ endif
+
+# YAML frontmatter
+
+Given markdown;
+---
+a: b
+---
+
+Execute (YAML frontmatter is controlled by the option):
+ AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
+ let g:vim_markdown_frontmatter=1
+ syn off | syn on
+ AssertEqual SyntaxOf('a')[0:3], 'yaml'
+ let g:vim_markdown_frontmatter=0
+ syn off | syn on
+ AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
+
+Given markdown;
+
+---
+a: b
+---
+
+Execute (YAML frontmatter only works if it's the first thing in the file):
+ let g:vim_markdown_frontmatter=1
+ syn off | syn on
+ AssertNotEqual SyntaxOf('a')[0:3], 'yaml'
+
+Given markdown;
+---
+a: b
+---
+
+---
+
+Execute (rules are not mistaken by YAML frontmatter delimiters):
+ let g:vim_markdown_frontmatter=1
+ syn off | syn on
+ AssertEqual SyntaxAt(5, 1), 'mkdRule'
+ unlet g:vim_markdown_frontmatter
+
+# TOML frontmatter
+
+Given markdown;
++++
+a = "b"
++++
+
+Execute (TOML frontmatter is controlled by the option):
+ syn off | syn on
+ AssertNotEqual SyntaxOf('b'), 'tomlString'
+ let g:vim_markdown_toml_frontmatter=1
+ syn off | syn on
+ AssertEqual SyntaxOf('b'), 'tomlString'
+ let g:vim_markdown_toml_frontmatter=0
+ syn off | syn on
+ AssertNotEqual SyntaxOf('b'), 'tomlString'
+
+Given markdown;
+
++++
+a = "b"
++++
+
+Execute (TOML frontmatter only works if it's the first thing in the file):
+ let g:vim_markdown_toml_frontmatter=1
+ syn off | syn on
+ AssertNotEqual SyntaxOf('b'), 'tomlString'
+ unlet g:vim_markdown_toml_frontmatter
+
+# JSON frontmatter
+
+Given markdown;
+{
+ "a": "b"
+}
+
+Execute (JSON frontmatter is controlled by the option):
+ syn off | syn on
+ AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
+ let g:vim_markdown_json_frontmatter=1
+ syn off | syn on
+ AssertEqual SyntaxOf('a'), 'jsonKeyword'
+ let g:vim_markdown_json_frontmatter=0
+ syn off | syn on
+ AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
+
+Given markdown;
+
+{
+ "a": "b"
+}
+
+Execute (JSON frontmatter only works if it's the first thing in the file):
+ let g:vim_markdown_json_frontmatter=1
+ syn off | syn on
+ AssertNotEqual SyntaxOf('a'), 'jsonKeyword'
+ unlet g:vim_markdown_json_frontmatter
+
+# Header
+
+Given markdown;
+# #a
+ccc
+
+## #b
+ddd
+
+Execute (header title starts with #):
+ AssertEqual SyntaxOf('a'), 'htmlH1'
+ AssertEqual SyntaxOf('b'), 'htmlH2'
+
+Given markdown;
+# h1 space
+
+#h1 nospace
+
+# h1 2 spaces
+
+# h1 trailing hash #
+
+## h2 space
+
+##h2 nospace
+
+## h2 trailing hash ##
+
+### h3 space
+
+###h3 nospace
+
+### h3 trailing hash ###
+
+#### h4
+
+##### h5
+
+###### h6
+
+Execute (atx headers):
+ AssertEqual SyntaxOf(' h1 space'), 'htmlH1'
+ AssertEqual SyntaxOf('h1 nospace'), 'htmlH1'
+ AssertEqual SyntaxOf(' h1 2 spaces'), 'htmlH1'
+ AssertEqual SyntaxOf(' h1 trailing hash '), 'htmlH1'
+ AssertEqual SyntaxOf(' h2 space'), 'htmlH2'
+ AssertEqual SyntaxOf('h2 nospace'), 'htmlH2'
+ AssertEqual SyntaxOf(' h2 trailing hash '), 'htmlH2'
+ AssertEqual SyntaxOf(' h3 space'), 'htmlH3'
+ AssertEqual SyntaxOf('h3 nospace'), 'htmlH3'
+ AssertEqual SyntaxOf(' h3 trailing hash '), 'htmlH3'
+ AssertEqual SyntaxOf(' h4'), 'htmlH4'
+ AssertEqual SyntaxOf(' h5'), 'htmlH5'
+ AssertEqual SyntaxOf(' h6'), 'htmlH6'
+
+Given markdown;
+# h1 before h2
+
+## h2 between h1s
+
+# h1 after h2
+
+Execute (atx headers relative positions):
+ AssertEqual SyntaxOf(' h1 before h2'), 'htmlH1'
+ AssertEqual SyntaxOf(' h2 between h1s'), 'htmlH2'
+ AssertEqual SyntaxOf(' h1 after h2'), 'htmlH1'
+
+Given markdown;
+setex h1
+========
+
+setex h2
+--------
+
+setex h1 single punctuation
+=
+
+setex h1 punctuation longer than header
+================================
+
+Execute (setex headers):
+ AssertEqual SyntaxOf('setex h1'), 'htmlH1'
+ AssertEqual SyntaxOf('^========$'), 'htmlH1'
+ AssertEqual SyntaxOf('setex h2'), 'htmlH2'
+ AssertEqual SyntaxOf('--------'), 'htmlH2'
+ AssertEqual SyntaxOf('setex h1 single punctuation'), 'htmlH1'
+ AssertEqual SyntaxOf('^=$'), 'htmlH1'
+ AssertEqual SyntaxOf('setex h1 punctuation longer than header'), 'htmlH1'
+ AssertEqual SyntaxOf('^================================$'), 'htmlH1'
+
+Given markdown;
+- not Setex
+- because list
+
+Execute (prevent list vs Setex confusion):
+ AssertNotEqual SyntaxOf('- not Setex'), 'htmlH2'
+ AssertNotEqual SyntaxOf('- becuase list'), 'htmlH2'
+
+Given markdown;
+setex h1 before atx
+===================
+
+## atx h2
+
+### atx h3
+
+# atx h1
+
+setex h2
+------------------
+
+### atx h3 2
+
+Execute (mixed atx and setex headers):
+ AssertEqual SyntaxOf('setex h1 before atx'), 'htmlH1'
+ AssertEqual SyntaxOf('==================='), 'htmlH1'
+ AssertEqual SyntaxOf(' atx h2'), 'htmlH2'
+ AssertEqual SyntaxOf(' atx h3'), 'htmlH3'
+ AssertEqual SyntaxOf(' atx h1'), 'htmlH1'
+ AssertEqual SyntaxOf('setex h2'), 'htmlH2'
+ AssertEqual SyntaxOf('------------------'), 'htmlH2'
+
+# List
+
+Given markdown;
+- a & b
+1. c > d
+
+Execute (& and > are not marked as htmlError in lists):
+ AssertEqual SyntaxOf('-'), 'mkdListItem'
+ AssertEqual SyntaxOf('1.'), 'mkdListItem'
+ AssertNotEqual SyntaxOf('&'), 'htmlError'
+ AssertNotEqual SyntaxOf('>'), 'htmlError'
+
+Given markdown;
+1. a
+2. b
+
+Execute (list after line break):
+ AssertEqual SyntaxOf('1'), 'mkdListItem'
+ AssertEqual SyntaxOf('2'), 'mkdListItem'
+
+# HTML
+
+Given markdown;
+a
+
+<p>b</p>
+
+- <span>c</span>
+
+Execute (HTML tag in text):
+ AssertEqual SyntaxOf('p'), 'htmlTagName'
+ AssertEqual SyntaxOf('<p>'), 'htmlTag'
+ AssertEqual SyntaxOf('</p>'), 'htmlEndTag'
+ AssertEqual SyntaxOf('span'), 'htmlTagName'
+ AssertEqual SyntaxOf('<span>'), 'htmlTag'
+ AssertEqual SyntaxOf('</span>'), 'htmlEndTag'
--- /dev/null
+Before:
+ let &gdefault = 1
+
+After:
+ let &gdefault = 0
+
+Given markdown;
+| normal |no space| 2 spaces ||
+| - |-| --- ||
+| normal |no space| 2 spaces ||
+
+Execute (format unformatted table):
+ TableFormat
+
+Expect (table is formatted):
+ | normal | no space | 2 spaces | |
+ |--------|----------|----------|--|
+ | normal | no space | 2 spaces | |
+
+Given markdown;
+| a | b |
+|---|---|
+| c | d |
+
+Execute (format well formatted table):
+ TableFormat
+
+Expect (table is not modified):
+ | a | b |
+ |---|---|
+ | c | d |
+
+Given markdown;
+| left |right| center ||
+| :- | --: |:---:|:|
+| left |right| center ||
+
+Execute (format table with colons):
+ TableFormat
+
+Expect (preserve colons to align text):
+ | left | right | center | |
+ |:-----|------:|:------:|:--|
+ | left | right | center | |
--- /dev/null
+" Tests toc window auto-fit to longest header, but without exceeding half screen.
+
+Given markdown;
+# chap 1
+
+# chap 2
+
+# chap 3
+
+# chap 4
+
+# chap 5
+
+# chap 6
+
+# chap 7
+
+# chap 8
+
+# chap 9
+
+# chap 10
+
+# chap 11
+
+# chap 12
+
+## chap 12.1
+
+### chap 12.1.1
+
+#### chap 12.1.1.1
+
+##### chap 12.1.1.1.1
+
+###### chap 12.1.1.1.1.1
+
+# chap 13
+
+Execute (toc window autofit width):
+ set number
+ let g:vim_markdown_toc_autofit = 1
+ let line = '###### chap 12.1.1.1.1.1'
+ AssertEqual getline('33'), line
+ :Toc
+ let real_width = winwidth(0)
+ :lclose
+ let expected_width = len(line) + 2*5 + 1 + 3 - 7
+ AssertEqual real_width, expected_width
+ set nonumber
+" 2 spaces * 5 additional header levels + 1 space for first header +
+" 3 spaces for line numbers - 7 chars ('###### ') that don't show up on the TOC
+
--- /dev/null
+Given markdown;
+# a
+
+Execute (Toc does not set nomodifiable on other files):
+ " Sanity check.
+ Assert &modifiable
+
+ :Toc
+ :lclose
+ :edit a
+
+ Assert &modifiable
+
+Given markdown;
+header 1
+========
+
+test
+
+header 2
+--------
+
+test
+
+### header 3
+
+test
+
+Execute (Toc setex headers):
+ :Toc
+
+Expect (setex headers):
+ header 1
+ header 2
+ header 3
+
+Given markdown;
+# header 1
+
+test
+
+## header 2
+
+test
+
+### header 3
+
+test
+
+Execute (Toc atx headers):
+ :Toc
+
+Expect (atx headers):
+ header 1
+ header 2
+ header 3
+
+Given markdown;
+ATX tests.
+
+# h1 space
+
+#h1 nospace
+
+# h1 2 spaces
+
+# h1 trailing hash #
+
+## h2 space
+
+##h2 nospace
+
+## h2 trailing hash ##
+
+### h3 space
+
+###h3 nospace
+
+### h3 trailing hash ###
+
+#### h4
+
+##### h5
+
+###### h6
+
+---
+
+Relative positions.
+
+# h1 before h2
+
+## h2 between h1s
+
+# h1 after h2
+
+---
+
+Setex tests.
+
+setex h1
+========
+
+setex h2
+--------
+
+setex h1 single punctuation
+=
+
+setex h1 punctuation longer than header
+================================
+
+Prevent list vs Setex confusion:
+
+- not Setex
+- because list
+
+---
+
+Mixed tests.
+
+setex h1 before atx
+===================
+
+## atx h2
+
+### atx h3
+
+# atx h1
+
+setex h2
+------------------
+
+### atx h3 2
+
+Execute (Toc multiple headers):
+ :Toc
+
+Expect (multiple headers):
+ h1 space
+ h1 nospace
+ h1 2 spaces
+ h1 trailing hash
+ h2 space
+ h2 nospace
+ h2 trailing hash
+ h3 space
+ h3 nospace
+ h3 trailing hash
+ h4
+ h5
+ h6
+ h1 before h2
+ h2 between h1s
+ h1 after h2
+ setex h1
+ setex h2
+ setex h1 single punctuation
+ setex h1 punctuation longer than header
+ setex h1 before atx
+ atx h2
+ atx h3
+ atx h1
+ setex h2
+ atx h3 2
+
+Execute:
+ :lclose
+
+Given markdown;
+# header 1
+
+## header 2
+
+### header 3
+
+Execute (Toc cursor on the current header):
+ normal! G
+ :Toc
+ AssertEqual line('.'), 3
+ :lclose
--- /dev/null
+set nocompatible
+set rtp+=../
+set rtp+=../build/tabular/
+set rtp+=../build/vim-toml/
+set rtp+=../build/vim-json/
+set rtp+=../build/vader.vim/
+set rtp-=~/.vim
+set rtp-=~/.vim/after
+let $LANG='en_US'
+filetype on
+filetype plugin on
+filetype indent on
+syntax on
+
+function! Markdown_GetScriptID(fname) abort
+ let l:snlist = ''
+ redir => l:snlist
+ silent! scriptnames
+ redir END
+ let l:mx = '^\s*\(\d\+\):\s*\(.*\)$'
+ for l:line in split(l:snlist, "\n")
+ if stridx(substitute(l:line, '\\', '/', 'g'), a:fname) >= 0
+ return substitute(l:line, l:mx, '\1', '')
+ endif
+ endfor
+endfunction
+function! Markdown_GetFunc(fname, funcname) abort
+ return function('<SNR>' . Markdown_GetScriptID(a:fname) . '_' . a:funcname)
+endfunction
--- /dev/null
+hi clear
+if exists("syntax_on")
+ syntax reset
+endif
+
+let g:colors_name = "madduck"
+
+if &background == "dark"
+ hi Normal ctermfg=15 ctermbg=0 cterm=none term=none
+ hi Comment ctermfg=fg ctermbg=bg cterm=none term=bold
+ hi Constant ctermfg=Cyan ctermbg=bg cterm=none term=underline
+ hi Special ctermfg=LightRed ctermbg=bg cterm=none term=bold
+ hi Identifier ctermfg=fg ctermbg=bg cterm=none term=underline
+ hi Statement ctermfg=Yellow ctermbg=bg cterm=bold term=bold
+ hi PreProc ctermfg=Cyan ctermbg=bg cterm=bold term=underline
+ hi Type ctermfg=LightGreen ctermbg=bg cterm=bold term=underline
+ hi Ignore ctermfg=bg ctermbg=bg cterm=none term=none
+
+ hi mailHeader ctermfg=darkcyan
+ hi mailSignature ctermfg=darkcyan
+ hi mailEmail ctermfg=darkcyan
+ hi mailHeaderKey ctermfg=white
+ hi mailSubject ctermfg=white
+
+ hi mailQuoted1 ctermfg=darkgreen
+ hi mailQuoted2 ctermfg=magenta cterm=NONE
+ hi mailQuoted3 ctermfg=darkcyan
+ hi mailQuoted4 ctermfg=darkred
+ hi mailQuoted5 ctermfg=darkgreen
+ hi mailQuoted6 ctermfg=magenta
+
+ hi Error ctermfg=White ctermbg=Red cterm=none term=none
+ hi Todo ctermfg=Black ctermbg=Yellow cterm=standout term=standout
+
+else
+ hi Normal ctermfg=0 ctermbg=15 cterm=none term=none
+ hi Comment ctermfg=fg ctermbg=bg cterm=none term=bold
+ hi Constant ctermfg=DarkGray ctermbg=bg cterm=none term=underline
+ hi Special ctermfg=DarkMagenta ctermbg=bg cterm=none term=bold
+ hi Identifier ctermfg=DarkBlue ctermbg=bg cterm=none term=underline
+ hi Statement ctermfg=DarkBlue ctermbg=bg cterm=none term=bold
+ hi PreProc ctermfg=DarkMagenta ctermbg=bg cterm=none term=underline
+ hi Type ctermfg=DarkBlue ctermbg=bg cterm=none term=underline
+ hi Ignore ctermfg=bg ctermbg=bg cterm=none term=none
+
+ hi mailHeader ctermfg=darkblue cterm=none
+ hi mailSignature ctermfg=darkblue
+ hi mailEmail ctermfg=magenta cterm=none
+ hi mailHeaderKey ctermfg=blue cterm=none
+ hi mailSubject ctermfg=blue cterm=none
+
+ hi mailQuoted1 ctermfg=darkred
+ hi mailQuoted2 ctermfg=darkmagenta cterm=none
+ hi mailQuoted3 ctermfg=darkgreen
+ hi mailQuoted4 ctermfg=darkred
+ hi mailQuoted5 ctermfg=darkmagenta
+ hi mailQuoted6 ctermfg=darkgreen
+
+ hi Error ctermfg=white ctermbg=red cterm=none term=none
+ hi Todo ctermfg=black ctermbg=yellow cterm=standout term=standout
+
+ hi SpellBad ctermfg=white ctermbg=darkred cterm=none term=reverse
+ hi SpellCap ctermfg=darkred ctermbg=bg cterm=bold term=reverse
+ hi SpellRare ctermfg=red ctermbg=bg cterm=none term=reverse
+ hi SpellLocal ctermfg=white ctermbg=magenta cterm=none term=reverse
+
+ hi Highlit ctermbg=yellow ctermfg=black cterm=none term=reverse
+
+endif
+
+" vim:sts=8:sw=8:ts=8:noet
--- /dev/null
+/usr/share/vim/addons/compiler/ledger.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/compiler/tex.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/doc/Tabular.txt
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/doc/airline.txt
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/doc/imaps.txt.gz
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/doc/lastplace.txt
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/doc/latex-suite-quickstart.txt.gz
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/doc/latex-suite.txt.gz
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/doc/latexhelp.txt.gz
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/doc/ledger.txt
\ No newline at end of file
--- /dev/null
+/usr/share/vim-scripts/doc/surround.txt
\ No newline at end of file
--- /dev/null
+/usr/share/vim-scripts/doc/vimplate.txt
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/doc/voom.txt
\ No newline at end of file
--- /dev/null
+augroup filetypedetect
+ " detect itsalltext buffers
+ au! BufRead,BufNewFile */itsalltext/*.txt setf itsalltext
+augroup END
--- /dev/null
+/usr/share/vim/addons/ftdetect/ledger.vim
\ No newline at end of file
--- /dev/null
+augroup filetypedetect
+ " detect mediawiki buffers
+ au! BufRead,BufNewFile *.mw setf mediawiki
+augroup END
--- /dev/null
+au BufRead,BufNewFile *.pp setfiletype puppet
--- /dev/null
+/usr/share/vim/addons/ftplugin/bib_latexSuite.vim
\ No newline at end of file
--- /dev/null
+setlocal tw=68
--- /dev/null
+" git uses tabs by default
+setlocal noet
+setlocal sw=8
--- /dev/null
+if exists("b:did_ftplugin")
+ finish
+endif
+
+let b:did_ftplugin = 1
+
+setlocal nolist
+setlocal wrap
+setlocal linebreak
--- /dev/null
+/__pycache__
+*.pyc
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/bibtex.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/bibtools.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/brackets.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/compiler.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/custommacros.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/diacritics.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/dictionaries/SIunits
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/dictionaries/dictionary
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/elementmacros.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/envmacros.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/folding.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/macros/example
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/main.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/mathmacros-utf.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/mathmacros.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/multicompile.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/outline.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/SIunits
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/accents
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/acromake
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/afterpage
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/alltt
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/amsmath
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/amsthm
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/amsxtra
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/arabic
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/array
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/babel
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/bar
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/biblatex
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/bm
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/bophook
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/boxedminipage
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/caption2
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/cases
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/ccaption
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/changebar
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/chapterbib
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/cite
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/color
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/comma
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/csquotes
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/deleq
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/drftcite
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/dropping
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/enumerate
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/eqlist
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/eqparbox
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/everyshi
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/exmpl
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/fixme
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/flafter
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/float
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/floatflt
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/fn2end
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/footmisc
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/geometry
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/german
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/graphicx
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/graphpap
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/harpoon
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/hhline
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/histogram
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/hyperref
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/ifthen
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/inputenc
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/letterspace
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/lineno
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/longtable
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/lscape
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/manyfoot
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/moreverb
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/multibox
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/multicol
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/newalg
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/ngerman
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/numprint
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/oldstyle
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/outliner
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/overcite
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/pagenote
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/parallel
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/plain
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/plates
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/polski
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/psgo
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/schedule
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/textfit
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/times
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/tipa
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/ulem
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/url
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/verbatim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/packages/version
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/projecttemplate.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/pytools.py
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/smartspace.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/templates.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/templates/IEEEtran.tex
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/templates/article.tex
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/templates/report.tex
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/templates/report_two_column.tex
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/texmenuconf.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/texproject.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/texrc
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/texviewer.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/version.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/latex-suite/wizardfuncs.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/ftplugin/ledger.vim
\ No newline at end of file
--- /dev/null
+" Many MediaWiki wikis prefer line breaks only at the end of paragraphs
+" (like in a text processor), which results in long, wrapping lines.
+setlocal wrap linebreak
+setlocal textwidth=0
+
+" No auto-wrap at all.
+setlocal formatoptions-=tc formatoptions+=l
+if v:version >= 602 | setlocal formatoptions-=a | endif
+
+" Make navigation more amenable to the long wrapping lines.
+noremap <buffer> k gk
+noremap <buffer> j gj
+noremap <buffer> <Up> gk
+noremap <buffer> <Down> gj
+noremap <buffer> 0 g0
+noremap <buffer> ^ g^
+noremap <buffer> $ g$
+noremap <buffer> D dg$
+noremap <buffer> C cg$
+noremap <buffer> A g$a
+
+inoremap <buffer> <Up> <C-O>gk
+inoremap <buffer> <Down> <C-O>gj
+
+" utf-8 should be set if not already done globally
+setlocal fileencoding=utf-8
+setlocal matchpairs+=<:>
+
+" Treat lists, indented text and tables as comment lines and continue with the
+" same formatting in the next line (i.e. insert the comment leader) when hitting
+" <CR> or using "o".
+setlocal comments=n:#,n:*,n:\:,s:{\|,m:\|,ex:\|}
+setlocal formatoptions+=roq
+
+" match HTML tags (taken directly from $VIM/ftplugin/html.vim)
+if exists("loaded_matchit")
+ let b:match_ignorecase=0
+ let b:match_skip = 's:Comment'
+ let b:match_words = '<:>,' .
+ \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
+ \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
+ \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
+endif
+
+" Other useful mappings
+" Insert a matching = automatically while starting a new header.
+inoremap <buffer> <silent> = <C-R>=(getline('.')==''\|\|getline('.')=~'^=\+$')?"==\<Lt>Left>":"="<CR>
+
+" Enable folding based on ==sections==
+setlocal foldexpr=getline(v:lnum)=~'^\\(=\\+\\)[^=]\\+\\1\\(\\s*<!--.*-->\\)\\=\\s*$'?\">\".(len(matchstr(getline(v:lnum),'^=\\+'))-1):\"=\"
+setlocal fdm=expr
--- /dev/null
+imap <Leader>trace import ipdb; ipdb.set_trace()
--- /dev/null
+let Tex_UsePython = 1
+
+let Tex_FoldedMisc = "preamble,<<<"
+
+"let g:Imap_UsePlaceHolders = 0
--- /dev/null
+/usr/share/vim/addons/ftplugin/tex_latexSuite.vim
\ No newline at end of file
--- /dev/null
+"autocmd BufWritePre *.vcf :/^REV:/s/:.*/\=strftime(":%Y%m%dT%H%M%S%z")/ge
+
+nmap <buffer> <F1> :%s/^UID:.*/\="UID:urn:uuid:" . split(system("uuid"))[0]/<CR>:nohlsearch<CR>
--- /dev/null
+/usr/share/vim/addons/indent/ledger.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim-scripts/indent/python.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/indent/tex.vim
\ No newline at end of file
--- /dev/null
+" Script: table.vim
+" Version: 0.1
+"
+" Maintainer: Usman Latif Email: latif@techuser.net
+" Webpage: http://www.techuser.net
+"
+" Description:
+" This script defines maps for easier editing and alignmnet of tables.
+" For usage and installation instructions consult the documentation
+" files that came with this script. In case you are missing the
+" documentation files, download a complete distribution of the files
+" from http://www.techuser.net/files
+
+
+map <silent> <Leader>tt :call TableToggle()<CR>
+map <silent> <Leader>th :call TableHeading()<CR>
+map <silent> <Leader>ta :call TableAlign()<CR>
+
+let s:tablemode = 0
+let s:heading = ''
+let s:fieldsep = ' \{2,}'
+
+" Function: TableHeading
+" Args: None
+"
+" use current line as the heading line of the table
+" current line should be non-empty
+
+func! TableHeading()
+ " get heading line and store it in a script variable
+ let s:heading = TrimWS(ExpandTabs(getline(".")))
+
+ if !ValidHeading(s:heading)
+ return
+ endif
+
+ " map keys to invoke table navigation functions
+ call EnableMaps()
+
+ let s:tablemode = 1
+endfunc
+
+" Function: ValidHeading
+" Args: None
+" Return: boolean
+"
+" returns 1 if heading is valid, i.e., non-whitespace
+" returns 0 otherwise
+
+func! ValidHeading(heading)
+ " heading line empty ==> invalid heading
+ let l:str = a:heading
+ if strlen(str) == matchend(str,'^ *')
+ return 0
+ endif
+ return 1
+endfunc
+
+" Function: TableToggle
+" Args: None
+"
+" Toggle Table Mode
+" Enable/Disable maps for tablemode keys
+
+func! TableToggle()
+
+ if !ValidHeading(s:heading)
+ return
+ endif
+
+ " enable/disable maps
+ if s:tablemode
+ call DisableMaps()
+ else
+ call EnableMaps()
+ endif
+
+ " toggle tablemode
+ let s:tablemode = !s:tablemode
+endfunc
+
+" Function: Enable Maps
+" Args: None
+"
+" Enable maps for tablemode keys
+
+func! EnableMaps()
+ nnoremap <silent> <Tab> :call NextField(0)<CR>
+ inoremap <silent> <Tab> <C-O>:call NextField(1)<CR>
+ nnoremap <silent> <S-Tab> :call PrevField()<CR>
+ inoremap <silent> <S-Tab> <C-O>:call PrevField()<CR>
+endfunc
+
+" Function: Disable Maps
+" Args: None
+"
+" Disable maps for tablemode keys
+
+func! DisableMaps()
+ nunmap <Tab>
+ iunmap <Tab>
+ nunmap <S-Tab>
+ iunmap <S-Tab>
+endfunc
+
+
+" Function: TableAlign
+" Args: None
+" Description: align the fields of the row with the fields of the heading
+
+func! TableAlign()
+ if !s:tablemode
+ return
+ endif
+ let temp = ""
+ let linetext = TrimWS(ExpandTabs(getline('.')))
+
+ let nfhead = LenWS(s:heading,0) + 1
+ let nftext = LenWS(linetext,0) + 1
+ let error = 0
+
+ while 1
+ " flag error if current field too big to fit
+ if (nfhead - strlen(temp)) <= 1 && strlen(temp) != 0
+ let error = 1
+ break
+ endif
+
+ " pad to next field of heading and add contents of the next text
+ " field after that
+ let temp = temp . Replicate(' ',nfhead - strlen(temp)-1) . Gettext(linetext,nftext-1)
+
+ let nfhead = NextFieldPos(s:heading,s:fieldsep,nfhead)
+ let nftext = NextFieldPos(linetext,s:fieldsep,nftext)
+
+ " If no next field exit loop
+ if nfhead == 0 || nftext == 0
+ " flag error if row to be aligned has more fields than heading
+ if nftext != 0
+ let error = 1
+ endif
+ break
+ endif
+ endwhile
+ if !error && temp != linetext
+ call setline('.',temp)
+ endif
+endfunc
+
+
+" Function: PrevField
+" Args: None
+"
+" position the cursor at the start of the prev field position
+
+func! PrevField()
+ let nextpos = 1
+ let lastpos = 1
+ let pos = col('.')
+ let linenum = line('.')
+ let fstfield = LenWS(s:heading,0) + 1
+
+ while nextpos != 0
+ let lastpos = nextpos
+ let nextpos = NextFieldPos(s:heading,s:fieldsep,nextpos)
+ if pos > lastpos && (pos <= nextpos || nextpos == 0)
+ let pos = lastpos
+ endif
+ endwhile
+
+ if pos <= fstfield && linenum != 1 && col('.') <= fstfield
+ let linenum = linenum - 1
+ let pos = lastpos
+ endif
+
+ call cursor(linenum,pos)
+endfunc
+
+
+" Function: NextField
+" Args: curmode
+"
+" position the cursor at the start of next field position
+" pad the current line with spaces if needed when in insertion
+" or replace mode
+
+func! NextField(curmode)
+ let l:pos = Max(col('.') - 2,0)
+ let l:startnext = NextFieldPos(s:heading,s:fieldsep,pos)
+ let l:linenum = line('.')
+
+ "If no nextfield on line goto next line
+ "append an empty line if in insert/replace mode
+ if startnext == 0
+ if a:curmode
+ call append(linenum,'')
+ endif
+ let linenum = linenum+1
+ let startnext = LenWS(s:heading,0) + 1
+ endif
+
+ let l:linetext = ExpandTabs(getline(linenum))
+ let l:linelen = strlen(linetext)
+
+ "If padding required
+ if linelen < startnext
+ let linetext = linetext . Replicate(' ',startnext-linelen+1)
+ call setline(linenum,linetext)
+ endif
+
+ if linenum > line('$')
+ let linenum = line('$')
+ let startnext = col('.')
+ endif
+ call cursor(linenum,startnext)
+endfunc
+
+
+" Function: NextFieldPos
+" Args: string,pattern,startposition
+"
+" returns the position of the end of field in which pos
+" is contained
+
+func! NextFieldPos(str,pat,pos)
+ return matchend(a:str,a:pat,a:pos) + 1
+endfunc
+
+
+" Function: Gettext
+" Args: str, pos
+" Description: Extract the text contents of a field from the
+" string str, starting at position pos
+
+func! Gettext(str,pos)
+ let endpos = match(a:str,s:fieldsep,a:pos)
+ if endpos == -1
+ let endpos = strlen(a:str) - 1
+ endif
+ return strpart(a:str,a:pos,endpos - a:pos + 1)
+endfunc
+
+
+" Function: TrimWS
+" Args: str
+" Description: Trim any WS at the end of the string str
+
+func! TrimWS(str)
+ let len = match(a:str,' \{1,}$',0)
+ if len == -1
+ return a:str
+ else
+ return strpart(a:str,0,len)
+ endif
+endfunc
+
+
+" Function: LenWS
+" Args: str, startpos
+" Description: Length of contiguous whitespace starting at
+" position startpos in string str
+
+func! LenWS(str,startpos)
+ let i = 0
+ while a:str[a:startpos+i] == ' '
+ let i = i + 1
+ endwhile
+ return i
+endfunc
+
+
+" Function: Replicate
+" Args: str,cnt
+"
+" Repeat the given string cnt number of times
+
+func! Replicate(str,cnt)
+ let l:temp = ""
+
+ let l:i = 0
+ while i < a:cnt
+ let temp = temp . a:str
+ let i = i + 1
+ endwhile
+
+ return temp
+endfunc
+
+
+" Function: ExpandTabs
+" Args: str
+" Return value: string
+"
+" Expand all tabs in the string to spaces
+" according to tabstop value
+
+func! ExpandTabs(str)
+ let l:str = a:str
+ let l:temp = ""
+
+ let l:i = 0
+ while i < strlen(str)
+ if str[i] == "\t"
+ let temp = temp . Replicate(' ',&tabstop)
+ else
+ let temp = temp . str[i]
+ endif
+ let i = i + 1
+ endwhile
+
+ return temp
+endfunc
+
+" Function: Max
+" Args: x,y
+" Description: return the max of x and y
+
+func! Max(x,y)
+ if a:x >= a:y
+ return a:x
+ else
+ return a:y
+ endif
+endfunc
--- /dev/null
+/usr/share/vim/addons/plugin/SyntaxFolds.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/plugin/Tabular.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/plugin/airline.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim-scripts/plugin/debPlugin.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/plugin/filebrowser.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim-scripts/plugin/gnupg.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/plugin/imaps.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/plugin/justify.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/plugin/lastplace.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim-scripts/plugin/lbdbq.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/plugin/matchit.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/plugin/remoteOpen.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim-scripts/plugin/securemodelines.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim-scripts/plugin/surround.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim-scripts/plugin/vimplate.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim-voom/plugin/voom.vim
\ No newline at end of file
--- /dev/null
+ADSL
+Ajzen
+Akkerman
+alioth
+alright
+anonymise
+anonymised
+anonymising
+autotools
+B
+bikeshed
+blog
+blogged
+bo
+Boehm
+BTS
+c0ffee
+changelog
+chroot
+codings
+cosmopolite
+cosmopoliteness
+deadbeef
+debhelper
+debian
+Debian
+Debianisation
+debianised
+Debian's
+Delphis
+determinist
+devel
+diff
+dpkg
+EFTE
+Farquhar
+Fishbein
+FreeBSD
+freenode
+Genericity
+hamm
+heterophilous
+heterophily
+Heterophily
+homophilous
+homophily
+Homophily
+iff
+interpretivism
+IRC
+Jun
+learnable
+lenny
+Likert
+lintian
+localite
+madduck
+mdadm
+namespace
+occasionalist
+oldstable
+panelist
+panelists
+peercolation
+Peercolation
+phd
+pkg
+pleonastic
+POSIX
+RC
+rebase
+rebases
+rebasing
+rex
+s
+S
+Schulze
+screenshot
+Slackware
+snapshotted
+Solaris
+svn
+tarball
+tarballs
+Tarde's
+tesseract
+trialability
+Trialability
+trialable
+Troup
+Ubuntu
+upstream's
+vcs
+vi
+Wichert
+wiki
+workflow
+workflows
+netbooks
+Hurd
+grep
--- /dev/null
+/usr/share/vim-scripts/syntax/deb.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/syntax/jinja.vim
\ No newline at end of file
--- /dev/null
+/usr/share/vim/addons/syntax/ledger.vim
\ No newline at end of file
--- /dev/null
+" mediawiki.vim (formerly named Wikipedia.vim)
+"
+" Vim syntax file
+" Language: MediaWiki, http://www.mediawiki.org/
+" Maintainer: This syntax file needs a maintainer in order to ship
+" with Vim. Please contact [[User:Unforgettableid]] if you want
+" to volunteer.
+" Home: http://en.wikipedia.org/wiki/Wikipedia:Text_editor_support#Vim
+" Last Change: 2011 Sep 19
+" Credits: [[User:Aepd87]], [[User:Danny373]], [[User:Ingo Karkat]], et al.
+"
+" Published on Wikipedia in 2003-04 and declared authorless.
+"
+" Based on the HTML syntax file. Probably too closely based, in fact.
+" There may well be name collisions everywhere, but ignorance is bliss,
+" so they say.
+"
+" To do: plug-in support for downloading and uploading to the server.
+
+if !exists("main_syntax")
+ if version < 600
+ syntax clear
+ elseif exists("b:current_syntax")
+ finish
+ endif
+ let main_syntax = "html"
+endif
+
+syntax case ignore
+if v:version >= 700
+ syntax spell toplevel
+endif
+
+" Mark illegal characters
+sy match htmlError "[<>&]"
+
+" Tags
+sy region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar,@htmlPreproc
+sy region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar,@htmlPreproc
+sy match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1 contains=@htmlPreproc
+sy region htmlEndTag start=+</+ end=+>+ contains=htmlTagN,htmlTagError
+sy region htmlTag start=+<[^/]+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster
+sy match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster
+sy match htmlTagN contained +</\s*[-a-zA-Z0-9]\++hs=s+2 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster
+sy match htmlTagError contained "[^>]<"ms=s+1
+
+" Allowed HTML tag names
+sy keyword htmlTagName contained big blockquote br caption center cite code
+sy keyword htmlTagName contained dd del div dl dt font hr ins li
+sy keyword htmlTagName contained ol p pre rb rp rt ruby s small span strike sub
+sy keyword htmlTagName contained sup table td th tr tt ul var
+sy match htmlTagName contained "\<\(b\|i\|u\|h[1-6]\|em\|strong\)\>"
+" Allowed Wiki tag names
+sy keyword htmlTagName contained math nowiki references source syntaxhighlight
+
+" Allowed arg names
+sy keyword htmlArg contained align lang dir width height nowrap bgcolor clear
+sy keyword htmlArg contained noshade cite datetime size face color type start
+sy keyword htmlArg contained value compact summary border frame rules
+sy keyword htmlArg contained cellspacing cellpadding valign char charoff
+sy keyword htmlArg contained colgroup col span abbr axis headers scope rowspan
+sy keyword htmlArg contained colspan id class name style title
+
+" Special characters
+sy match htmlSpecialChar "&#\=[0-9A-Za-z]\{1,8};"
+
+" Comments
+sy region htmlComment start=+<!+ end=+>+ contains=htmlCommentPart,htmlCommentError
+sy match htmlCommentError contained "[^><!]"
+sy region htmlCommentPart contained start=+--+ end=+--\s*+ contains=@htmlPreProc
+sy region htmlComment start=+<!DOCTYPE+ keepend end=+>+
+
+if !exists("html_no_rendering")
+ sy cluster htmlTop contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLink,@htmlPreproc
+
+ sy region htmlBold start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic
+ sy region htmlBold start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic
+ sy region htmlBoldUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlBoldUnderlineItalic
+ sy region htmlBoldItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlBoldItalicUnderline
+ sy region htmlBoldItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop,htmlBoldItalicUnderline
+ sy region htmlBoldUnderlineItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop
+ sy region htmlBoldUnderlineItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop
+ sy region htmlBoldItalicUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlBoldUnderlineItalic
+
+ sy region htmlUnderline start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlUnderlineBold,htmlUnderlineItalic
+ sy region htmlUnderlineBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlUnderlineBoldItalic
+ sy region htmlUnderlineBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlUnderlineBoldItalic
+ sy region htmlUnderlineItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlUnderlineItalicBold
+ sy region htmlUnderlineItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop,htmlUnderlineItalicBold
+ sy region htmlUnderlineItalicBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop
+ sy region htmlUnderlineItalicBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop
+ sy region htmlUnderlineBoldItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop
+ sy region htmlUnderlineBoldItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop
+
+ sy region htmlItalic start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlItalicBold,htmlItalicUnderline
+ sy region htmlItalic start="<em\>" end="</em>"me=e-5 contains=@htmlTop
+ sy region htmlItalicBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlItalicBoldUnderline
+ sy region htmlItalicBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlItalicBoldUnderline
+ sy region htmlItalicBoldUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop
+ sy region htmlItalicUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlItalicUnderlineBold
+ sy region htmlItalicUnderlineBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop
+ sy region htmlItalicUnderlineBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop
+
+ sy region htmlH1 start="<h1\>" end="</h1>"me=e-5 contains=@htmlTop
+ sy region htmlH2 start="<h2\>" end="</h2>"me=e-5 contains=@htmlTop
+ sy region htmlH3 start="<h3\>" end="</h3>"me=e-5 contains=@htmlTop
+ sy region htmlH4 start="<h4\>" end="</h4>"me=e-5 contains=@htmlTop
+ sy region htmlH5 start="<h5\>" end="</h5>"me=e-5 contains=@htmlTop
+ sy region htmlH6 start="<h6\>" end="</h6>"me=e-5 contains=@htmlTop
+endif
+
+
+" No htmlTop and wikiPre inside HTML preformatted areas, because
+" MediaWiki renders everything in there literally (HTML tags and
+" entities, too): <pre> tags work as the combination of <nowiki> and
+" the standard HTML <pre> tag: the content will preformatted, and it
+" will not be parsed, but shown as in the wikitext source.
+"
+" With wikiPre, indented lines would be rendered differently from
+" unindented lines.
+sy match htmlPreTag /<pre>/ contains=htmlTag
+sy match htmlPreEndTag /<\/pre>/ contains=htmlEndTag
+sy match wikiNowikiTag /<nowiki>/ contains=htmlTag
+sy match wikiNowikiEndTag /<\/nowiki>/ contains=htmlEndTag
+sy match wikiSourceTag /<source\s\+[^>]\+>/ contains=htmlTag
+sy match wikiSourceEndTag /<\/source>/ contains=htmlEndTag
+sy match wikiSyntaxHLTag /<syntaxhighlight\s\+[^>]\+>/ contains=htmlTag
+sy match wikiSyntaxHLEndTag /<\/syntaxhighlight>/ contains=htmlEndTag
+
+" Note: Cannot use 'start="<pre>"rs=e', so still have the <pre> tag
+" highlighted correctly via separate sy-match. Unfortunately, this will
+" also highlight <pre> tags inside the preformatted region.
+sy region htmlPre start="<pre>" end="<\/pre>"me=e-6 contains=htmlPreTag
+sy region wikiNowiki start="<nowiki>" end="<\/nowiki>"me=e-9 contains=wikiNowikiTag
+sy region wikiSource start="<source\s\+[^>]\+>" keepend end="<\/source>"me=e-9 contains=wikiSourceTag
+sy region wikiSyntaxHL start="<syntaxhighlight\s\+[^>]\+>" keepend end="<\/syntaxhighlight>"me=e-18 contains=wikiSyntaxHLTag
+
+sy include @TeX syntax/tex.vim
+sy region wikiTeX matchgroup=htmlTag start="<math>" end="<\/math>" contains=@texMathZoneGroup,wikiNowiki,wikiNowikiEndTag
+sy region wikiRef matchgroup=htmlTag start="<ref>" end="<\/ref>" contains=wikiNowiki,wikiNowikiEndTag
+
+sy cluster wikiTop contains=@Spell,wikiLink,wikiNowiki,wikiNowikiEndTag
+
+sy region wikiItalic start=+'\@<!'''\@!+ end=+''+ oneline contains=@wikiTop,wikiItalicBold
+sy region wikiBold start=+'''+ end=+'''+ oneline contains=@wikiTop,wikiBoldItalic
+sy region wikiBoldAndItalic start=+'''''+ end=+'''''+ oneline contains=@wikiTop
+
+sy region wikiBoldItalic contained start=+'\@<!'''\@!+ end=+''+ oneline contains=@wikiTop
+sy region wikiItalicBold contained start=+'''+ end=+'''+ oneline contains=@wikiTop
+
+sy region wikiH1 start="^=" end="=" oneline contains=@wikiTop
+sy region wikiH2 start="^==" end="==" oneline contains=@wikiTop
+sy region wikiH3 start="^===" end="===" oneline contains=@wikiTop
+sy region wikiH4 start="^====" end="====" oneline contains=@wikiTop
+sy region wikiH5 start="^=====" end="=====" oneline contains=@wikiTop
+sy region wikiH6 start="^======" end="======" oneline contains=@wikiTop
+
+sy region wikiLink start="\[\[" end="\]\]\(s\|'s\|es\|ing\|\)" oneline contains=wikiLink,wikiNowiki,wikiNowikiEndTag
+
+sy region wikiLink start="\[http:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag
+sy region wikiLink start="\[https:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag
+sy region wikiLink start="\[ftp:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag
+sy region wikiLink start="\[gopher:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag
+sy region wikiLink start="\[news:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag
+sy region wikiLink start="\[mailto:" end="\]" oneline contains=wikiNowiki,wikiNowikiEndTag
+
+sy region wikiTemplate start="{{" end="}}" contains=wikiNowiki,wikiNowikiEndTag
+
+sy match wikiParaFormatChar /^[\:|\*|;|#]\+/
+sy match wikiParaFormatChar /^-----*/
+sy match wikiPre /^\ .*$/ contains=wikiNowiki,wikiNowikiEndTag
+
+
+" HTML highlighting
+
+if version < 508
+ command! -nargs=+ HtmlHiLink hi link <args>
+else
+ command! -nargs=+ HtmlHiLink hi def link <args>
+endif
+
+if version >= 508 || !exists("did_html_syn_inits")
+ HtmlHiLink htmlTag Function
+ HtmlHiLink htmlEndTag Identifier
+ HtmlHiLink htmlArg Type
+ HtmlHiLink htmlTagName htmlStatement
+ HtmlHiLink htmlSpecialTagName Exception
+ HtmlHiLink htmlValue String
+ HtmlHiLink htmlSpecialChar Special
+
+ if !exists("html_no_rendering")
+ HtmlHiLink htmlTitle Title
+ HtmlHiLink htmlH1 htmlTitle
+ HtmlHiLink htmlH2 htmlTitle
+ HtmlHiLink htmlH3 htmlTitle
+ HtmlHiLink htmlH4 htmlTitle
+ HtmlHiLink htmlH5 htmlTitle
+ HtmlHiLink htmlH6 htmlTitle
+
+ HtmlHiLink htmlPreProc PreProc
+ HtmlHiLink htmlHead htmlPreProc
+ HtmlHiLink htmlPreProcAttrName htmlPreProc
+ HtmlHiLink htmlPreStmt htmlPreProc
+
+ HtmlHiLink htmlSpecial Special
+ HtmlHiLink htmlCssDefinition htmlSpecial
+ HtmlHiLink htmlEvent htmlSpecial
+ HtmlHiLink htmlSpecialChar htmlSpecial
+
+ HtmlHiLink htmlComment Comment
+ HtmlHiLink htmlCommentPart htmlComment
+ HtmlHiLink htmlCssStyleComment htmlComment
+
+ HtmlHiLink htmlString String
+ HtmlHiLink htmlPreAttr htmlString
+ HtmlHiLink htmlValue htmlString
+
+ HtmlHiLink htmlError Error
+ HtmlHiLink htmlBadArg htmlError
+ HtmlHiLink htmlBadTag htmlError
+ HtmlHiLink htmlCommentError htmlError
+ HtmlHiLink htmlPreError htmlError
+ HtmlHiLink htmlPreProcAttrError htmlError
+ HtmlHiLink htmlTagError htmlError
+
+ HtmlHiLink htmlStatement Statement
+
+ HtmlHiLink htmlConstant Constant
+
+ HtmlHiLink htmlBoldItalicUnderline htmlBoldUnderlineItalic
+ HtmlHiLink htmlUnderlineItalicBold htmlBoldUnderlineItalic
+ HtmlHiLink htmlUnderlineBoldItalic htmlBoldUnderlineItalic
+ HtmlHiLink htmlItalicBoldUnderline htmlBoldUnderlineItalic
+ HtmlHiLink htmlItalicUnderlineBold htmlBoldUnderlineItalic
+
+ HtmlHiLink htmlItalicBold htmlBoldItalic
+ HtmlHiLink htmlItalicUnderline htmlUnderlineItalic
+ HtmlHiLink htmlUnderlineBold htmlBoldUnderline
+
+ HtmlHiLink htmlLink Underlined
+
+ if !exists("html_my_rendering")
+ hi def htmlBold term=bold cterm=bold gui=bold
+ hi def htmlBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline
+ hi def htmlBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
+ hi def htmlBoldUnderlineItalic term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline
+ hi def htmlUnderline term=underline cterm=underline gui=underline
+ hi def htmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline
+ hi def htmlItalic term=italic cterm=italic gui=italic
+ endif
+
+ endif " !exists("html_no_rendering")
+
+ if version < 508
+ let did_html_syn_inits = 1
+ endif
+
+endif " version >= 508 || !exists("did_html_syn_inits")
+
+" Wiki highlighting
+
+HtmlHiLink wikiItalic htmlItalic
+HtmlHiLink wikiBold htmlBold
+HtmlHiLink wikiBoldItalic htmlBoldItalic
+HtmlHiLink wikiItalicBold htmlBoldItalic
+HtmlHiLink wikiBoldAndItalic htmlBoldItalic
+
+HtmlHiLink wikiH1 htmlTitle
+HtmlHiLink wikiH2 htmlTitle
+HtmlHiLink wikiH3 htmlTitle
+HtmlHiLink wikiH4 htmlTitle
+HtmlHiLink wikiH5 htmlTitle
+HtmlHiLink wikiH6 htmlTitle
+
+HtmlHiLink wikiLink htmlLink
+HtmlHiLink wikiTemplate htmlSpecial
+HtmlHiLink wikiParaFormatChar htmlSpecial
+HtmlHiLink wikiPre htmlConstant
+HtmlHiLink wikiRef htmlComment
+
+HtmlHiLink wikiSource wikiPre
+HtmlHiLink wikiSyntaxHL wikiPre
+
+
+let b:current_syntax = "html"
+
+delcommand HtmlHiLink
+
+if main_syntax == "html"
+ unlet main_syntax
+endif
+
+" vim: set et sts=2 sw=2:
--- /dev/null
+" puppet syntax file
+" Filename: puppet.vim
+" Language: puppet configuration file
+" Maintainer: Luke Kanies <luke@madstop.com>
+" URL:
+" Last Change:
+" Version:
+"
+
+" Copied from the cfengine, ruby, and perl syntax files
+" For version 5.x: Clear all syntax items
+" For version 6.x: Quit when a syntax file was already loaded
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+endif
+
+syn region puppetDefine start="^\s*\(class\|define\|site\|node\)" end="{" contains=puppetDefType,puppetDefName,puppetDefArguments
+syn keyword puppetDefType class define site node inherits contained
+syn keyword puppetInherits inherits contained
+syn region puppetDefArguments start="(" end=")" contains=puppetArgument
+syn match puppetArgument "\w\+" contained
+syn match puppetArgument "\$\w\+" contained
+syn match puppetArgument "'[^']+'" contained
+syn match puppetArgument '"[^"]+"' contained
+syn match puppetDefName "\w\+" contained
+
+syn match puppetInstance "\w\+\s*{" contains=puppetTypeBrace,puppetTypeName,puppetTypeDefault
+syn match puppetTypeBrace "{" contained
+syn match puppetTypeName "[a-z]\w*" contained
+syn match puppetTypeDefault "[A-Z]\w*" contained
+
+syn match puppetParam "\w\+\s*=>" contains=puppetTypeRArrow,puppetParamName
+syn match puppetParamRArrow "=>" contained
+syn match puppetParamName "\w\+" contained
+syn match puppetVariable "$\w\+"
+syn match puppetVariable "${\w\+}"
+syn match puppetParen "("
+syn match puppetParen ")"
+syn match puppetBrace "{"
+syn match puppetBrace "}"
+
+syn region puppetString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=puppetVariable
+
+syn keyword puppetBoolean true false
+syn keyword puppetKeyword import inherits include
+syn keyword puppetControl case default
+
+" comments last overriding everything else
+syn match puppetComment "\s*#.*$" contains=puppetTodo
+syn keyword puppetTodo TODO NOTE FIXME XXX contained
+
+" Define the default highlighting.
+" For version 5.7 and earlier: only when not done already
+" For version 5.8 and later: only when an item doesn't have highlighting yet
+if version >= 508 || !exists("did_puppet_syn_inits")
+ if version < 508
+ let did_puppet_syn_inits = 1
+ command -nargs=+ HiLink hi link <args>
+ else
+ command -nargs=+ HiLink hi def link <args>
+ endif
+
+ HiLink puppetVariable Identifier
+ HiLink puppetBoolean Boolean
+ HiLink puppetType Identifier
+ HiLink puppetDefault Identifier
+ HiLink puppetKeyword Define
+ HiLink puppetTypeDefs Define
+ HiLink puppetComment Comment
+ HiLink puppetString String
+ HiLink puppetTodo Todo
+" HiLink puppetBrace Delimiter
+" HiLink puppetTypeBrace Delimiter
+" HiLink puppetParen Delimiter
+ HiLink puppetDelimiter Delimiter
+ HiLink puppetControl Statement
+ HiLink puppetDefType Define
+ HiLink puppetDefName Type
+ HiLink puppetTypeName Statement
+ HiLink puppetTypeDefault Type
+ HiLink puppetParamName Identifier
+ HiLink puppetArgument Identifier
+
+ delcommand HiLink
+endif
+
+let b:current_syntax = "puppet"
--- /dev/null
+" Vim syntax file
+" Language: TeX
+" Maintainer: Dr. Charles E. Campbell, Jr. <NdrchipO@ScampbellPfamily.AbizM>
+" Last Change: Feb 27, 2007
+" Version: 37
+" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax
+"
+" Notes: {{{1
+"
+" 1. If you have a \begin{verbatim} that appears to overrun its boundaries,
+" use %stopzone.
+"
+" 2. Run-on equations ($..$ and $$..$$, particularly) can also be stopped
+" by suitable use of %stopzone.
+"
+" 3. If you have a slow computer, you may wish to modify
+"
+" syn sync maxlines=200
+" syn sync minlines=50
+"
+" to values that are more to your liking.
+"
+" 4. There is no match-syncing for $...$ and $$...$$; hence large
+" equation blocks constructed that way may exhibit syncing problems.
+" (there's no difference between begin/end patterns)
+"
+" 5. If you have the variable "g:tex_no_error" defined then none of the
+" lexical error-checking will be done.
+"
+" ie. let g:tex_no_error=1
+
+" Version Clears: {{{1
+" For version 5.x: Clear all syntax items
+" For version 6.x: Quit when a syntax file was already loaded
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+endif
+
+" Define the default highlighting. {{{1
+" For version 5.7 and earlier: only when not done already
+" For version 5.8 and later: only when an item doesn't have highlighting yet
+if version >= 508 || !exists("did_tex_syntax_inits")
+ let did_tex_syntax_inits = 1
+ if version < 508
+ command -nargs=+ HiLink hi link <args>
+ else
+ command -nargs=+ HiLink hi def link <args>
+ endif
+endif
+if exists("g:tex_tex") && !exists("g:tex_no_error")
+ let g:tex_no_error= 1
+endif
+
+" Determine whether or not to use "*.sty" mode {{{1
+" The user may override the normal determination by setting
+" g:tex_stylish to 1 (for "*.sty" mode)
+" or to 0 else (normal "*.tex" mode)
+" or on a buffer-by-buffer basis with b:tex_stylish
+let b:extfname=expand("%:e")
+if exists("g:tex_stylish")
+ let b:tex_stylish= g:tex_stylish
+elseif !exists("b:tex_stylish")
+ if b:extfname == "sty" || b:extfname == "cls" || b:extfname == "clo" || b:extfname == "dtx" || b:extfname == "ltx"
+ let b:tex_stylish= 1
+ else
+ let b:tex_stylish= 0
+ endif
+endif
+
+" handle folding {{{1
+if !exists("g:tex_fold_enabled")
+ let g:tex_fold_enabled= 0
+elseif g:tex_fold_enabled && !has("folding")
+ let g:tex_fold_enabled= 0
+ echomsg "Ignoring g:tex_fold_enabled=".g:tex_fold_enabled."; need to re-compile vim for +fold support"
+endif
+if g:tex_fold_enabled && &fdm == "manual"
+ set fdm=syntax
+endif
+
+" (La)TeX keywords: only use the letters a-zA-Z {{{1
+" but _ is the only one that causes problems.
+if version < 600
+ set isk-=_
+ if b:tex_stylish
+ set isk+=@
+ endif
+else
+ setlocal isk-=_
+ if b:tex_stylish
+ setlocal isk+=@
+ endif
+endif
+
+" Clusters: {{{1
+" --------
+syn cluster texCmdGroup contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSectionMarker,texSectionName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texURLZone,texAcroZone
+if !exists("g:tex_no_error")
+ syn cluster texCmdGroup add=texMathError
+endif
+syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement
+syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texSectionMarker,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texURLZone,texAcroZone
+syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texURLZone,texAcroZone,@Spell
+syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter
+if !exists("tex_no_math")
+ syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ
+ syn cluster texMatchGroup add=@texMathZones
+ syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2
+ syn cluster texMathMatchGroup contains=@texMathZones,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathMatcher,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone
+ syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle
+ if !exists("g:tex_no_error")
+ syn cluster texMathMatchGroup add=texMathError
+ syn cluster texMathZoneGroup add=texMathError
+ endif
+ syn cluster texMathZoneGroup add=@NoSpell
+ " following used in the \part \chapter \section \subsection \subsubsection
+ " \paragraph \subparagraph \author \title highlighting
+ syn cluster texDocGroup contains=texPartZone,@texPartGroup
+ syn cluster texPartGroup contains=texChapterZone,texSectionZone,texParaZone
+ syn cluster texChapterGroup contains=texSectionZone,texParaZone
+ syn cluster texSectionGroup contains=texSubSectionZone,texParaZone
+ syn cluster texSubSectionGroup contains=texSubSubSectionZone,texParaZone
+ syn cluster texSubSubSectionGroup contains=texParaZone
+ syn cluster texParaGroup contains=texSubParaZone
+endif
+syn cluster texURLGroup contains=texMatcher,@NoSpell
+syn cluster texAcroGroup contains=texMatcher,@NoSpell
+
+" Try to flag {} and () mismatches: {{{1
+if !exists("g:tex_no_error")
+ syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup,texError
+ syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup,texError
+else
+ syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup
+ syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup
+endif
+syn region texParen start="(" end=")" contains=@texMatchGroup,@Spell
+if !exists("g:tex_no_error")
+ syn match texError "[}\])]"
+endif
+if !exists("tex_no_math")
+ if !exists("g:tex_no_error")
+ syn match texMathError "}" contained
+ endif
+ syn region texMathMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup
+endif
+
+" TeX/LaTeX keywords: {{{1
+" Instead of trying to be All Knowing, I just match \..alphameric..
+" Note that *.tex files may not have "@" in their \commands
+if exists("g:tex_tex") || b:tex_stylish
+ syn match texStatement "\\[a-zA-Z@]\+"
+else
+ syn match texStatement "\\\a\+"
+ if !exists("g:tex_no_error")
+ syn match texError "\\\a*@[a-zA-Z@]*"
+ endif
+endif
+
+" TeX/LaTeX delimiters: {{{1
+syn match texDelimiter "&"
+syn match texDelimiter "\\\\"
+
+" Tex/Latex Options: {{{1
+syn match texOption "[^\\]\zs#\d\+\|^#\d\+"
+
+" texAccent (tnx to Karim Belabas) avoids annoying highlighting for accents: {{{1
+if b:tex_stylish
+ syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1
+ syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
+else
+ syn match texAccent "\\[bcdvuH]\A"me=e-1
+ syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)\A"me=e-1
+endif
+syn match texAccent "\\[bcdvuH]$"
+syn match texAccent +\\[=^.\~"`']+
+syn match texAccent +\\['=t'.c^ud"vb~Hr]{\a}+
+syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$"
+
+" \begin{}/\end{} section markers: {{{1
+syn match texSectionMarker "\\begin\>\|\\end\>" nextgroup=texSectionName
+syn region texSectionName matchgroup=Delimiter start="{" end="}" contained nextgroup=texSectionModifier
+syn region texSectionModifier matchgroup=Delimiter start="\[" end="]" contained
+
+" \documentclass, \documentstyle, \usepackage: {{{1
+syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texSectionName,texDocTypeArgs
+syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texSectionName
+
+" Preamble syntax-based folding support: {{{1
+if g:tex_fold_enabled && has("folding")
+ syn region texPreamble transparent fold start='\zs\\documentclass\>' end='\ze\\begin{document}' contains=@texMatchGroup
+endif
+
+" TeX input: {{{1
+syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatement
+syn match texInputFile "\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}" contains=texStatement,texInputCurlies
+syn match texInputFile "\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt
+syn match texInputCurlies "[{}]" contained
+syn region texInputFileOpt matchgroup=Delimiter start="\[" end="\]" contained
+
+" Type Styles (LaTeX 2.09): {{{1
+syn match texTypeStyle "\\rm\>"
+syn match texTypeStyle "\\em\>"
+syn match texTypeStyle "\\bf\>"
+syn match texTypeStyle "\\it\>"
+syn match texTypeStyle "\\sl\>"
+syn match texTypeStyle "\\sf\>"
+syn match texTypeStyle "\\sc\>"
+syn match texTypeStyle "\\tt\>"
+
+" Type Styles: attributes, commands, families, etc (LaTeX2E): {{{1
+syn match texTypeStyle "\\textbf\>"
+syn match texTypeStyle "\\textit\>"
+syn match texTypeStyle "\\textmd\>"
+syn match texTypeStyle "\\textrm\>"
+syn match texTypeStyle "\\textsc\>"
+syn match texTypeStyle "\\textsf\>"
+syn match texTypeStyle "\\textsl\>"
+syn match texTypeStyle "\\texttt\>"
+syn match texTypeStyle "\\textup\>"
+syn match texTypeStyle "\\emph\>"
+
+syn match texTypeStyle "\\mathbb\>"
+syn match texTypeStyle "\\mathbf\>"
+syn match texTypeStyle "\\mathcal\>"
+syn match texTypeStyle "\\mathfrak\>"
+syn match texTypeStyle "\\mathit\>"
+syn match texTypeStyle "\\mathnormal\>"
+syn match texTypeStyle "\\mathrm\>"
+syn match texTypeStyle "\\mathsf\>"
+syn match texTypeStyle "\\mathtt\>"
+
+syn match texTypeStyle "\\rmfamily\>"
+syn match texTypeStyle "\\sffamily\>"
+syn match texTypeStyle "\\ttfamily\>"
+
+syn match texTypeStyle "\\itshape\>"
+syn match texTypeStyle "\\scshape\>"
+syn match texTypeStyle "\\slshape\>"
+syn match texTypeStyle "\\upshape\>"
+
+syn match texTypeStyle "\\bfseries\>"
+syn match texTypeStyle "\\mdseries\>"
+
+" Some type sizes: {{{1
+syn match texTypeSize "\\tiny\>"
+syn match texTypeSize "\\scriptsize\>"
+syn match texTypeSize "\\footnotesize\>"
+syn match texTypeSize "\\small\>"
+syn match texTypeSize "\\normalsize\>"
+syn match texTypeSize "\\large\>"
+syn match texTypeSize "\\Large\>"
+syn match texTypeSize "\\LARGE\>"
+syn match texTypeSize "\\huge\>"
+syn match texTypeSize "\\Huge\>"
+
+" Spacecodes (TeX'isms): {{{1
+" \mathcode`\^^@="2201 \delcode`\(="028300 \sfcode`\)=0 \uccode`X=`X \lccode`x=`x
+syn match texSpaceCode "\\\(math\|cat\|del\|lc\|sf\|uc\)code`"me=e-1 nextgroup=texSpaceCodeChar
+syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained
+
+" Sections, subsections, etc: {{{1
+if g:tex_fold_enabled && has("folding")
+ syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup,@Spell
+ syn region texPartZone matchgroup=texSection start='\\part\>' end='\n\ze\s*\\part\>' fold contains=@texFoldGroup,@texPartGroup,@Spell
+ syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\n\ze\s*\\chapter\>' fold contains=@texFoldGroup,@texChapterGroup,@Spell
+ syn region texSectionZone matchgroup=texSection start='\\section\>' end='\n\ze\s*\\section\>' fold contains=@texFoldGroup,@texSectionGroup,@Spell
+ syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\n\ze\s*\\subsection\>' fold contains=@texFoldGroup,@texSubSectionGroup,@Spell
+ syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\n\ze\s*\\subsubsection\>' fold contains=@texFoldGroup,@texSubSubSectionGroup,@Spell
+ syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\n\ze\s*\\paragraph\>' fold contains=@texFoldGroup,@texParaGroup,@Spell
+ syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\n\ze\s*\\subparagraph\>' fold contains=@texFoldGroup,@Spell
+ syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup,@Spell
+ syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup,@Spell
+else
+ syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell
+ syn region texPartZone matchgroup=texSection start='\\part\>' end='\n\ze\s*\\part\>' contains=@texFoldGroup,@texPartGroup,@Spell
+ syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\n\ze\s*\\chapter\>' contains=@texFoldGroup,@texChapterGroup,@Spell
+ syn region texSectionZone matchgroup=texSection start='\\section\>' end='\n\ze\s*\\section\>' contains=@texFoldGroup,@texSectionGroup,@Spell
+ syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\n\ze\s*\\subsection\>' contains=@texFoldGroup,@texSubSectionGroup,@Spell
+ syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\n\ze\s*\\subsubsection\>' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell
+ syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\n\ze\s*\\paragraph\>' contains=@texFoldGroup,@texParaGroup,@Spell
+ syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\n\ze\s*\\subparagraph\>' contains=@texFoldGroup,@Spell
+ syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell
+ syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell
+endif
+
+" Bad Math (mismatched): {{{1
+if !exists("tex_no_math")
+ syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|subequations\|smallmatrix\|xxalignat\)\s*}"
+ syn match texBadMath "\\end\s*{\s*\(align\|alignat\|displaymath\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\|xalignat\)\*\=\s*}"
+ syn match texBadMath "\\[\])]"
+endif
+
+" Math Zones: {{{1
+if !exists("tex_no_math")
+ " TexNewMathZone: function creates a mathzone with the given suffix and mathzone name. {{{2
+ " Starred forms are created if starform is true. Starred
+ " forms have syntax group and synchronization groups with a
+ " "S" appended. Handles: cluster, syntax, sync, and HiLink.
+ fun! TexNewMathZone(sfx,mathzone,starform)
+ let grpname = "texMathZone".a:sfx
+ let syncname = "texSyncMathZone".a:sfx
+ exe "syn cluster texMathZones add=".grpname
+ exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\s*}'."'".' keepend contains=@texMathZoneGroup'
+ exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
+ exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
+ exe 'HiLink '.grpname.' texMath'
+ if a:starform
+ let grpname = "texMathZone".a:sfx.'S'
+ let syncname = "texSyncMathZone".a:sfx.'S'
+ exe "syn cluster texMathZones add=".grpname
+ exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\*\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\*\s*}'."'".' keepend contains=@texMathZoneGroup'
+ exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
+ exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
+ exe 'HiLink '.grpname.' texMath'
+ endif
+ endfun
+
+ " Standard Math Zones: {{{2
+ call TexNewMathZone("A","align",1)
+ call TexNewMathZone("B","alignat",1)
+ call TexNewMathZone("C","displaymath",1)
+ call TexNewMathZone("D","eqnarray",1)
+ call TexNewMathZone("E","equation",1)
+ call TexNewMathZone("F","flalign",1)
+ call TexNewMathZone("G","gather",1)
+ call TexNewMathZone("H","math",1)
+ call TexNewMathZone("I","multline",1)
+ call TexNewMathZone("J","subequations",0)
+ call TexNewMathZone("K","xalignat",1)
+ call TexNewMathZone("L","xxalignat",0)
+
+ " Inline Math Zones: {{{2
+ syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup
+ syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup
+ syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup
+ syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup
+ syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup
+
+ syn match texMathOper "[_^=]" contained
+
+ " \left..something.. and \right..something.. support: {{{2
+ syn match texMathDelimBad contained "\S"
+ syn match texMathDelim contained "\\\(left\|right\|[bB]igg\=[lr]\)\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad
+ syn match texMathDelim contained "\\\(left\|right\)arrow\>\|\<\([aA]rrow\|brace\)\=vert\>"
+ syn match texMathDelim contained "\\lefteqn\>"
+ syn match texMathDelimSet2 contained "\\" nextgroup=texMathDelimKey,texMathDelimBad
+ syn match texMathDelimSet1 contained "[<>()[\]|/.]\|\\[{}|]"
+ syn keyword texMathDelimKey contained backslash lceil lVert rgroup uparrow
+ syn keyword texMathDelimKey contained downarrow lfloor rangle rmoustache Uparrow
+ syn keyword texMathDelimKey contained Downarrow lgroup rbrace rvert updownarrow
+ syn keyword texMathDelimKey contained langle lmoustache rceil rVert Updownarrow
+ syn keyword texMathDelimKey contained lbrace lvert rfloor
+endif
+
+" Special TeX characters ( \$ \& \% \# \{ \} \_ \S \P ) : {{{1
+syn match texSpecialChar "\\[$&%#{}_]"
+if b:tex_stylish
+ syn match texSpecialChar "\\[SP@][^a-zA-Z@]"me=e-1
+else
+ syn match texSpecialChar "\\[SP@]\A"me=e-1
+endif
+syn match texSpecialChar "\\\\"
+if !exists("tex_no_math")
+ syn match texOnlyMath "[_^]"
+endif
+syn match texSpecialChar "\^\^[0-9a-f]\{2}\|\^\^\S"
+
+" Comments: {{{1
+" Normal TeX LaTeX : %....
+" Documented TeX Format: ^^A... -and- leading %s (only)
+syn cluster texCommentGroup contains=texTodo,@NoSpell
+syn case ignore
+syn keyword texTodo contained combak fixme todo xxx
+syn case match
+if b:extfname == "dtx"
+ syn match texComment "\^\^A.*$" contains=@texCommentGroup
+ syn match texComment "^%\+" contains=@texCommentGroup
+else
+ if g:tex_fold_enabled
+ " allows syntax-folding of 2 or more contiguous comment lines
+ " single-line comments are not folded
+ syn match texComment "%.*$" contains=@texCommentGroup
+ syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' fold
+ else
+ syn match texComment "%.*$" contains=@texCommentGroup
+ endif
+endif
+
+" Separate lines used for verb` and verb# so that the end conditions {{{1
+" will appropriately terminate. Ideally vim would let me save a
+" character from the start pattern and re-use it in the end-pattern.
+syn region texZone start="\\begin{verbatim}" end="\\end{verbatim}\|%stopzone\>" contains=@Spell
+" listings package:
+syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>" contains=@Spell
+" moreverb package:
+syn region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>" contains=@Spell
+syn region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>" contains=@Spell
+syn region texZone start="\\begin{boxedverbatim}" end="\\end{boxedverbatim}\|%stopzone\>" contains=@Spell
+if version < 600
+ syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>"
+ syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>"
+else
+ if b:tex_stylish
+ syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>"
+ else
+ syn region texZone start="\\verb\*\=\z([^\ta-zA-Z]\)" end="\z1\|%stopzone\>"
+ endif
+endif
+
+" Tex Reference Zones: {{{1
+syn region texZone matchgroup=texStatement start="@samp{" end="}\|%stopzone\>" contains=@texRefGroup
+syn region texRefZone matchgroup=texStatement start="\\nocite{" end="}\|%stopzone\>" contains=@texRefGroup
+syn region texRefZone matchgroup=texStatement start="\\bibliography{" end="}\|%stopzone\>" contains=@texRefGroup
+syn region texRefZone matchgroup=texStatement start="\\label{" end="}\|%stopzone\>" contains=@texRefGroup
+syn region texRefZone matchgroup=texStatement start="\\\(page\|eq\)ref{" end="}\|%stopzone\>" contains=@texRefGroup
+syn region texRefZone matchgroup=texStatement start="\\v\=ref{" end="}\|%stopzone\>" contains=@texRefGroup
+syn match texRefZone '\\[cC]ite\%(\%(al\)\=\%([tp]\*\=\)\|num\|author\|year\|yearpar\|fullauthor\)\=' nextgroup=texRefOption,texCite
+syn match texRefZone '\\[cC]itetext' nextgroup=texRefOption,texFreeCite
+syn region texRefOption contained matchgroup=Delimiter start='\[' end=']' contains=@texRefGroup,texCite nextgroup=texRefOption,texCite
+syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup
+syn region texFreeCite contained matchgroup=Delimiter start="{"rs=s+1 skip="\\\\\|\\[{}]" matchgroup=Delimiter end="}" contains=@texMatchGroup
+
+" Handle newcommand, newenvironment : {{{1
+syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl
+syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texCmdArgs,texCmdBody skipwhite skipnl
+syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]" nextgroup=texCmdBody skipwhite skipnl
+syn region texCmdBody contained matchgroup=Delimiter start="{"rs=s+1 skip="\\\\\|\\[{}]" matchgroup=Delimiter end="}" contains=@texCmdGroup
+syn match texNewEnv "\\newenvironment\>" nextgroup=texEnvName skipwhite skipnl
+syn region texEnvName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvBgn skipwhite skipnl
+syn region texEnvBgn contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvEnd skipwhite skipnl contains=@texEnvGroup
+syn region texEnvEnd contained matchgroup=Delimiter start="{"rs=s+1 end="}" skipwhite skipnl contains=@texEnvGroup
+
+" Definitions/Commands: {{{1
+syn match texDefCmd "\\def\>" nextgroup=texDefName skipwhite skipnl
+if b:tex_stylish
+ syn match texDefName contained "\\[a-zA-Z@]\+" nextgroup=texDefParms,texCmdBody skipwhite skipnl
+ syn match texDefName contained "\\[^a-zA-Z@]" nextgroup=texDefParms,texCmdBody skipwhite skipnl
+else
+ syn match texDefName contained "\\\a\+" nextgroup=texDefParms,texCmdBody skipwhite skipnl
+ syn match texDefName contained "\\\A" nextgroup=texDefParms,texCmdBody skipwhite skipnl
+endif
+syn match texDefParms contained "#[^{]*" contains=texDefParm nextgroup=texCmdBody skipwhite skipnl
+syn match texDefParm contained "#\d\+"
+
+" Tex URL Zones: {{{1
+syn region texURLZone matchgroup=texURLZone start="\\\%(url\|href\){" end="}\|%stopzone\>" contains=@texURLGroup
+syn region texURLZone matchgroup=texURLZone start="\\burl\%(alt\)\={" end="}\|%stopzone\>" contains=@texURLGroup
+syn region texURLZone matchgroup=texURLZone start="\\\%(link\|email\){" end="}\|%stopzone\>" contains=@texURLGroup
+
+" Tex Acronym Zones: {{{1
+syn region texAcroZone matchgroup=texAcroZone start="\\ac\%(fi\|[fls]\=p\=\)\*\={" end="}\|%stopzone\>" contains=@texAcroGroup
+syn region texAcroZone matchgroup=texAcroZone start="\\ac\%(used\|[ls]u\*\=\){" end="}\|%stopzone\>" contains=@texAcroGroup
+
+" TeX Lengths: {{{1
+syn match texLength "\<\d\+\([.,]\d\+\)\=\s*\(true\)\=\s*\(bp\|cc\|cm\|dd\|em\|ex\|in\|mm\|pc\|pt\|sp\)\>"
+
+" TeX String Delimiters: {{{1
+syn match texString "\(``\|''\|,,\)"
+
+" LaTeX synchronization: {{{1
+syn sync maxlines=200
+syn sync minlines=50
+
+syn sync match texSyncStop groupthere NONE "%stopzone\>"
+
+" Synchronization: {{{1
+" The $..$ and $$..$$ make for impossible sync patterns
+" (one can't tell if a "$$" starts or stops a math zone by itself)
+" The following grouptheres coupled with minlines above
+" help improve the odds of good syncing.
+if !exists("tex_no_math")
+ syn sync match texSyncMathZoneA groupthere NONE "\\end{abstract}"
+ syn sync match texSyncMathZoneA groupthere NONE "\\end{center}"
+ syn sync match texSyncMathZoneA groupthere NONE "\\end{description}"
+ syn sync match texSyncMathZoneA groupthere NONE "\\end{enumerate}"
+ syn sync match texSyncMathZoneA groupthere NONE "\\end{itemize}"
+ syn sync match texSyncMathZoneA groupthere NONE "\\end{table}"
+ syn sync match texSyncMathZoneA groupthere NONE "\\end{tabular}"
+ syn sync match texSyncMathZoneA groupthere NONE "\\\(sub\)*section\>"
+endif
+
+" Highlighting: {{{1
+if did_tex_syntax_inits == 1
+ let did_tex_syntax_inits= 2
+ " TeX highlighting groups which should share similar highlighting
+ if !exists("g:tex_no_error")
+ if !exists("tex_no_math")
+ HiLink texBadMath texError
+ HiLink texMathDelimBad texError
+ HiLink texMathError texError
+ if !b:tex_stylish
+ HiLink texOnlyMath texError
+ endif
+ endif
+ HiLink texError Error
+ endif
+
+ HiLink texCite texRefZone
+ HiLink texDefCmd texDef
+ HiLink texDefName texDef
+ HiLink texDocType texCmdName
+ HiLink texDocTypeArgs texCmdArgs
+ HiLink texInputFileOpt texCmdArgs
+ HiLink texInputCurlies texDelimiter
+ HiLink texLigature texSpecialChar
+ if !exists("tex_no_math")
+ HiLink texMathDelimSet1 texMathDelim
+ HiLink texMathDelimSet2 texMathDelim
+ HiLink texMathDelimKey texMathDelim
+ HiLink texMathMatcher texMath
+ HiLink texMathZoneW texMath
+ HiLink texMathZoneX texMath
+ HiLink texMathZoneY texMath
+ HiLink texMathZoneZ texMath
+ endif
+ HiLink texSectionMarker texCmdName
+ HiLink texSectionName texSection
+ HiLink texSpaceCode texStatement
+ HiLink texTypeSize texType
+ HiLink texTypeStyle texType
+
+ " Basic TeX highlighting groups
+ HiLink texAcroZone Special
+ HiLink texCmdArgs Number
+ HiLink texCmdName Statement
+ HiLink texComment Comment
+ HiLink texDef Statement
+ HiLink texDefParm Special
+ HiLink texDelimiter Delimiter
+ HiLink texInput Special
+ HiLink texInputFile Special
+ HiLink texLength Number
+ HiLink texMath Special
+ HiLink texMathDelim Statement
+ HiLink texMathOper Operator
+ HiLink texNewCmd Statement
+ HiLink texNewEnv Statement
+ HiLink texOption Number
+ HiLink texRefZone Special
+ HiLink texSection PreCondit
+ HiLink texSpaceCodeChar Special
+ HiLink texSpecialChar SpecialChar
+ HiLink texStatement Statement
+ HiLink texString String
+ HiLink texTodo Todo
+ HiLink texType Type
+ HiLink texURLZone Special
+ HiLink texZone PreCondit
+
+ delcommand HiLink
+endif
+
+" Current Syntax: {{{1
+unlet b:extfname
+let b:current_syntax = "tex"
+" vim: ts=8 fdm=marker
--- /dev/null
+# This is an example configuration.
+# please see: http://napali.ch/vimplate
+
+# you can use $Config::opt instead command options:
+# -user=<user> -dir=<dir>
+$Config::opt = {
+ dir => '/home/madduck/templates',
+ user => 'madduck',
+};
+
+# we need $Config::user with the option -user=<name>
+$Config::user = {
+ madduck => {
+ firstname => 'Martin',
+ lastname => 'Krafft',
+ mail => 'mail@martin-krafft.net',
+ etc => '...',
+ },
+ otherUser => {
+ firstname => 'otherFirstname',
+ lastname => 'otherLastname',
+ mail => 'otherMail@example.org',
+ },
+};
+
+# use $Config::var for your own variables or subroutines
+$Config::var = {
+ yourArray => [ 'Perl', 'C', 'C++' ],
+ example => sub{ time },
+};
--- /dev/null
+" obtained from the output of :options, then postprocessed:
+" d2}
+" :%s/^ *[[:digit:]]\+/"""
+" qa
+" ma
+" wi<BS>\n<ESC>
+" /^\([^[:space:]"].*\)\?$/
+" k
+" :'a,.s/^/" /
+" /^[^[:space:]"]
+" O<ESC>
+" :%s,\n\n\n",\r\r"
+
+""" important
+
+" compatible
+" behave very Vi compatible (not advisable)
+" set cp nocp
+set nocp
+
+" cpoptions
+" list of flags to specify Vi compatibility
+" set cpo=aABceFs
+
+" insertmode
+" use Insert mode as the default mode
+" set noim im
+
+" paste
+" paste mode, insert typed text literally
+" set nopaste paste
+
+" pastetoggle
+" key sequence to toggle paste mode
+" set pt=
+set pt=<F2>
+
+" runtimepath
+" list of directories used for runtime files and plugins
+" set rtp=/home/madduck/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vimcurrent,/usr/share/vim/vimfiles/after,/home/madduck/.vim/after
+
+" helpfile
+" name of the main help file
+" set hf=/usr/share/vim/vimcurrent/doc/help.txt
+
+""" moving around, searching and patterns
+
+" whichwrap
+" list of flags specifying which commands wrap to another line
+" (local to window)
+" set ww=
+set ww=b,s,[,<,>,],~
+
+" startofline
+" many jump commands move the cursor to the first non-blank
+" character of a line
+" set sol nosol
+
+" paragraphs
+" nroff macro names that separate paragraphs
+" set para=IPLPPPQPP\ LIpplpipbp
+
+" sections
+" nroff macro names that separate sections
+" set sect=SHNHH\ HUnhsh
+
+" path
+" list of directory names used for file searching
+" (global or local to buffer)
+" set pa=.,/usr/include,,
+
+" cdpath
+" list of directory names used for :cd
+" set cd=,,
+
+" wrapscan
+" search commands wrap around the end of the buffer
+" set ws nows
+"set ws
+
+" incsearch
+" show match for partly typed search command
+" set nois is
+set is
+
+" magic
+" change the way backslashes are used in search patterns
+" set magic nomagic
+
+" ignorecase
+" ignore case when using a search pattern
+" set noic ic
+set ic
+
+" smartcase
+" override 'ignorecase' when pattern has upper case characters
+" set noscs scs
+set scs
+
+" casemap
+" What method to use for changing case of letters
+" set cmp=internal,keepascii
+
+" maxmempattern
+" maximum amount of memory in Kbyte used for pattern matching
+" set mmp=1000
+
+" define
+" pattern for a macro definition line
+" (global or local to buffer)
+" set def=^\\s*#\\s*define
+
+" include
+" pattern for an include-file line
+" (local to buffer)
+" set inc=^\\s*#\\s*include
+
+" includeexpr
+" expression used to transform an include line to a file name
+" (local to buffer)
+" set inex=
+
+""" tags
+
+" tagbsearch
+" use binary searching in tags files
+" set tbs notbs
+
+" taglength
+" number of significant characters in a tag name or zero
+" set tl=0
+
+" tags
+" list of file names to search for tags
+" (global or local to buffer)
+" set tag=./tags,./TAGS,tags,TAGS
+
+" tagrelative
+" file names in a tags file are relative to the tags file
+" set notr tr
+
+" tagstack
+" a :tag command will use the tagstack
+" set tgst notgst
+
+" showfulltag
+" when completing tags in Insert mode show more info
+" set nosft sft
+
+" cscopeprg
+" command for executing cscope
+" set csprg=cscope
+
+" cscopetag
+" use cscope for tag commands
+" set nocst cst
+
+" cscopetagorder
+" 0 or 1; the order in which ":cstag" performs a search
+" set csto=0
+
+" cscopeverbose
+" give messages when adding a cscope database
+" set nocsverb csverb
+
+" cscopepathcomp
+" how many components of the path to show
+" set cspc=0
+
+" cscopequickfix
+" When to open a quickfix window for cscope
+" set csqf=
+
+""" displaying text
+
+" scroll
+" number of lines to scroll for CTRL-U and CTRL-D
+" (local to window)
+" set scr=8
+
+" scrolloff
+" number of screen lines to show around the cursor
+" set so=0
+set so=5
+
+" wrap
+" long lines wrap
+" set wrap nowrap
+set nowrap
+
+" linebreak
+" wrap long lines at a character in 'breakat'
+" (local to window)
+" set nolbr lbr
+" does not work with autocmd set list/nolist below
+
+" breakat
+" which characters might cause a line break
+" set brk=\ \ !@*-+;:,./?
+
+" showbreak
+" string to put before wrapped screen lines
+" set sbr=
+
+" sidescroll
+" minimal number of columns to scroll horizontally
+" set ss=0
+
+" sidescrolloff
+" minimal number of columns to keep left and right of the cursor
+" set siso=0
+set siso=0
+
+" display
+" include "lastline" to show the last line even if it doesn't fit
+" include "uhex" to show unprintable characters as a hex number
+" set dy=
+set dy=lastline,uhex
+
+" fillchars
+" characters to use for the status line, folds and filler lines
+" set fcs=vert:\|,fold:-
+
+" cmdheight
+" number of lines used for the command-line
+" set ch=1
+
+" columns
+" width of the display
+" set co=80
+
+" lines
+" number of lines in the display
+" set lines=25
+
+" lazyredraw
+" don't redraw while executing macros
+" set nolz lz
+set lz
+
+" writedelay
+" delay in msec for each char written to the display
+" (for debugging)
+" set wd=0
+
+" list
+" show <Tab> as ^I and end-of-line as $
+" (local to window)
+" set nolist list
+set list
+
+" listchars
+" list of strings used for list mode
+" set lcs=eol:$
+set lcs=tab:⇝·,trail:·
+
+" number
+" show the line number for each line
+" (local to window)
+" set nonu nu
+
+" numberwidth
+" number of columns to use for the line number
+" (local to window)
+" set nuw=8
+
+""" syntax, highlighting and spelling
+
+" background
+" "dark" or "light"; the background color brightness
+" set bg=light
+
+" filetype
+" type of file; triggers the FileType event when set
+" (local to buffer)
+" set ft=
+
+" syntax
+" name of syntax highlighting used
+" (local to buffer)
+" set syn=
+
+" synmaxcol
+" maximum column to look for syntax items
+" (local to buffer)
+" set smc=3000
+
+" highlight
+" which highlighting to use for various occasions
+" set hl=8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine
+
+" hlsearch
+" highlight all matches for the last used search pattern
+" set nohls hls
+set hls
+
+" cursorcolumn
+" highlight the screen column of the cursor
+" (local to window)
+" set nocuc cuc
+
+" cursorline
+" highlight the screen line of the cursor
+" (local to window)
+" set nocul cul
+
+" spell
+" highlight spelling mistakes
+" (local to window)
+" set nospell spell
+
+" spelllang
+" list of accepted languages
+" (local to buffer)
+" set spl=en
+
+" spellfile
+" file that "zg" adds good words to
+" (local to buffer)
+" set spf=
+
+" spellcapcheck
+" pattern to locate the end of a sentence
+" (local to buffer)
+" set spc=[.?!]\\_[\\])'\"\ \ ]\\+
+set spc=
+
+" spellsuggest
+" methods used to suggest corrections
+" set sps=best
+
+" mkspellmem
+" amount of memory used by :mkspell before compressing
+" set msm=460000,2000,500
+
+""" multiple windows
+
+" laststatus
+" 0, 1 or 2; when to use a status line for the last window
+" set ls=1
+
+" statusline
+" alternate format to be used for a status line
+" set stl=
+
+" equalalways
+" make all windows the same size when adding/removing windows
+" set ea noea
+
+" eadirection
+" in which direction 'equalalways' works: "ver", "hor" or "both"
+" set ead=both
+
+" winheight
+" minimal number of lines used for the current window
+" set wh=1
+
+" winminheight
+" minimal number of lines used for any window
+" set wmh=1
+
+" winfixheight
+" keep the height of the window
+" (local to window)
+" set nowfh wfh
+
+" winfixwidth
+" keep the width of the window
+" (local to window)
+" set nowfw wfw
+
+" winwidth
+" minimal number of columns used for the current window
+" set wiw=20
+
+" winminwidth
+" minimal number of columns used for any window
+" set wmw=1
+
+" helpheight
+" initial height of the help window
+" set hh=20
+
+" previewheight
+" default height for the preview window
+" set pvh=12
+
+" previewwindow
+" identifies the preview window
+" (local to window)
+" set nopvw pvw
+
+" hidden
+" don't unload a buffer when no longer shown in a window
+" set nohid hid
+
+" switchbuf
+" "useopen" and/or "split"; which window to use when jumping
+" to a buffer
+" set swb=
+
+" splitbelow
+" a new window is put below the current one
+" set nosb sb
+
+" splitright
+" a new window is put right of the current one
+" set nospr spr
+
+" scrollbind
+" this window scrolls together with other bound windows
+" (local to window)
+" set noscb scb
+
+" scrollopt
+" "ver", "hor" and/or "jump"; list of options for 'scrollbind'
+" set sbo=ver,jump
+
+""" multiple tab pages
+
+" showtabline
+" 0, 1 or 2; when to use a tab pages line
+" set stal=1
+
+" tabpagemax
+" maximum number of tab pages to open for -p and "tab all"
+" set tpm=10
+
+" tabline
+" custom tab pages line
+" set tal=
+
+""" terminal
+
+" term
+" name of the used terminal
+" set term=rxvt-unicode
+
+" ttytype
+" alias for 'term'
+" set tty=rxvt-unicode
+
+" ttybuiltin
+" check built-in termcaps first
+" set tbi notbi
+
+" ttyfast
+" terminal connection is fast
+" set tf notf
+
+" weirdinvert
+" terminal that requires extra redrawing
+" set nowiv wiv
+
+" esckeys
+" recognize keys that start with <Esc> in Insert mode
+" set noek ek
+
+" scrolljump
+" minimal number of lines to scroll at a time
+" set sj=1
+
+" ttyscroll
+" maximum number of lines to use scrolling instead of redrawing
+" set tsl=999
+
+" title
+" show info in the window title
+" set notitle title
+set notitle
+
+" titlelen
+" percentage of 'columns' used for the window title
+" set titlelen=85
+
+" titlestring
+" when not empty, string to be used for the window title
+" set titlestring=
+
+" titleold
+" string to restore the title to when exiting Vim
+" set titleold=Thanks\ for\ flying\ Vim
+
+" icon
+" set the text of the icon for this window
+" set noicon icon
+
+" iconstring
+" when not empty, text for the icon of this window
+" set iconstring=
+
+""" using the mouse
+
+" mouse
+" list of flags for using the mouse
+" set mouse=
+
+" mousemodel
+" "extend", "popup" or "popup_setpos"; what the right
+" mouse button is used for
+" set mousem=extend
+
+" mousetime
+" maximum time in msec to recognize a double-click
+" set mouset=500
+
+" ttymouse
+" "xterm", "xterm2", "dec" or "netterm"; type of mouse
+" set ttym=xterm
+
+""" printing
+
+" printoptions
+" list of items that control the format of :hardcopy output
+" set popt=
+
+" printdevice
+" name of the printer to be used for :hardcopy
+" set pdev=
+
+" printexpr
+" expression used to print the PostScript file for :hardcopy
+" set pexpr=system('lpr'\ .\ (&printdevice\ ==\ ''\ ?\ ''\ :\ '\ -P'\ .\ &printdevice)\ .\ '\ '\ .\ v:fname_in)\ .\ delete(v:fname_in)\ +\ v:shell_error
+set pexpr=system('lp'\ .\ (&printdevice\ ==\ ''\ ?\ ''\ :\ '\ -d'\ .\ &printdevice)\ .\ '\ '\ .\ v:fname_in)\ .\ delete(v:fname_in)\ +\ v:shell_error
+
+" printfont
+" name of the font to be used for :hardcopy
+" set pfn=courier
+
+" printheader
+" format of the header used for :hardcopy
+" set pheader=%<%f%h%m%=Page\ %N
+
+" printencoding
+" encoding used to print the PostScript file for :hardcopy
+" set penc=
+
+" printmbcharset
+" the CJK character set to be used for CJK output from :hardcopy
+" set pmbcs=
+
+" printmbfont
+" list of font names to be used for CJK output from :hardcopy
+" set pmbfn=
+
+""" messages and info
+
+" terse
+" add 's' flag in 'shortmess' (don't show search message)
+" set noterse terse
+
+" shortmess
+" list of flags to make messages shorter
+" set shm=
+set shortmess=atTWoOI
+
+" showcmd
+" show (partial) command keys in the status line
+" set nosc sc
+
+" showmode
+" display the current mode in the status line
+" set nosmd smd
+
+" ruler
+" show cursor position below each window
+" set noru ru
+set ruler
+
+" rulerformat
+" alternate format to be used for the ruler
+" set ruf=%20(%=%-14(%l,%c%V%)\ %P%)
+
+" report
+" threshold for reporting number of changed lines
+" set report=2
+
+" verbose
+" the higher the more messages are given
+" set vbs=0
+
+" verbosefile
+" file to write messages in
+" set vfile=
+
+" more
+" pause listings when the screen is full
+" set nomore more
+
+" confirm
+" start a dialog when a command fails
+" set nocf cf
+
+" errorbells
+" ring the bell for error messages
+" set noeb eb
+
+" visualbell
+" use a visual bell instead of beeping
+" set novb vb
+
+" helplang
+" list of preferred languages for finding help
+" set hlg=en
+
+""" selecting text
+
+" selection
+" "old", "inclusive" or "exclusive"; how selecting text behaves
+" set sel=inclusive
+
+" selectmode
+" "mouse", "key" and/or "cmd"; when to start Select mode
+" instead of Visual mode
+" set slm=
+
+" keymodel
+" "startsel" and/or "stopsel"; what special keys can do
+" set km=
+
+""" editing text
+
+" undolevels
+" maximum number of changes that can be undone
+" set ul=1000
+
+" modified
+" changes have been made and not written to a file
+" (local to buffer)
+" set nomod mod
+
+" readonly
+" buffer is not to be written
+" (local to buffer)
+" set noro ro
+
+" modifiable
+" changes to the text are not possible
+" (local to buffer)
+" set ma noma
+
+" textwidth
+" line length above which to break a line
+" (local to buffer)
+" set tw=0
+set tw=78
+
+" wrapmargin
+" margin from the right in which to break a line
+" (local to buffer)
+" set wm=0
+
+" backspace
+" specifies what <BS>, CTRL-W, etc. can do in Insert mode
+" set bs=
+set bs=indent,eol,start
+
+" comments
+" definition of what comment lines look like
+" (local to buffer)
+" set com=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
+
+" formatoptions
+" list of flags that tell how automatic formatting works
+" (local to buffer)
+" set fo=vt
+set fo=tcroqn1l
+
+" formatlistpat
+" pattern to recognize a numbered list
+" (local to buffer)
+" set flp=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
+let &flp='^\v\s*(((\a|\d{,4})[]:.)}/])+|[-\*.·→+])\s+'
+
+" formatexpr
+" expression used for "gq" to format lines
+" (local to buffer)
+" set fex=
+
+" complete
+" specifies how Insert mode completion works for CTRL-N and CTRL-P
+" (local to buffer)
+" set cpt=.,w,b,u,t,i
+
+" completeopt
+" whether to use a popup menu for Insert mode completion
+" set cot=menu,preview
+
+" pumheight
+" maximum height of the popup menu
+" set ph=0
+
+" completefunc
+" user defined function for Insert mode completion
+" (local to buffer)
+" set cfu=
+
+" omnifunc
+" function for filetype-specific Insert mode completion
+" (local to buffer)
+" set ofu=
+
+" dictionary
+" list of dictionary files for keyword completion
+" (global or local to buffer)
+" set dict=
+
+" thesaurus
+" list of thesaurus files for keyword completion
+" (global or local to buffer)
+" set tsr=
+
+" infercase
+" adjust case of a keyword completion match
+" (local to buffer)
+" set noinf inf
+set inf
+
+" digraph
+" enable entering digraps with c1 <BS> c2
+" set nodg dg
+"set dg
+
+" tildeop
+" the "~" command behaves like an operator
+" set notop top
+"set tildeop
+
+" operatorfunc
+" function called for the"g@" operator
+" set opfunc=
+
+" showmatch
+" When inserting a bracket, briefly jump to its match
+" set nosm sm
+
+" matchtime
+" tenth of a second to show a match for 'showmatch'
+" set mat=5
+
+" matchpairs
+" list of pairs that match for the "%" command
+" (local to buffer)
+" set mps=(:),{:},[:]
+
+" joinspaces
+" use two spaces after '.' when joining a line
+" set js nojs
+set nojs
+
+" nrformats
+" "alpha", "octal" and/or "hex"; number formats recognized for
+" CTRL-A and CTRL-X commands
+" (local to buffer)
+" set nf=octal,hex
+
+""" tabs and indenting
+
+" tabstop
+" number of spaces a <Tab> in the text stands for
+" (local to buffer)
+" set ts=8
+"
+" You could set the 'tabstop' option to 2. However, if you edit the file
+" another time, with 'tabstop' set to the default value of 8, it will look
+" wrong. In other programs and when printing the indent will also be
+" wrong. Therefore it is recommended to keep 'tabstop' at eight all the
+" time. That's the standard value everywhere.
+"
+"set ts=2
+
+" shiftwidth
+" number of spaces used for each step of (auto)indent
+" (local to buffer)
+" set sw=8
+set sw=2
+
+" smarttab
+" a <Tab> in an indent inserts 'shiftwidth' spaces
+" set nosta sta
+set sta
+
+" softtabstop
+" if non-zero, number of spaces to insert for a <Tab>
+" (local to buffer)
+" set sts=0
+set sts=2
+
+" shiftround
+" round to 'shiftwidth' for "<<" and ">>"
+" set nosr sr
+set sr
+
+" expandtab
+" expand <Tab> to spaces in Insert mode
+" (local to buffer)
+" set noet et
+set et
+
+" autoindent
+" automatically set the indent of a new line
+" (local to buffer)
+" set noai ai
+set ai
+
+" smartindent
+" do clever autoindenting
+" (local to buffer)
+" set nosi si
+
+" cindent
+" enable specific indenting for C code
+" (local to buffer)
+" set nocin cin
+
+" cinoptions
+" options for C-indenting
+" (local to buffer)
+" set cino=
+
+" cinkeys
+" keys that trigger C-indenting in Insert mode
+" (local to buffer)
+" set cink=0{,0},0),:,0#,!^F,o,O,e
+
+" cinwords
+" list of words that cause more C-indent
+" (local to buffer)
+" set cinw=if,else,while,do,for,switch
+
+" indentexpr
+" expression used to obtain the indent of a line
+" (local to buffer)
+" set inde=
+
+" indentkeys
+" keys that trigger indenting with 'indentexpr' in Insert mode
+" (local to buffer)
+" set indk=0{,0},:,0#,!^F,o,O,e
+
+" copyindent
+" Copy whitespace for indenting from previous line
+" (local to buffer)
+" set noci ci
+set ci
+
+" preserveindent
+" Preserve kind of whitespace when changing indent
+" (local to buffer)
+" set nopi pi
+""" set pi this ABORTS < 1:7.1-135+1 (see #446268)
+if has('patch073')
+ set pi
+endif
+
+" lisp
+" enable lisp mode
+" (local to buffer)
+" set nolisp lisp
+
+" lispwords
+" words that change how lisp indenting works
+" set lw=defun,define,defmacro,set!,lambda,if,case,let,flet,let*,letrec,do,do*,define-syntax,let-syntax,letrec-syntax,destructuring-bind,defpackage,defparameter,defstruct,deftype,defvar,do-all-symbols,do-external-symbols,do-symbols,dolist,dotimes,ecase,etypecase,eval-when,labels,macrolet,multiple-value-bind,multiple-value-call,multiple-value-prog1,multiple-value-setq,prog1,progv,typecase,unless,unwind-protect,when,with-input-from-string,with-open-file,with-open-stream,with-output-to-string,with-package-iterator,define-condition,handler-bind,handler-case,restart-bind,restart-case,with-simple-restart,store-value,use-value,muffle-warning,abort,continue,with-slots,with-slots*,with-accessors,with-accessors*,defclass,defmethod,print-unreadable-object
+
+""" folding
+
+" foldenable
+" set to display all folds open
+" (local to window)
+" set fen nofen
+
+" foldlevel
+" folds with a level higher than this number will be closed
+" (local to window)
+" set fdl=0
+
+" foldlevelstart
+" value for 'foldlevel' when starting to edit a file
+" set fdls=-1
+
+" foldcolumn
+" width of the column used to indicate folds
+" (local to window)
+" set fdc=0
+
+" foldtext
+" expression used to display the text of a closed fold
+" (local to window)
+" set fdt=foldtext()
+
+" foldclose
+" set to "all" to close a fold when the cursor leaves it
+" set fcl=
+
+" foldopen
+" specifies for which commands a fold will be opened
+" set fdo=block,hor,mark,percent,quickfix,search,tag,undo
+
+" foldminlines
+" minimum number of screen lines for a fold to be closed
+" (local to window)
+" set fml=1
+
+" commentstring
+" template for comments; used to put the marker in
+" set cms=/*%s*/
+
+" foldmethod
+" folding type: "manual", "indent", "expr", "marker" or "syntax"
+" (local to window)
+" set fdm=manual
+set fdm=marker
+
+" foldexpr
+" expression used when 'foldmethod' is "expr"
+" (local to window)
+" set fde=0
+
+" foldignore
+" used to ignore lines when 'foldmethod' is "indent"
+" (local to window)
+" set fdi=#
+
+" foldmarker
+" markers used when 'foldmethod' is "marker"
+" (local to window)
+" set fmr={{{,}}}
+
+" foldnestmax
+" maximum fold depth for when 'foldmethod is "indent" or "syntax"
+" (local to window)
+" set fdn=20
+
+""" diff mode
+
+" diff
+" use diff mode for the current window
+" (local to window)
+" set nodiff diff
+
+" diffopt
+" options for using diff mode
+" set dip=filler
+
+" diffexpr
+" expression used to obtain a diff file
+" set dex=
+
+" patchexpr
+" expression used to patch a file
+" set pex=
+
+""" mapping
+
+" maxmapdepth
+" maximum depth of mapping
+" set mmd=1000
+
+" remap
+" recognize mappings in mapped keys
+" set remap noremap
+
+" timeout
+" allow timing out halfway into a mapping
+" set to noto
+
+" ttimeout
+" allow timing out halfway into a key code
+" set nottimeout ttimeout
+
+" timeoutlen
+" time in msec for 'timeout'
+" set tm=1000
+
+" ttimeoutlen
+" time in msec for 'ttimeout'
+" set ttm=-1
+
+""" reading and writing files
+
+" modeline
+" enable using settings from modelines when reading a file
+" (local to buffer)
+" set noml ml
+set ml
+
+" modelines
+" number of lines to check for modelines
+" set mls=5
+
+" binary
+" binary file editing
+" (local to buffer)
+" set nobin bin
+
+" endofline
+" last line in the file has an end-of-line
+" (local to buffer)
+" set eol noeol
+
+" bomb
+" Prepend a Byte Order Mark to the file
+" (local to buffer)
+" set nobomb bomb
+
+" fileformat
+" end-of-line format: "dos", "unix" or "mac"
+" (local to buffer)
+" set ff=unix
+
+" fileformats
+" list of file formats to look for when editing a file
+" set ffs=
+
+" textmode
+" obsolete, use 'fileformat'
+" (local to buffer)
+" set notx tx
+
+" textauto
+" obsolete, use 'fileformats'
+" set nota ta
+
+" write
+" writing files is allowed
+" set write nowrite
+
+" writebackup
+" write a backup file before overwriting a file
+" set wb nowb
+
+" backup
+" keep a backup after overwriting a file
+" set nobk bk
+
+" backupskip
+" patterns that specify for which files a backup is not made
+" set bsk=/tmp/*
+
+" backupcopy
+" whether to make the backup as a copy or rename the existing file
+" set bkc=yes
+
+" backupdir
+" list of directories to put backup files in
+" set bdir=.,/home/madduck/tmp,/home/madduck/
+
+" backupext
+" file name extension for the backup file
+" set bex=~
+
+" autowrite
+" automatically write a file when leaving a modified buffer
+" set noaw aw
+set aw
+
+" autowriteall
+" as 'autowrite', but works with more commands
+" set noawa awa
+set awa
+
+" writeany
+" always write without asking for confirmation
+" set nowa wa
+
+" autoread
+" automatically read a file when it was modified outside of Vim
+" (global or local to buffer)
+" set noar ar
+set ar
+
+" patchmode
+" keep oldest version of a file; specifies file name extension
+" set pm=
+
+" fsync
+" forcibly sync the file to disk after writing it
+" set fs nofs
+
+" shortname
+" use 8.3 file names
+" (local to buffer)
+" set nosn sn
+
+""" the swap file
+
+" directory
+" list of directories for the swap file
+" set dir=.,/home/madduck/tmp,/var/tmp,/tmp
+set dir=.,$TMPDIR//,/var/tmp//,/tmp//
+
+" swapfile
+" use a swap file for this buffer
+" (local to buffer)
+" set swf noswf
+
+" swapsync
+" "sync", "fsync" or empty; how to flush a swap file to disk
+" set sws=fsync
+set sws=
+
+" updatecount
+" number of characters typed to cause a swap file update
+" set uc=200
+
+" updatetime
+" time in msec after which the swap file will be updated
+" set ut=4000
+set ut=10000
+
+" maxmem
+" maximum amount of memory in Kbyte used for one buffer
+" set mm=1030480
+
+" maxmemtot
+" maximum amount of memory in Kbyte used for all buffers
+" set mmt=1030480
+
+""" command line editing
+
+" history
+" how many command lines are remembered
+" set hi=0
+set hi=100
+
+" wildchar
+" key that triggers command-line expansion
+" set wc=5
+
+" wildcharm
+" like 'wildchar' but can also be used in a mapping
+" set wcm=0
+
+" wildmode
+" specifies how command line completion works
+" set wim=full
+set wim=list:full
+
+" suffixes
+" list of file name extensions that have a lower priority
+" set su=.bak,~,.o,.h,.info,.swp,.obj
+
+" suffixesadd
+" list of file name extensions added when searching for a file
+" (local to buffer)
+" set sua=
+
+" wildignore
+" list of patterns to ignore files for file name completion
+" set wig=
+set wig=*.o,*.pyc,*.pyo,*~,*.bk,*.bak
+
+" wildmenu
+" command-line completion shows a list of matches
+" set nowmnu wmnu
+
+" cedit
+" key used to open the command-line window
+" set cedit=
+
+" cmdwinheight
+" height of the command-line window
+" set cwh=7
+
+""" executing external commands
+
+" shell
+" name of the shell program used for external commands
+" set sh=/bin/zsh
+
+" shellquote
+" character(s) to enclose a shell command in
+" set shq=
+
+" shellxquote
+" like 'shellquote' but include the redirection
+" set sxq=
+
+" shellcmdflag
+" argument for 'shell' to execute a command
+" set shcf=-c
+
+" shellredir
+" used to redirect command output to a file
+" set srr=>%s\ 2>&1
+
+" shelltemp
+" use a temp file for shell commands instead of using a pipe
+" set nostmp stmp
+
+" equalprg
+" program used for "=" command
+" (global or local to buffer)
+" set ep=
+
+" formatprg
+" program used to format lines with "gq" command
+" set fp=
+
+" keywordprg
+" program used for the "K" command
+" set kp=man
+
+" warn
+" warn when using a shell command and a buffer has changes
+" set warn nowarn
+set warn
+
+""" running make and jumping to errors
+
+" errorfile
+" name of the file that contains error messages
+" set ef=errors.err
+
+" errorformat
+" list of formats for error messages
+" (global or local to buffer)
+" set efm=%*[^\"]\"%f\"%*\\D%l:\ %m,\"%f\"%*\\D%l:\ %m,%-G%f:%l:\ (Each\ undeclared\ identifier\ is\ reported\ only\ once,%-G%f:%l:\ for\ each\ function\ it\ appears\ in.),%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\,\ line\ %l%*\\D%c%*[^\ ]\ %m,%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f',%D%*\\a:\ Entering\ directory\ `%f',%X%*\\a:\ Leaving\ directory\ `%f',%DMaking\ %*\\a\ in\ %f,%f\|%l\|\ %m
+
+" makeprg
+" program used for the ":make" command
+" (global or local to buffer)
+" set mp=make
+
+" shellpipe
+" string used to put the output of ":make" in the error file
+" set sp=2>&1\|\ tee
+
+" makeef
+" name of the errorfile for the 'makeprg' command
+" set mef=
+
+" grepprg
+" program used for the ":grep" command
+" (global or local to buffer)
+" set gp=grep\ -n\ $*\ /dev/null
+
+" grepformat
+" list of formats for output of 'grepprg'
+" set gfm=%f:%l:%m,%f:%l%m,%f\ \ %l%m
+
+""" language specific
+
+" isfname
+" specifies the characters in a file name
+" set isf=@,48-57,/,.,-,_,+,,,#,$,%,~,=
+
+" isident
+" specifies the characters in an identifier
+" set isi=@,48-57,_,192-255
+
+" iskeyword
+" specifies the characters in a keyword
+" (local to buffer)
+" set isk=@,48-57,_
+
+" isprint
+" specifies printable characters
+" set isp=@,161-255
+
+" quoteescape
+" specifies escape characters in a string
+" (local to buffer)
+" set qe=\\
+
+" rightleft
+" display the buffer right-to-left
+" (local to window)
+" set norl rl
+
+" rightleftcmd
+" When to edit the command-line right-to-left
+" (local to window)
+" set rlc=search
+
+" revins
+" Insert characters backwards
+" set nori ri
+
+" allowrevins
+" Allow CTRL-_ in Insert and Command-line mode to toggle 'revins'
+" set noari ari
+
+" aleph
+" the ASCII code for the first letter of the Hebrew alphabet
+" set al=224
+
+" hkmap
+" use Hebrew keyboard mapping
+" set nohk hk
+
+" hkmapp
+" use phonetic Hebrew keyboard mapping
+" set nohkp hkp
+
+" altkeymap
+" use Farsi as the second language when 'revins' is set
+" set noakm akm
+
+" fkmap
+" use Farsi keyboard mapping
+" set nofk fk
+
+" arabic
+" Prepare for editing Arabic text
+" (local to window)
+" set noarab arab
+
+" arabicshape
+" Perform shaping of Arabic characters
+" set noarshape noarshape
+
+" termbidi
+" Terminal will perform bidi handling
+" set notbidi tbidi
+
+" keymap
+" name of a keyboard mappping
+" set kmp=
+
+" langmap
+" translate characters for Normal mode
+" set lmap=
+
+" iminsert
+" in Insert mode: 1: use :lmap; 2: use IM; 0: neither
+" (local to window)
+" set imi=0
+
+" imsearch
+" entering a search pattern: 1: use :lmap; 2: use IM; 0: neither
+" (local to window)
+" set ims=0
+
+""" multi-byte characters
+
+" encoding
+" character encoding used in Vim: "latin1", "utf-8"
+" "euc-jp", "big5", etc.
+" set enc=utf-8
+
+" fileencoding
+" character encoding for the current file
+" (local to buffer)
+" set fenc=utf-8
+
+" fileencodings
+" automatically detected character encodings
+" set fencs=ucs-bom,utf-8,default,latin1
+
+" termencoding
+" character encoding used by the terminal
+" set tenc=
+
+" charconvert expression
+" used for character encoding conversion
+" set ccv=
+
+" delcombine
+" Delete combining (composing) characters on their own
+" set nodeco deco
+
+" maxcombine
+" Maximum number of combining (composing) characters displayed
+" set mco=2
+
+" ambiwidth
+" Width of ambiguous width characters
+" set ambw=single
+
+""" various
+
+" virtualedit
+" when to use virtual editing: "block", "insert" and/or "all"
+" set ve=
+
+" eventignore
+" list of autocommand events which are to be ignored
+" set ei=
+
+" loadplugins
+" load plugin scripts when starting up
+" set nolpl lpl
+set lpl
+
+" exrc
+" enable reading .vimrc/.exrc/.gvimrc in the current directory
+" set noex ex
+
+" secure
+" safer working with script files in the current directory
+" set nosecure secure
+set secure
+
+" gdefault
+" use the 'g' flag for ":substitute"
+" set nogd gd
+
+" edcompatible
+" 'g' and 'c' flags of ":substitute" toggle
+" set noed ed
+
+" maxfuncdepth
+" maximum depth of function calls
+" set mfd=100
+
+" sessionoptions
+" list of words that specifies what to put in a session file
+" set ssop=blank,buffers,curdir,folds,help,options,tabpages,winsize
+
+" viewoptions
+" list of words that specifies what to save for :mkview
+" set vop=folds,options,cursor
+
+" viewdir
+" directory where to store files with :mkview
+" set vdir=/home/madduck/.vim/view
+set vdir=$VARDIR/vim/view
+
+" viminfo
+" list that specifies what to write in the viminfo file
+" set vi=
+set vi=<1000,'1000,\"1000,:100,/100,@100,f1,%,!,h,n$VARDIR/vim/viminfo
+
+" bufhidden
+" what happens with a buffer when it's no longer in a window
+" (local to buffer)
+" set bh=
+
+" buftype
+" "", "nofile", "nowrite" or "quickfix": type of buffer
+" (local to buffer)
+" set bt=
+
+" buflisted
+" whether the buffer shows up in the buffer list
+" (local to buffer)
+" set bl nobl
+
+" debug
+" set to "msg" to see all error messages
+" set debug=
+
+if &cp | set nocp | endif
+let s:cpo_save=&cpo
+set cpo&vim
+
+let g:netrw_home="$VARDIR/vim"
+
+filetype plugin indent on
+syntax on
+colorscheme madduck
+
+" leave the w mark whenever a file is written
+autocmd BufWrite * normal mw
+
+autocmd BufRead *.vcf set filetype=vcard
+
+" leave the i mark whenever we go idle (after updatetime)
+"augroup markidle
+ "autocmd CursorHold * normal mi
+ "autocmd CursorHoldI * normal mi "DISABLED while broken (shifts left)
+"augroup end
+
+" disable list mode when inserting stuff, otherwise keep it enabled, it's
+" useful (see also setting lcs)
+augroup listinsert
+ autocmd InsertEnter * set nolist
+ autocmd InsertLeave * set list
+augroup end
+" flag trailing spaces as error only when not inserting
+augroup tsperrorinsert
+ autocmd InsertEnter * match none /\s\+$/
+ autocmd InsertLeave * match Error /\s\+$/
+augroup end
+
+" treat wrapped lines normally
+nnoremap k gk
+nnoremap <Up> gk
+inoremap <Up> <C-\><C-o>gk
+nnoremap j gj
+nnoremap <Down> gj
+inoremap <Down> <C-\><C-o>gj
+
+" this isn't windows, screw the F1->help key
+map <F1> <Esc>
+imap <F1> <Esc>
+vmap <F1> <Esc>
+
+" ignore Q -- Ex mode
+map Q <Esc>
+
+let mapleader = ';'
+let maplocalleader = ';'
+
+" replace fake tab chars with real ones
+map <Leader>ft :%s,⇝·*, ,g<CR>:nohlsearch<CR>``
+" replace fake spaces with real ones
+map <Leader>fs :%s,·, ,g<CR>:nohlsearch<CR>``
+
+map <Leader>sy :echo synIDattr(synID(line("."), col("."), 1), "name")<CR>
+
+map <Leader>/ :nohlsearch<CR>
+
+omap [{ :normal {jj<CR>
+nmap [{ :normal {jj<CR>
+omap ]} :normal }kk<CR>
+nmap ]} :normal }kk<CR>
+
+iab sgf Sehr geehrte Frau
+iab sgh Sehr geehrter Herr
+iab sghn Sehr geehrte Herren
+iab lf Liebe Frau
+iab lh Lieber Herr
+iab sgdh Sehr geehrte Damen und Herren
+iab twimc To Whom It May Concern
+iab lg liebe Grüsse
+iab Lg Liebe Grüsse
+iab fg Freundliche Grüsse
+iab mfg Mit freundlichen Grüssen
+iab mbg Mit den besten Grüssen
+iab hg Herzliche Grüsse
+iab mhg Mit herzlichen Grüssen
+iab mbbg Mit bundesbrüderlichen Grüssen
+iab mvbg Mit verbandsbrüderlichen Grüssen
+
+iab => ➬
+
+let g:airline_theme='minimalist'
+
+try
+ execute pathogen#infect()
+catch
+ "echo "Pathogen not installed"
+endtry
+
+let g:is_posix = 1
+
+let &cpo=s:cpo_save
+unlet s:cpo_save
--- /dev/null
+#
+# set the editor variables to Vim
+#
+# Copyright © 1994–2017 martin f. krafft <madduck@madduck.net>
+# Released under the terms of the Artistic Licence 2.0
+#
+# Source repository: http://git.madduck.net/v/etc/zsh.git
+#
+
+if command -v vim >/dev/null; then
+ export EDITOR==vim
+ export VISUAL=$EDITOR
+fi
+
+# vim:ft=zsh