--- /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/pathogen.vim
+!/.vim/autoload/tabular.vim
+!/.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/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/doc/.gitignore
+!/.vim/doc/Tabular.txt
+!/.vim/ftdetect/itsalltext.vim
+!/.vim/ftdetect/mediawiki.vim
+!/.vim/ftdetect/puppet.vim
+!/.vim/ftplugin/gitcommit.vim
+!/.vim/ftplugin/gitconfig.vim
+!/.vim/ftplugin/itsalltext.vim
+!/.vim/ftplugin/latex-suite/.gitignore
+!/.vim/ftplugin/mediawiki.vim
+!/.vim/ftplugin/tex.vim
+!/.vim/ftplugin/vcard.vim
+!/.vim/.gitignore
+!/.vim/macros/table.vim
+!/.vim/plugin/justify.vim
+!/.vim/plugin/lbdbq.vim
+!/.vim/plugin/matchit.vim
+!/.vim/plugin/Tabular.vim
+!/.vimrc
+!/.vim/spell/en.utf-8.add
+!/.vim/spell/.gitignore
+!/.vim/syntax/jinja.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
+snippet sgf "Sehr geehrte Frau" b
+Sehr geehrte Frau $1,
+
+$0
+endsnippet
+
+snippet sgh "Sehr geehrter Herr" b
+Sehr geehrter Herr $1,
+
+$0
+endsnippet
+
+snippet sghn "Sehr geehrte Herren" b
+Sehr geehrte Herren,
+
+$0
+endsnippet
+
+snippet lf "Liebe Frau" b
+Liebe Frau $1,
+
+$0
+endsnippet
+
+snippet lh "Lieber Herr" b
+Lieber Herr $1,
+
+$0
+endsnippet
+
+snippet sgdh "Sehr geehrte Damen und Herren" b
+Sehr geehrte Damen und Herren,
+
+$0
+endsnippet
+
+snippet twimc "To Whom It May Concern" b
+To Whom It May Concern:
+
+$0
+endsnippet
+
+snippet lg "Liebe Grüsse" b
+Liebe Grüsse,
+${0:Martin Krafft}
+endsnippet
+
+snippet fg "Freundliche Grüsse" b
+Freundliche Grüsse,
+${0:Martin Krafft}
+endsnippet
+
+snippet mfg "Mit freundlichen Grüssen" b
+Mit freundlichen Grüssen,
+${0:Martin Krafft}
+endsnippet
+
+snippet mbg "Mit den besten Grüssen" b
+Mit den besten Grüssen,
+${0:Martin Krafft}
+endsnippet
+
+snippet hg "Herzliche Grüsse" b
+Herzliche Grüsse,
+${0:Martin Krafft}
+endsnippet
+
+snippet mhg "Mit herzlichen Grüssen" b
+Mit herzlichen Grüssen,
+${0:Martin Krafft}
+endsnippet
+
+snippet mbbg "Mit bundesbrüderlichen Grüssen" b
+Mit bundesbrüderlichen Grüssen,
+${0:Martin Krafft}
+endsnippet
+
+snippet mvbg "Mit verbandsbrüderlichen Grüssen" b
+Mit verbandsbrüderlichen Grüssen,
+${0:Martin Krafft}
+endsnippet
+
--- /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 kiwi<CR>
+nmap <buffer> <C-P><F4> :w<CR>:%!mailplate --keep-unknown pobox<CR>
+nmap <buffer> <C-P><F5> :w<CR>:%!mailplate --keep-unknown kbkg<CR>
+nmap <buffer> <C-P><F6> :w<CR>:%!mailplate --keep-unknown debian<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><F11> :w<CR>:%!mailplate --keep-unknown thorndonsquashtc<CR>
+nmap <buffer> <C-P><F12> :w<CR>:%!mailplate --keep-unknown default<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
+
+function! WriteMailBackup()
+ let l:tmpdir = fnameescape((exists('$TMPDIR') ? expand('$TMPDIR') : '/tmp'))
+ let l:tgtdir = l:tmpdir . '/mail-backups'
+ call mkdir(l:tgtdir, "p", 0o700)
+ let l:modified = &modified
+ let l:filename = l:tgtdir . '/' . strftime('%Y-%m-%d-%H%M%S') . '.msg'
+ exe 'silent update! ' . l:filename
+ if 0 && l:modified
+ echo 'Backup written to ' . l:filename
+ endif
+endfunction
+autocmd BufWritePre <buffer> call WriteMailBackup()
+
+let g:markdown_in_mail = 1
+runtime! ftplugin/markdown.vim
--- /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
+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/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
+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
+# vim-artesanal
+A Vim colorscheme with light and dark variants originally based on Material Design (now strongly modified to my likings).
+
+This is a **W**ork **I**n **P**rogress. Finally with a couple of screenshots ;-)
+
+## Screenshots ##
+### viml ###
+#### light ####
+![viml light](http://wimstefan.github.io/screenshots/artesanal-viml-light.png "viml light")
+#### dark ####
+![viml dark](http://wimstefan.github.io/screenshots/artesanal-viml-dark.png "viml dark")
+
+### vimdiff ###
+#### light ####
+![vimdiff light](http://wimstefan.github.io/screenshots/artesanal-vimdiff-light.png "vimdiff light")
+#### dark ####
+![vimdiff dark](http://wimstefan.github.io/screenshots/artesanal-vimdiff-dark.png "vimdiff dark")
+
+Inspired by & built with [Colortemplate](https://github.com/lifepillar/vim-colortemplate).
--- /dev/null
+" Name: Artesanal
+" Description: A Vim colorscheme with light and dark variants originally based on Material Design (now strongly modified to my likings).
+" Author: Stefan Wimmer <wimstefan@gmail.com>
+" Maintainer: Stefan Wimmer <wimstefan@gmail.com>
+" Website: https://github.com/wimstefan/vim-artesanal
+" License: Vim License (see `:help license`)
+" Last Updated: Sun 15 Mar 2020 02:36:29 PM CET
+
+" Generated by Colortemplate v2.0.0
+
+hi clear
+if exists('syntax_on')
+ syntax reset
+endif
+
+let g:colors_name = 'artesanal'
+
+let s:t_Co = exists('&t_Co') && !empty(&t_Co) && &t_Co > 1 ? &t_Co : 2
+let s:italics = (&t_ZH != '' && &t_ZH != '\e[7m') || has('gui_running') || has('nvim')
+
+if (has('termguicolors') && &termguicolors) || has('gui_running')
+ if &background ==# 'dark'
+ let g:terminal_ansi_colors = ['#575c66', '#e84256', '#00bf8a', '#fff176',
+ \ '#6699cc', '#fa75e2', '#00bbcc', '#ffffff', '#121419', '#dc1b33',
+ \ '#008c65', '#e5d85c', '#517aa3', '#f844d8', '#0095a3', '#eff1f4']
+ if has('nvim')
+ let g:terminal_color_0 = '#575c66'
+ let g:terminal_color_1 = '#e84256'
+ let g:terminal_color_2 = '#00bf8a'
+ let g:terminal_color_3 = '#fff176'
+ let g:terminal_color_4 = '#6699cc'
+ let g:terminal_color_5 = '#fa75e2'
+ let g:terminal_color_6 = '#00bbcc'
+ let g:terminal_color_7 = '#ffffff'
+ let g:terminal_color_8 = '#121419'
+ let g:terminal_color_9 = '#dc1b33'
+ let g:terminal_color_10 = '#008c65'
+ let g:terminal_color_11 = '#e5d85c'
+ let g:terminal_color_12 = '#517aa3'
+ let g:terminal_color_13 = '#f844d8'
+ let g:terminal_color_14 = '#0095a3'
+ let g:terminal_color_15 = '#eff1f4'
+ endif
+ if !has('gui_running') && get(g:, 'artesanal_transp_bg', 0)
+ hi Normal guifg=#e4e6eb guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi CursorLineNr guifg=#fff176 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi FoldColumn guifg=#575c66 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi SignColumn guifg=#cdd2db guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi VertSplit guifg=#546e7a guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ else
+ hi Normal guifg=#e4e6eb guibg=#2e3440 guisp=NONE gui=NONE cterm=NONE
+ hi CursorLineNr guifg=#fff176 guibg=#37474f guisp=NONE gui=NONE cterm=NONE
+ hi FoldColumn guifg=#575c66 guibg=#37474f guisp=NONE gui=NONE cterm=NONE
+ hi SignColumn guifg=#cdd2db guibg=#37474f guisp=NONE gui=NONE cterm=NONE
+ hi VertSplit guifg=#546e7a guibg=#2e3440 guisp=NONE gui=NONE cterm=NONE
+ endif
+ hi ColorColumn guifg=NONE guibg=#37474f guisp=NONE gui=bold cterm=bold
+ hi Conceal guifg=#6699cc guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi Cursor guifg=NONE guibg=NONE guisp=NONE gui=bold,reverse ctermfg=NONE ctermbg=NONE cterm=bold,reverse
+ hi CursorColumn guifg=NONE guibg=NONE guisp=NONE gui=bold,italic ctermfg=NONE ctermbg=NONE cterm=bold,italic
+ hi CursorLine guifg=NONE guibg=NONE guisp=NONE gui=bold,italic ctermfg=NONE ctermbg=NONE cterm=bold,italic
+ hi DiffAdd guifg=#abddcc guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi DiffAdded guifg=#abddcc guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi DiffChange guifg=#aec0e0 guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi DiffDelete guifg=#ddabbc guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi DiffRemoved guifg=#ddabbc guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi DiffText guifg=#abddcc guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi Directory guifg=#6699cc guibg=NONE guisp=NONE gui=bold cterm=bold
+ hi EndOfBuffer guifg=#2e3440 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi Error guifg=#e84256 guibg=NONE guisp=NONE gui=bold,standout cterm=bold,standout
+ hi! link ErrorMsg Error
+ hi Folded guifg=#546e7a guibg=#37474f guisp=NONE gui=italic cterm=italic
+ hi IncSearch guifg=#fff176 guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi LineNr guifg=#546e7a guibg=#37474f guisp=NONE gui=NONE cterm=NONE
+ hi MatchParen guifg=NONE guibg=#455a64 guisp=NONE gui=bold cterm=bold
+ hi ModeMsg guifg=#6699cc guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi MoreMsg guifg=#00bf8a guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi NonText guifg=#90a4ae guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi Pmenu guifg=#e4e6eb guibg=#455a64 guisp=NONE gui=NONE cterm=NONE
+ hi PmenuSbar guifg=NONE guibg=#455a64 guisp=NONE gui=NONE cterm=NONE
+ hi PmenuSel guifg=#37474f guibg=#cdd2db guisp=NONE gui=bold cterm=bold
+ hi PmenuThumb guifg=NONE guibg=#90a4ae guisp=NONE gui=NONE cterm=NONE
+ hi Question guifg=#e5d85c guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link QuickFixLine Search
+ hi Search guifg=#ffffa8 guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi SpecialKey guifg=#90a4ae guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi SpellBad guifg=#e84256 guibg=NONE guisp=#e84256 gui=italic,undercurl cterm=italic,undercurl
+ hi SpellCap guifg=#6699cc guibg=NONE guisp=#6699cc gui=italic,undercurl cterm=italic,undercurl
+ hi SpellLocal guifg=#00bbcc guibg=NONE guisp=#00bbcc gui=italic,undercurl cterm=italic,undercurl
+ hi SpellRare guifg=#fa75e2 guibg=NONE guisp=#fa75e2 gui=italic,undercurl cterm=italic,undercurl
+ hi StatusLine guifg=#455a64 guibg=#e4e6eb guisp=NONE gui=reverse cterm=reverse
+ hi StatusLineNC guifg=#37474f guibg=#cdd2db guisp=NONE gui=reverse cterm=reverse
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi! link TabLine TabLineFill
+ hi TabLineFill guifg=#cdd2db guibg=#546e7a guisp=NONE gui=NONE cterm=NONE
+ hi TabLineSel guifg=#e4e6eb guibg=#37474f guisp=NONE gui=NONE cterm=NONE
+ hi Title guifg=#eff1f4 guibg=NONE guisp=NONE gui=bold cterm=bold
+ hi Visual guifg=NONE guibg=#37474f guisp=NONE gui=NONE cterm=NONE
+ hi! link VisualNOS Visual
+ hi WarningMsg guifg=#e84256 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi WildMenu guifg=#6699cc guibg=#455a64 guisp=NONE gui=bold cterm=bold
+ hi! link Boolean Constant
+ hi! link Character Constant
+ hi Comment guifg=#b6bdcb guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link Conditional Statement
+ hi Constant guifg=#00bf8a guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link Define PreProc
+ hi! link Debug Special
+ hi! link Delimiter Special
+ hi! link Exception Statement
+ hi! link Float Constant
+ hi Function guifg=#00bbcc guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi Identifier guifg=#6699cc guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi Ignore guifg=fg guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link Include PreProc
+ hi! link Keyword Statement
+ hi! link Label Statement
+ hi! link Macro PreProc
+ hi! link Number Constant
+ hi! link Operator Statement
+ hi! link PreCondit PreProc
+ hi PreProc guifg=#00bbcc guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link Repeat Statement
+ hi! link SpecialChar Special
+ hi! link SpecialComment Special
+ hi Statement guifg=#e84256 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link StorageClass Type
+ hi Special guifg=#fff176 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link String Constant
+ hi! link Structure Type
+ hi! link Tag Special
+ hi Todo guifg=#00bbcc guibg=NONE guisp=NONE gui=reverse cterm=reverse
+ hi Type guifg=#0095a3 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link Typedef Type
+ hi Underlined guifg=NONE guibg=NONE guisp=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
+ hi! link lCursor Cursor
+ hi CursorIM guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi ToolbarLine guifg=NONE guibg=#546e7a guisp=NONE gui=NONE cterm=NONE
+ hi ToolbarButton guifg=#eff1f4 guibg=#546e7a guisp=NONE gui=bold cterm=bold
+ hi! link iCursor Cursor
+ hi! link vCursor Cursor
+ hi NormalMode guifg=#cdd2db guibg=#2e3440 guisp=NONE gui=reverse cterm=reverse
+ hi InsertMode guifg=#6699cc guibg=#2e3440 guisp=NONE gui=reverse cterm=reverse
+ hi ReplaceMode guifg=#00bbcc guibg=#2e3440 guisp=NONE gui=reverse cterm=reverse
+ hi VisualMode guifg=#fff176 guibg=#2e3440 guisp=NONE gui=reverse cterm=reverse
+ hi CommandMode guifg=#fa75e2 guibg=#2e3440 guisp=NONE gui=reverse cterm=reverse
+ hi Warnings guifg=#fff176 guibg=#2e3440 guisp=NONE gui=reverse cterm=reverse
+ if !s:italics
+ hi CursorColumn gui=bold cterm=bold
+ hi CursorLine gui=bold cterm=bold
+ hi Folded gui=NONE cterm=NONE
+ hi SpellBad gui=undercurl cterm=undercurl
+ hi SpellCap gui=undercurl cterm=undercurl
+ hi SpellLocal gui=undercurl cterm=undercurl
+ hi SpellRare gui=undercurl cterm=undercurl
+ endif
+ if has('nvim')
+ hi! link TermCursor Cursor
+ hi TermCursorNC guifg=#37474f guibg=#e4e6eb guisp=NONE gui=NONE cterm=NONE
+ endif
+ unlet s:t_Co s:italics
+ finish
+ endif
+ " Light background
+ let g:terminal_ansi_colors = ['#121419', '#971223', '#00814b', '#cc7000',
+ \ '#00409b', '#9a008d', '#007681', '#eff1f4', '#575c66', '#ae1528',
+ \ '#009a5a', '#ff8c00', '#004bb4', '#b300a4', '#008d9a', '#ffffff']
+ if has('nvim')
+ let g:terminal_color_0 = '#121419'
+ let g:terminal_color_1 = '#971223'
+ let g:terminal_color_2 = '#00814b'
+ let g:terminal_color_3 = '#cc7000'
+ let g:terminal_color_4 = '#00409b'
+ let g:terminal_color_5 = '#9a008d'
+ let g:terminal_color_6 = '#007681'
+ let g:terminal_color_7 = '#eff1f4'
+ let g:terminal_color_8 = '#575c66'
+ let g:terminal_color_9 = '#ae1528'
+ let g:terminal_color_10 = '#009a5a'
+ let g:terminal_color_11 = '#ff8c00'
+ let g:terminal_color_12 = '#004bb4'
+ let g:terminal_color_13 = '#b300a4'
+ let g:terminal_color_14 = '#008d9a'
+ let g:terminal_color_15 = '#ffffff'
+ endif
+ if !has('gui_running') && get(g:, 'artesanal_transp_bg', 0)
+ hi Normal guifg=#37474f guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi CursorLineNr guifg=#ff8c00 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi FoldColumn guifg=#575c66 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi SignColumn guifg=#455a64 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi VertSplit guifg=#b6bdcb guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ else
+ hi Normal guifg=#37474f guibg=#eff1f4 guisp=NONE gui=NONE cterm=NONE
+ hi CursorLineNr guifg=#ff8c00 guibg=#e4e6eb guisp=NONE gui=NONE cterm=NONE
+ hi FoldColumn guifg=#575c66 guibg=#e4e6eb guisp=NONE gui=NONE cterm=NONE
+ hi SignColumn guifg=#455a64 guibg=#e4e6eb guisp=NONE gui=NONE cterm=NONE
+ hi VertSplit guifg=#b6bdcb guibg=#eff1f4 guisp=NONE gui=NONE cterm=NONE
+ endif
+ hi ColorColumn guifg=NONE guibg=#e4e6eb guisp=NONE gui=bold cterm=bold
+ hi Conceal guifg=#004bb4 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi Cursor guifg=NONE guibg=NONE guisp=NONE gui=bold,reverse ctermfg=NONE ctermbg=NONE cterm=bold,reverse
+ hi CursorColumn guifg=NONE guibg=NONE guisp=NONE gui=bold,italic ctermfg=NONE ctermbg=NONE cterm=bold,italic
+ hi CursorLine guifg=NONE guibg=NONE guisp=NONE gui=bold,italic ctermfg=NONE ctermbg=NONE cterm=bold,italic
+ hi DiffAdd guifg=#abddcc guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi DiffAdded guifg=#abddcc guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi DiffChange guifg=#aec0e0 guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi DiffDelete guifg=#ddabbc guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi DiffRemoved guifg=#ddabbc guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi DiffText guifg=#abddcc guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi Directory guifg=#004bb4 guibg=NONE guisp=NONE gui=bold cterm=bold
+ hi EndOfBuffer guifg=#eff1f4 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi Error guifg=#ae1528 guibg=NONE guisp=NONE gui=bold,standout cterm=bold,standout
+ hi! link ErrorMsg Error
+ hi Folded guifg=#b6bdcb guibg=#e4e6eb guisp=NONE gui=italic cterm=italic
+ hi IncSearch guifg=#ff8c00 guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi LineNr guifg=#b6bdcb guibg=#e4e6eb guisp=NONE gui=NONE cterm=NONE
+ hi MatchParen guifg=NONE guibg=#cdd2db guisp=NONE gui=bold cterm=bold
+ hi ModeMsg guifg=#004bb4 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi MoreMsg guifg=#009a5a guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi NonText guifg=#9fa8ba guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi Pmenu guifg=#37474f guibg=#cdd2db guisp=NONE gui=NONE cterm=NONE
+ hi PmenuSbar guifg=NONE guibg=#cdd2db guisp=NONE gui=NONE cterm=NONE
+ hi PmenuSel guifg=#e4e6eb guibg=#455a64 guisp=NONE gui=bold cterm=bold
+ hi PmenuThumb guifg=NONE guibg=#9fa8ba guisp=NONE gui=NONE cterm=NONE
+ hi Question guifg=#cc7000 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link QuickFixLine Search
+ hi Search guifg=#ffc57f guibg=#121419 guisp=NONE gui=reverse cterm=reverse
+ hi SpecialKey guifg=#9fa8ba guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi SpellBad guifg=#ae1528 guibg=NONE guisp=#ae1528 gui=italic,undercurl cterm=italic,undercurl
+ hi SpellCap guifg=#004bb4 guibg=NONE guisp=#004bb4 gui=italic,undercurl cterm=italic,undercurl
+ hi SpellLocal guifg=#008d9a guibg=NONE guisp=#008d9a gui=italic,undercurl cterm=italic,undercurl
+ hi SpellRare guifg=#b300a4 guibg=NONE guisp=#b300a4 gui=italic,undercurl cterm=italic,undercurl
+ hi StatusLine guifg=#cdd2db guibg=#37474f guisp=NONE gui=reverse cterm=reverse
+ hi StatusLineNC guifg=#e4e6eb guibg=#455a64 guisp=NONE gui=reverse cterm=reverse
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi! link TabLine TabLineFill
+ hi TabLineFill guifg=#455a64 guibg=#b6bdcb guisp=NONE gui=NONE cterm=NONE
+ hi TabLineSel guifg=#37474f guibg=#e4e6eb guisp=NONE gui=NONE cterm=NONE
+ hi Title guifg=#2e3440 guibg=NONE guisp=NONE gui=bold cterm=bold
+ hi Visual guifg=NONE guibg=#e4e6eb guisp=NONE gui=NONE cterm=NONE
+ hi! link VisualNOS Visual
+ hi WarningMsg guifg=#ae1528 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi WildMenu guifg=#004bb4 guibg=#cdd2db guisp=NONE gui=bold cterm=bold
+ hi! link Boolean Constant
+ hi! link Character Constant
+ hi Comment guifg=#546e7a guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link Conditional Statement
+ hi Constant guifg=#009a5a guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link Define PreProc
+ hi! link Debug Special
+ hi! link Delimiter Special
+ hi! link Exception Statement
+ hi! link Float Constant
+ hi Function guifg=#008d9a guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi Identifier guifg=#004bb4 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi Ignore guifg=fg guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link Include PreProc
+ hi! link Keyword Statement
+ hi! link Label Statement
+ hi! link Macro PreProc
+ hi! link Number Constant
+ hi! link Operator Statement
+ hi! link PreCondit PreProc
+ hi PreProc guifg=#008d9a guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link Repeat Statement
+ hi! link SpecialChar Special
+ hi! link SpecialComment Special
+ hi Statement guifg=#ae1528 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link StorageClass Type
+ hi Special guifg=#ff8c00 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link String Constant
+ hi! link Structure Type
+ hi! link Tag Special
+ hi Todo guifg=#008d9a guibg=NONE guisp=NONE gui=reverse cterm=reverse
+ hi Type guifg=#007681 guibg=NONE guisp=NONE gui=NONE cterm=NONE
+ hi! link Typedef Type
+ hi Underlined guifg=NONE guibg=NONE guisp=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
+ hi! link lCursor Cursor
+ hi CursorIM guifg=NONE guibg=NONE guisp=NONE gui=reverse ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi ToolbarLine guifg=NONE guibg=#b6bdcb guisp=NONE gui=NONE cterm=NONE
+ hi ToolbarButton guifg=#2e3440 guibg=#b6bdcb guisp=NONE gui=bold cterm=bold
+ hi! link iCursor Cursor
+ hi! link vCursor Cursor
+ hi NormalMode guifg=#455a64 guibg=#eff1f4 guisp=NONE gui=reverse cterm=reverse
+ hi InsertMode guifg=#004bb4 guibg=#eff1f4 guisp=NONE gui=reverse cterm=reverse
+ hi ReplaceMode guifg=#008d9a guibg=#eff1f4 guisp=NONE gui=reverse cterm=reverse
+ hi VisualMode guifg=#ff8c00 guibg=#eff1f4 guisp=NONE gui=reverse cterm=reverse
+ hi CommandMode guifg=#b300a4 guibg=#eff1f4 guisp=NONE gui=reverse cterm=reverse
+ hi Warnings guifg=#ff8c00 guibg=#eff1f4 guisp=NONE gui=reverse cterm=reverse
+ if !s:italics
+ hi CursorColumn gui=bold cterm=bold
+ hi CursorLine gui=bold cterm=bold
+ hi Folded gui=NONE cterm=NONE
+ hi SpellBad gui=undercurl cterm=undercurl
+ hi SpellCap gui=undercurl cterm=undercurl
+ hi SpellLocal gui=undercurl cterm=undercurl
+ hi SpellRare gui=undercurl cterm=undercurl
+ endif
+ if has('nvim')
+ hi! link TermCursor Cursor
+ hi TermCursorNC guifg=#e4e6eb guibg=#37474f guisp=NONE gui=NONE cterm=NONE
+ endif
+ unlet s:t_Co s:italics
+ finish
+endif
+
+if s:t_Co >= 256
+ if &background ==# 'dark'
+ if !has('gui_running') && get(g:, 'artesanal_transp_bg', 0)
+ hi Normal ctermfg=254 ctermbg=NONE cterm=NONE
+ hi CursorLineNr ctermfg=228 ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=59 ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=252 ctermbg=NONE cterm=NONE
+ hi VertSplit ctermfg=242 ctermbg=NONE cterm=NONE
+ else
+ hi Normal ctermfg=254 ctermbg=236 cterm=NONE
+ if !has('patch-8.0.0616') && !has('nvim') " Fix for Vim bug
+ set background=dark
+ endif
+ hi CursorLineNr ctermfg=228 ctermbg=238 cterm=NONE
+ hi FoldColumn ctermfg=59 ctermbg=238 cterm=NONE
+ hi SignColumn ctermfg=252 ctermbg=238 cterm=NONE
+ hi VertSplit ctermfg=242 ctermbg=236 cterm=NONE
+ endif
+ hi ColorColumn ctermfg=NONE ctermbg=238 cterm=bold
+ hi Conceal ctermfg=67 ctermbg=NONE cterm=NONE
+ hi Cursor ctermfg=NONE ctermbg=NONE cterm=bold,reverse
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=bold,italic
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=bold,italic
+ hi DiffAdd ctermfg=152 ctermbg=233 cterm=reverse
+ hi DiffAdded ctermfg=152 ctermbg=233 cterm=reverse
+ hi DiffChange ctermfg=153 ctermbg=233 cterm=reverse
+ hi DiffDelete ctermfg=181 ctermbg=233 cterm=reverse
+ hi DiffRemoved ctermfg=181 ctermbg=233 cterm=reverse
+ hi DiffText ctermfg=152 ctermbg=233 cterm=reverse
+ hi Directory ctermfg=67 ctermbg=NONE cterm=bold
+ hi EndOfBuffer ctermfg=236 ctermbg=NONE cterm=NONE
+ hi Error ctermfg=167 ctermbg=NONE cterm=bold,reverse
+ hi! link ErrorMsg Error
+ hi Folded ctermfg=242 ctermbg=238 cterm=NONE
+ hi IncSearch ctermfg=228 ctermbg=233 cterm=reverse
+ hi LineNr ctermfg=242 ctermbg=238 cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=240 cterm=bold
+ hi ModeMsg ctermfg=67 ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=36 ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=247 ctermbg=NONE cterm=NONE
+ hi Pmenu ctermfg=254 ctermbg=240 cterm=NONE
+ hi PmenuSbar ctermfg=NONE ctermbg=240 cterm=NONE
+ hi PmenuSel ctermfg=238 ctermbg=252 cterm=bold
+ hi PmenuThumb ctermfg=NONE ctermbg=247 cterm=NONE
+ hi Question ctermfg=185 ctermbg=NONE cterm=NONE
+ hi! link QuickFixLine Search
+ hi Search ctermfg=229 ctermbg=233 cterm=reverse
+ hi SpecialKey ctermfg=247 ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=167 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=67 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=37 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=206 ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=240 ctermbg=254 cterm=reverse
+ hi StatusLineNC ctermfg=238 ctermbg=252 cterm=reverse
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi! link TabLine TabLineFill
+ hi TabLineFill ctermfg=252 ctermbg=242 cterm=NONE
+ hi TabLineSel ctermfg=254 ctermbg=238 cterm=NONE
+ hi Title ctermfg=255 ctermbg=NONE cterm=bold
+ hi Visual ctermfg=NONE ctermbg=238 cterm=NONE
+ hi! link VisualNOS Visual
+ hi WarningMsg ctermfg=167 ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=67 ctermbg=240 cterm=bold
+ hi! link Boolean Constant
+ hi! link Character Constant
+ hi Comment ctermfg=250 ctermbg=NONE cterm=NONE
+ hi! link Conditional Statement
+ hi Constant ctermfg=36 ctermbg=NONE cterm=NONE
+ hi! link Define PreProc
+ hi! link Debug Special
+ hi! link Delimiter Special
+ hi! link Exception Statement
+ hi! link Float Constant
+ hi Function ctermfg=37 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=67 ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=fg ctermbg=NONE cterm=NONE
+ hi! link Include PreProc
+ hi! link Keyword Statement
+ hi! link Label Statement
+ hi! link Macro PreProc
+ hi! link Number Constant
+ hi! link Operator Statement
+ hi! link PreCondit PreProc
+ hi PreProc ctermfg=37 ctermbg=NONE cterm=NONE
+ hi! link Repeat Statement
+ hi! link SpecialChar Special
+ hi! link SpecialComment Special
+ hi Statement ctermfg=167 ctermbg=NONE cterm=NONE
+ hi! link StorageClass Type
+ hi Special ctermfg=228 ctermbg=NONE cterm=NONE
+ hi! link String Constant
+ hi! link Structure Type
+ hi! link Tag Special
+ hi Todo ctermfg=37 ctermbg=NONE cterm=reverse
+ hi Type ctermfg=30 ctermbg=NONE cterm=NONE
+ hi! link Typedef Type
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi! link lCursor Cursor
+ hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi ToolbarLine ctermfg=NONE ctermbg=242 cterm=NONE
+ hi ToolbarButton ctermfg=255 ctermbg=242 cterm=bold
+ hi! link iCursor Cursor
+ hi! link vCursor Cursor
+ hi NormalMode ctermfg=252 ctermbg=236 cterm=reverse
+ hi InsertMode ctermfg=67 ctermbg=236 cterm=reverse
+ hi ReplaceMode ctermfg=37 ctermbg=236 cterm=reverse
+ hi VisualMode ctermfg=228 ctermbg=236 cterm=reverse
+ hi CommandMode ctermfg=206 ctermbg=236 cterm=reverse
+ hi Warnings ctermfg=228 ctermbg=236 cterm=reverse
+ if !s:italics
+ hi CursorColumn cterm=bold
+ hi CursorLine cterm=bold
+ endif
+ if has('nvim')
+ hi! link TermCursor Cursor
+ hi TermCursorNC ctermfg=238 ctermbg=254 cterm=NONE
+ endif
+ unlet s:t_Co s:italics
+ finish
+ endif
+ " Light background
+ if !has('gui_running') && get(g:, 'artesanal_transp_bg', 0)
+ hi Normal ctermfg=238 ctermbg=NONE cterm=NONE
+ hi CursorLineNr ctermfg=208 ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=59 ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=240 ctermbg=NONE cterm=NONE
+ hi VertSplit ctermfg=250 ctermbg=NONE cterm=NONE
+ else
+ hi Normal ctermfg=238 ctermbg=255 cterm=NONE
+ hi CursorLineNr ctermfg=208 ctermbg=254 cterm=NONE
+ hi FoldColumn ctermfg=59 ctermbg=254 cterm=NONE
+ hi SignColumn ctermfg=240 ctermbg=254 cterm=NONE
+ hi VertSplit ctermfg=250 ctermbg=255 cterm=NONE
+ endif
+ hi ColorColumn ctermfg=NONE ctermbg=254 cterm=bold
+ hi Conceal ctermfg=26 ctermbg=NONE cterm=NONE
+ hi Cursor ctermfg=NONE ctermbg=NONE cterm=bold,reverse
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=bold,italic
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=bold,italic
+ hi DiffAdd ctermfg=152 ctermbg=233 cterm=reverse
+ hi DiffAdded ctermfg=152 ctermbg=233 cterm=reverse
+ hi DiffChange ctermfg=153 ctermbg=233 cterm=reverse
+ hi DiffDelete ctermfg=181 ctermbg=233 cterm=reverse
+ hi DiffRemoved ctermfg=181 ctermbg=233 cterm=reverse
+ hi DiffText ctermfg=152 ctermbg=233 cterm=reverse
+ hi Directory ctermfg=26 ctermbg=NONE cterm=bold
+ hi EndOfBuffer ctermfg=255 ctermbg=NONE cterm=NONE
+ hi Error ctermfg=124 ctermbg=NONE cterm=bold,reverse
+ hi! link ErrorMsg Error
+ hi Folded ctermfg=250 ctermbg=254 cterm=NONE
+ hi IncSearch ctermfg=208 ctermbg=233 cterm=reverse
+ hi LineNr ctermfg=250 ctermbg=254 cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=252 cterm=bold
+ hi ModeMsg ctermfg=26 ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=35 ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=248 ctermbg=NONE cterm=NONE
+ hi Pmenu ctermfg=238 ctermbg=252 cterm=NONE
+ hi PmenuSbar ctermfg=NONE ctermbg=252 cterm=NONE
+ hi PmenuSel ctermfg=254 ctermbg=240 cterm=bold
+ hi PmenuThumb ctermfg=NONE ctermbg=248 cterm=NONE
+ hi Question ctermfg=166 ctermbg=NONE cterm=NONE
+ hi! link QuickFixLine Search
+ hi Search ctermfg=215 ctermbg=233 cterm=reverse
+ hi SpecialKey ctermfg=248 ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=124 ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=26 ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=30 ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=127 ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=252 ctermbg=238 cterm=reverse
+ hi StatusLineNC ctermfg=254 ctermbg=240 cterm=reverse
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi! link TabLine TabLineFill
+ hi TabLineFill ctermfg=240 ctermbg=250 cterm=NONE
+ hi TabLineSel ctermfg=238 ctermbg=254 cterm=NONE
+ hi Title ctermfg=236 ctermbg=NONE cterm=bold
+ hi Visual ctermfg=NONE ctermbg=254 cterm=NONE
+ hi! link VisualNOS Visual
+ hi WarningMsg ctermfg=124 ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=26 ctermbg=252 cterm=bold
+ hi! link Boolean Constant
+ hi! link Character Constant
+ hi Comment ctermfg=242 ctermbg=NONE cterm=NONE
+ hi! link Conditional Statement
+ hi Constant ctermfg=35 ctermbg=NONE cterm=NONE
+ hi! link Define PreProc
+ hi! link Debug Special
+ hi! link Delimiter Special
+ hi! link Exception Statement
+ hi! link Float Constant
+ hi Function ctermfg=30 ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=26 ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=fg ctermbg=NONE cterm=NONE
+ hi! link Include PreProc
+ hi! link Keyword Statement
+ hi! link Label Statement
+ hi! link Macro PreProc
+ hi! link Number Constant
+ hi! link Operator Statement
+ hi! link PreCondit PreProc
+ hi PreProc ctermfg=30 ctermbg=NONE cterm=NONE
+ hi! link Repeat Statement
+ hi! link SpecialChar Special
+ hi! link SpecialComment Special
+ hi Statement ctermfg=124 ctermbg=NONE cterm=NONE
+ hi! link StorageClass Type
+ hi Special ctermfg=208 ctermbg=NONE cterm=NONE
+ hi! link String Constant
+ hi! link Structure Type
+ hi! link Tag Special
+ hi Todo ctermfg=30 ctermbg=NONE cterm=reverse
+ hi Type ctermfg=30 ctermbg=NONE cterm=NONE
+ hi! link Typedef Type
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi! link lCursor Cursor
+ hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi ToolbarLine ctermfg=NONE ctermbg=250 cterm=NONE
+ hi ToolbarButton ctermfg=236 ctermbg=250 cterm=bold
+ hi! link iCursor Cursor
+ hi! link vCursor Cursor
+ hi NormalMode ctermfg=240 ctermbg=255 cterm=reverse
+ hi InsertMode ctermfg=26 ctermbg=255 cterm=reverse
+ hi ReplaceMode ctermfg=30 ctermbg=255 cterm=reverse
+ hi VisualMode ctermfg=208 ctermbg=255 cterm=reverse
+ hi CommandMode ctermfg=127 ctermbg=255 cterm=reverse
+ hi Warnings ctermfg=208 ctermbg=255 cterm=reverse
+ if !s:italics
+ hi CursorColumn cterm=bold
+ hi CursorLine cterm=bold
+ endif
+ if has('nvim')
+ hi! link TermCursor Cursor
+ hi TermCursorNC ctermfg=254 ctermbg=238 cterm=NONE
+ endif
+ unlet s:t_Co s:italics
+ finish
+endif
+
+if s:t_Co >= 16
+ if &background ==# 'dark'
+ if !has('gui_running') && get(g:, 'artesanal_transp_bg', 0)
+ hi Normal ctermfg=White ctermbg=NONE cterm=NONE
+ hi CursorLineNr ctermfg=Yellow ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=DarkGray ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=LightGrey ctermbg=NONE cterm=NONE
+ hi VertSplit ctermfg=DarkGrey ctermbg=NONE cterm=NONE
+ else
+ hi Normal ctermfg=White ctermbg=Black cterm=NONE
+ hi CursorLineNr ctermfg=Yellow ctermbg=Black cterm=NONE
+ hi FoldColumn ctermfg=DarkGray ctermbg=Black cterm=NONE
+ hi SignColumn ctermfg=LightGrey ctermbg=Black cterm=NONE
+ hi VertSplit ctermfg=DarkGrey ctermbg=Black cterm=NONE
+ endif
+ hi ColorColumn ctermfg=NONE ctermbg=Black cterm=bold
+ hi Conceal ctermfg=Blue ctermbg=NONE cterm=NONE
+ hi Cursor ctermfg=NONE ctermbg=NONE cterm=bold,reverse
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=bold,italic
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=bold,italic
+ hi DiffAdd ctermfg=LightGreen ctermbg=Black cterm=reverse
+ hi DiffAdded ctermfg=LightGreen ctermbg=Black cterm=reverse
+ hi DiffChange ctermfg=LightBlue ctermbg=Black cterm=reverse
+ hi DiffDelete ctermfg=LightRed ctermbg=Black cterm=reverse
+ hi DiffRemoved ctermfg=LightRed ctermbg=Black cterm=reverse
+ hi DiffText ctermfg=LightGreen ctermbg=Black cterm=reverse
+ hi Directory ctermfg=Blue ctermbg=NONE cterm=bold
+ hi EndOfBuffer ctermfg=Black ctermbg=NONE cterm=NONE
+ hi Error ctermfg=Red ctermbg=NONE cterm=bold,reverse
+ hi! link ErrorMsg Error
+ hi Folded ctermfg=DarkGrey ctermbg=Black cterm=NONE
+ hi IncSearch ctermfg=Yellow ctermbg=Black cterm=reverse
+ hi LineNr ctermfg=DarkGrey ctermbg=Black cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=DarkGrey cterm=bold
+ hi ModeMsg ctermfg=Blue ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=Green ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=LightGrey ctermbg=NONE cterm=NONE
+ hi Pmenu ctermfg=White ctermbg=DarkGrey cterm=NONE
+ hi PmenuSbar ctermfg=NONE ctermbg=DarkGrey cterm=NONE
+ hi PmenuSel ctermfg=Black ctermbg=LightGrey cterm=bold
+ hi PmenuThumb ctermfg=NONE ctermbg=LightGrey cterm=NONE
+ hi Question ctermfg=DarkYellow ctermbg=NONE cterm=NONE
+ hi! link QuickFixLine Search
+ hi Search ctermfg=LightYellow ctermbg=Black cterm=reverse
+ hi SpecialKey ctermfg=LightGrey ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=Red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=Blue ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=Cyan ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=Magenta ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=DarkGrey ctermbg=White cterm=reverse
+ hi StatusLineNC ctermfg=Black ctermbg=LightGrey cterm=reverse
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi! link TabLine TabLineFill
+ hi TabLineFill ctermfg=LightGrey ctermbg=DarkGrey cterm=NONE
+ hi TabLineSel ctermfg=White ctermbg=Black cterm=NONE
+ hi Title ctermfg=White ctermbg=NONE cterm=bold
+ hi Visual ctermfg=NONE ctermbg=Black cterm=NONE
+ hi! link VisualNOS Visual
+ hi WarningMsg ctermfg=Red ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=Blue ctermbg=DarkGrey cterm=bold
+ hi! link Boolean Constant
+ hi! link Character Constant
+ hi Comment ctermfg=DarkGrey ctermbg=NONE cterm=NONE
+ hi! link Conditional Statement
+ hi Constant ctermfg=Green ctermbg=NONE cterm=NONE
+ hi! link Define PreProc
+ hi! link Debug Special
+ hi! link Delimiter Special
+ hi! link Exception Statement
+ hi! link Float Constant
+ hi Function ctermfg=Cyan ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=Blue ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=fg ctermbg=NONE cterm=NONE
+ hi! link Include PreProc
+ hi! link Keyword Statement
+ hi! link Label Statement
+ hi! link Macro PreProc
+ hi! link Number Constant
+ hi! link Operator Statement
+ hi! link PreCondit PreProc
+ hi PreProc ctermfg=Cyan ctermbg=NONE cterm=NONE
+ hi! link Repeat Statement
+ hi! link SpecialChar Special
+ hi! link SpecialComment Special
+ hi Statement ctermfg=Red ctermbg=NONE cterm=NONE
+ hi! link StorageClass Type
+ hi Special ctermfg=Yellow ctermbg=NONE cterm=NONE
+ hi! link String Constant
+ hi! link Structure Type
+ hi! link Tag Special
+ hi Todo ctermfg=Cyan ctermbg=NONE cterm=reverse
+ hi Type ctermfg=DarkCyan ctermbg=NONE cterm=NONE
+ hi! link Typedef Type
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi! link lCursor Cursor
+ hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi ToolbarLine ctermfg=NONE ctermbg=DarkGrey cterm=NONE
+ hi ToolbarButton ctermfg=White ctermbg=DarkGrey cterm=bold
+ hi! link iCursor Cursor
+ hi! link vCursor Cursor
+ hi NormalMode ctermfg=LightGrey ctermbg=Black cterm=reverse
+ hi InsertMode ctermfg=Blue ctermbg=Black cterm=reverse
+ hi ReplaceMode ctermfg=Cyan ctermbg=Black cterm=reverse
+ hi VisualMode ctermfg=Yellow ctermbg=Black cterm=reverse
+ hi CommandMode ctermfg=Magenta ctermbg=Black cterm=reverse
+ hi Warnings ctermfg=Yellow ctermbg=Black cterm=reverse
+ if !s:italics
+ hi CursorColumn cterm=bold
+ hi CursorLine cterm=bold
+ endif
+ if has('nvim')
+ hi! link TermCursor Cursor
+ hi TermCursorNC ctermfg=Black ctermbg=White cterm=NONE
+ endif
+ unlet s:t_Co s:italics
+ finish
+ endif
+ " Light background
+ if !has('gui_running') && get(g:, 'artesanal_transp_bg', 0)
+ hi Normal ctermfg=Black ctermbg=NONE cterm=NONE
+ hi CursorLineNr ctermfg=Yellow ctermbg=NONE cterm=NONE
+ hi FoldColumn ctermfg=DarkGray ctermbg=NONE cterm=NONE
+ hi SignColumn ctermfg=DarkGrey ctermbg=NONE cterm=NONE
+ hi VertSplit ctermfg=DarkGrey ctermbg=NONE cterm=NONE
+ else
+ hi Normal ctermfg=Black ctermbg=White cterm=NONE
+ hi CursorLineNr ctermfg=Yellow ctermbg=White cterm=NONE
+ hi FoldColumn ctermfg=DarkGray ctermbg=White cterm=NONE
+ hi SignColumn ctermfg=DarkGrey ctermbg=White cterm=NONE
+ hi VertSplit ctermfg=DarkGrey ctermbg=White cterm=NONE
+ endif
+ hi ColorColumn ctermfg=NONE ctermbg=White cterm=bold
+ hi Conceal ctermfg=Blue ctermbg=NONE cterm=NONE
+ hi Cursor ctermfg=NONE ctermbg=NONE cterm=bold,reverse
+ hi CursorColumn ctermfg=NONE ctermbg=NONE cterm=bold,italic
+ hi CursorLine ctermfg=NONE ctermbg=NONE cterm=bold,italic
+ hi DiffAdd ctermfg=LightGreen ctermbg=Black cterm=reverse
+ hi DiffAdded ctermfg=LightGreen ctermbg=Black cterm=reverse
+ hi DiffChange ctermfg=LightBlue ctermbg=Black cterm=reverse
+ hi DiffDelete ctermfg=LightRed ctermbg=Black cterm=reverse
+ hi DiffRemoved ctermfg=LightRed ctermbg=Black cterm=reverse
+ hi DiffText ctermfg=LightGreen ctermbg=Black cterm=reverse
+ hi Directory ctermfg=Blue ctermbg=NONE cterm=bold
+ hi EndOfBuffer ctermfg=White ctermbg=NONE cterm=NONE
+ hi Error ctermfg=Red ctermbg=NONE cterm=bold,reverse
+ hi! link ErrorMsg Error
+ hi Folded ctermfg=DarkGrey ctermbg=White cterm=NONE
+ hi IncSearch ctermfg=Yellow ctermbg=Black cterm=reverse
+ hi LineNr ctermfg=DarkGrey ctermbg=White cterm=NONE
+ hi MatchParen ctermfg=NONE ctermbg=LightGrey cterm=bold
+ hi ModeMsg ctermfg=Blue ctermbg=NONE cterm=NONE
+ hi MoreMsg ctermfg=Green ctermbg=NONE cterm=NONE
+ hi NonText ctermfg=DarkGrey ctermbg=NONE cterm=NONE
+ hi Pmenu ctermfg=Black ctermbg=LightGrey cterm=NONE
+ hi PmenuSbar ctermfg=NONE ctermbg=LightGrey cterm=NONE
+ hi PmenuSel ctermfg=White ctermbg=DarkGrey cterm=bold
+ hi PmenuThumb ctermfg=NONE ctermbg=DarkGrey cterm=NONE
+ hi Question ctermfg=DarkYellow ctermbg=NONE cterm=NONE
+ hi! link QuickFixLine Search
+ hi Search ctermfg=LightYellow ctermbg=Black cterm=reverse
+ hi SpecialKey ctermfg=DarkGrey ctermbg=NONE cterm=NONE
+ hi SpellBad ctermfg=Red ctermbg=NONE cterm=underline
+ hi SpellCap ctermfg=Blue ctermbg=NONE cterm=underline
+ hi SpellLocal ctermfg=Cyan ctermbg=NONE cterm=underline
+ hi SpellRare ctermfg=Magenta ctermbg=NONE cterm=underline
+ hi StatusLine ctermfg=LightGrey ctermbg=Black cterm=reverse
+ hi StatusLineNC ctermfg=White ctermbg=DarkGrey cterm=reverse
+ hi! link StatusLineTerm StatusLine
+ hi! link StatusLineTermNC StatusLineNC
+ hi! link TabLine TabLineFill
+ hi TabLineFill ctermfg=DarkGrey ctermbg=DarkGrey cterm=NONE
+ hi TabLineSel ctermfg=Black ctermbg=White cterm=NONE
+ hi Title ctermfg=Black ctermbg=NONE cterm=bold
+ hi Visual ctermfg=NONE ctermbg=White cterm=NONE
+ hi! link VisualNOS Visual
+ hi WarningMsg ctermfg=Red ctermbg=NONE cterm=NONE
+ hi WildMenu ctermfg=Blue ctermbg=LightGrey cterm=bold
+ hi! link Boolean Constant
+ hi! link Character Constant
+ hi Comment ctermfg=DarkGrey ctermbg=NONE cterm=NONE
+ hi! link Conditional Statement
+ hi Constant ctermfg=Green ctermbg=NONE cterm=NONE
+ hi! link Define PreProc
+ hi! link Debug Special
+ hi! link Delimiter Special
+ hi! link Exception Statement
+ hi! link Float Constant
+ hi Function ctermfg=Cyan ctermbg=NONE cterm=NONE
+ hi Identifier ctermfg=Blue ctermbg=NONE cterm=NONE
+ hi Ignore ctermfg=fg ctermbg=NONE cterm=NONE
+ hi! link Include PreProc
+ hi! link Keyword Statement
+ hi! link Label Statement
+ hi! link Macro PreProc
+ hi! link Number Constant
+ hi! link Operator Statement
+ hi! link PreCondit PreProc
+ hi PreProc ctermfg=Cyan ctermbg=NONE cterm=NONE
+ hi! link Repeat Statement
+ hi! link SpecialChar Special
+ hi! link SpecialComment Special
+ hi Statement ctermfg=Red ctermbg=NONE cterm=NONE
+ hi! link StorageClass Type
+ hi Special ctermfg=Yellow ctermbg=NONE cterm=NONE
+ hi! link String Constant
+ hi! link Structure Type
+ hi! link Tag Special
+ hi Todo ctermfg=Cyan ctermbg=NONE cterm=reverse
+ hi Type ctermfg=DarkCyan ctermbg=NONE cterm=NONE
+ hi! link Typedef Type
+ hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline
+ hi! link lCursor Cursor
+ hi CursorIM ctermfg=NONE ctermbg=NONE cterm=reverse
+ hi ToolbarLine ctermfg=NONE ctermbg=DarkGrey cterm=NONE
+ hi ToolbarButton ctermfg=Black ctermbg=DarkGrey cterm=bold
+ hi! link iCursor Cursor
+ hi! link vCursor Cursor
+ hi NormalMode ctermfg=DarkGrey ctermbg=White cterm=reverse
+ hi InsertMode ctermfg=Blue ctermbg=White cterm=reverse
+ hi ReplaceMode ctermfg=Cyan ctermbg=White cterm=reverse
+ hi VisualMode ctermfg=Yellow ctermbg=White cterm=reverse
+ hi CommandMode ctermfg=Magenta ctermbg=White cterm=reverse
+ hi Warnings ctermfg=Yellow ctermbg=White cterm=reverse
+ if !s:italics
+ hi CursorColumn cterm=bold
+ hi CursorLine cterm=bold
+ endif
+ if has('nvim')
+ hi! link TermCursor Cursor
+ hi TermCursorNC ctermfg=White ctermbg=Black cterm=NONE
+ endif
+ unlet s:t_Co s:italics
+ finish
+endif
+
+" Background: light
+" Color: fg0 #2e3440 ~ Black
+" Color: fg1 #37474f ~ Black
+" Color: fg2 #455a64 ~ DarkGrey
+" Color: fg3 #546e7a ~ DarkGrey
+" Color: fg4 #90a4ae ~ LightGrey
+" Color: bg0 #eff1f4 ~ White
+" Color: bg1 #e4e6eb ~ White
+" Color: bg2 #cdd2db ~ LightGrey
+" Color: bg3 #b6bdcb ~ DarkGrey
+" Color: bg4 #9fa8ba ~ DarkGrey
+" Color: black #121419 ~ Black
+" Color: darkgray #575c66 ~ DarkGray
+" Color: red #ae1528 ~ Red
+" Color: brightred #ddabbc ~ LightRed
+" Color: darkred #971223 ~ DarkRed
+" Color: green #009a5a ~ Green
+" Color: brightgreen #abddcc ~ LightGreen
+" Color: darkgreen #00814b ~ DarkGreen
+" Color: yellow #ff8c00 ~ Yellow
+" Color: brightyellow #ffc57f ~ LightYellow
+" Color: darkyellow #cc7000 ~ DarkYellow
+" Color: blue #004bb4 ~ Blue
+" Color: brightblue #aec0e0 ~ LightBlue
+" Color: darkblue #00409b ~ DarkBlue
+" Color: magenta #b300a4 ~ Magenta
+" Color: brightmagenta #fc86ec ~ LightMagenta
+" Color: darkmagenta #9a008d ~ DarkMagenta
+" Color: cyan #008d9a ~ Cyan
+" Color: brightcyan #00d3e7 ~ LightCyan
+" Color: darkcyan #007681 ~ DarkCyan
+" Color: white #eff1f4 ~ White
+" Color: brightwhite #ffffff ~ White
+" Term Colors: black darkred darkgreen darkyellow darkblue darkmagenta darkcyan white
+" Term Colors: darkgray red green yellow blue magenta cyan brightwhite
+" Background: dark
+" Color: fg0 #eff1f4 ~ White
+" Color: fg1 #e4e6eb ~ White
+" Color: fg2 #cdd2db ~ LightGrey
+" Color: fg3 #b6bdcb ~ DarkGrey
+" Color: fg4 #9fa8ba ~ DarkGrey
+" Color: bg0 #2e3440 ~ Black
+" Color: bg1 #37474f ~ Black
+" Color: bg2 #455a64 ~ DarkGrey
+" Color: bg3 #546e7a ~ DarkGrey
+" Color: bg4 #90a4ae ~ LightGrey
+" Color: black #121419 ~ Black
+" Color: darkgray #575c66 ~ DarkGray
+" Color: red #e84256 ~ Red
+" Color: brightred #ddabbc ~ LightRed
+" Color: darkred #dc1b33 ~ DarkRed
+" Color: green #00bf8a ~ Green
+" Color: brightgreen #abddcc ~ LightGreen
+" Color: darkgreen #008c65 ~ DarkGreen
+" Color: yellow #fff176 ~ Yellow
+" Color: brightyellow #ffffa8 ~ LightYellow
+" Color: darkyellow #e5d85c ~ DarkYellow
+" Color: blue #6699cc ~ Blue
+" Color: brightblue #aec0e0 ~ LightBlue
+" Color: darkblue #517aa3 ~ DarkBlue
+" Color: magenta #fa75e2 ~ Magenta
+" Color: brightmagenta #fc86ec ~ LightMagenta
+" Color: darkmagenta #f844d8 ~ DarkMagenta
+" Color: cyan #00bbcc ~ Cyan
+" Color: brightcyan #99eaea ~ LightCyan
+" Color: darkcyan #0095a3 ~ DarkCyan
+" Color: white #eff1f4 ~ White
+" Color: brightwhite #ffffff ~ White
+" Term Colors: darkgray red green yellow blue magenta cyan brightwhite
+" Term Colors: black darkred darkgreen darkyellow darkblue darkmagenta darkcyan white
+" vim: et ts=2 sw=2
--- /dev/null
+*artesanal.txt* For Vim version 8.2 Last change: 2020 Mar 15
+
+
+ Artesanal color scheme by Stefan Wimmer <wimstefan@gmail.com>
+
+
+ Artesanal colorscheme *artesanal*
+
+Artesanal is my personal colorscheme.
+
+It supports dark and light backgrounds, so you must set 'background'
+before loading the colorscheme. For example:
+
+ set background=dark
+ colorscheme artesanal
+
+Artesanal requires at least 256 colors and supports "true color" terminals.
+
+==============================================================================
+Colorscheme options artesanal-options*
+
+ *g:artesanal_transp_bg*
+Set to 1 if you want a transparent background.
+Takes effect only in the terminal.
+
+ let g:artesanal_transp_bg = 0
+
--- /dev/null
+# vim: ft=colortemplate fdm=marker
+
+# Default highlight groups {{{
+#if !has('gui_running') && get(g:, '@optionprefix_transp_bg', 0)
+ # Transparent background
+ Normal fg1 none
+ CursorLineNr yellow none
+ FoldColumn darkgray none
+ SignColumn fg2 none
+ VertSplit bg3 none
+#else
+ # Opaque background
+ Normal fg1 bg0
+ CursorLineNr yellow bg1
+ FoldColumn darkgray bg1
+ SignColumn fg2 bg1
+ VertSplit bg3 bg0
+#endif
+
+# Group Fg Bg Attributes
+ColorColumn none bg1 bold
+Conceal blue none
+Cursor none none reverse,bold
+CursorColumn none none italic,bold
+CursorLine none none italic,bold
+DiffAdd brightgreen black reverse
+DiffAdded brightgreen black reverse
+DiffChange brightblue black reverse
+DiffDelete brightred black reverse
+DiffRemoved brightred black reverse
+DiffText brightgreen black reverse
+Directory blue none bold
+EndOfBuffer bg0 none
+Error red none t=reverse,bold g=standout,bold
+ErrorMsg -> Error
+Folded bg3 bg1 g=italic
+IncSearch yellow black reverse
+LineNr bg3 bg1
+MatchParen none bg2 bold
+ModeMsg blue none
+MoreMsg green none
+NonText bg4 none
+Pmenu fg1 bg2
+PmenuSbar none bg2
+PmenuSel bg1 fg2 bold
+PmenuThumb none bg4
+Question darkyellow none
+QuickFixLine -> Search
+Search brightyellow black reverse
+SpecialKey bg4 none
+SpellBad red none t=underline g=italic,undercurl s=red
+SpellCap blue none t=underline g=italic,undercurl s=blue
+SpellLocal cyan none t=underline g=italic,undercurl s=cyan
+SpellRare magenta none t=underline g=italic,undercurl s=magenta
+StatusLine bg2 fg1 reverse
+StatusLineNC bg1 fg2 reverse
+StatusLineTerm -> StatusLine
+StatusLineTermNC -> StatusLineNC
+TabLine -> TabLineFill
+TabLineFill fg2 bg3
+TabLineSel fg1 bg1
+Title fg0 none bold
+Visual none bg1
+VisualNOS -> Visual
+WarningMsg red none
+WildMenu blue bg2 bold
+# Other conventional group names (see `:help group-name`)
+Boolean -> Constant
+Character -> Constant
+Comment fg3 none
+Conditional -> Statement
+Constant green none
+Define -> PreProc
+Debug -> Special
+Delimiter -> Special
+Exception -> Statement
+Float -> Constant
+Function cyan none
+Identifier blue none
+Ignore fg none
+Include -> PreProc
+Keyword -> Statement
+Label -> Statement
+Macro -> PreProc
+Number -> Constant
+Operator -> Statement
+PreCondit -> PreProc
+PreProc cyan none
+Repeat -> Statement
+SpecialChar -> Special
+SpecialComment -> Special
+Statement red none
+StorageClass -> Type
+Special yellow none
+String -> Constant
+Structure -> Type
+Tag -> Special
+Todo cyan none reverse
+Type darkcyan none
+Typedef -> Type
+Underlined none none underline
+# Language mapping cursor
+lCursor -> Cursor
+# See `:help CursorIM`
+CursorIM none none reverse
+# See `:help window-toolbar`
+ToolbarLine none bg3
+ToolbarButton fg0 bg3 bold
+# }}}
+
+# Additional highlight groups {{{
+# Input mode cursor
+iCursor -> Cursor
+# Visual mode cursor, selection
+vCursor -> Cursor
+
+# Useful for custom status lines
+NormalMode fg2 bg0 reverse
+InsertMode blue bg0 reverse
+ReplaceMode cyan bg0 reverse
+VisualMode yellow bg0 reverse
+CommandMode magenta bg0 reverse
+Warnings yellow bg0 reverse
+# }}}
+
+# Terminal colors {{{
+TermCursor -> Cursor
+TermCursorNC bg1 fg1
+# }}}
+
--- /dev/null
+# vim: ft=colortemplate sessionoptions=buffers,tabpages,winsize,folds
+
+# Comment out (do not delete) the definitions that you want to keep at their default.
+# Color name GUI Base256 Base16 (optional)
+Color: black #121419 ~ Black
+Color: darkgray #575c66 ~ DarkGray
+Color: red #e84256 ~ Red
+Color: brightred #ddabbc ~ LightRed
+Color: darkred #dc1b33 ~ DarkRed
+Color: green #00bf8a ~ Green
+Color: brightgreen #abddcc ~ LightGreen
+Color: darkgreen #008c65 ~ DarkGreen
+Color: yellow #fff176 ~ Yellow
+Color: brightyellow #ffffa8 ~ LightYellow
+Color: darkyellow #e5d85c ~ DarkYellow
+Color: blue #6699cc ~ Blue
+Color: brightblue #aec0e0 ~ LightBlue
+Color: darkblue #517aa3 ~ DarkBlue
+Color: magenta #fa75e2 ~ Magenta
+Color: brightmagenta #fc86ec ~ LightMagenta
+Color: darkmagenta #f844d8 ~ DarkMagenta
+Color: cyan #00bbcc ~ Cyan
+Color: brightcyan #99eaea ~ LightCyan
+Color: darkcyan #0095a3 ~ DarkCyan
+Color: white #eff1f4 ~ White
+Color: brightwhite #ffffff ~ White
+
+Term Colors: darkgray red green yellow blue magenta cyan brightwhite
+Term Colors: black darkred darkgreen darkyellow darkblue darkmagenta darkcyan white
+
+Include: _common.colortemplate
--- /dev/null
+# vim: ft=colortemplate fdm=marker noet ts=8 tw=78
+
+documentation
+*@shortname.txt* For Vim version @vimversion Last change: @date
+
+
+ @fullname color scheme by @maintainer
+
+
+ @fullname colorscheme *@shortname*
+
+@fullname is my personal colorscheme.
+
+It supports dark and light backgrounds, so you must set 'background'
+before loading the colorscheme. For example:
+
+ set background=dark
+ colorscheme @shortname
+
+@fullname requires at least 256 colors and supports "true color" terminals.
+
+==============================================================================
+Colorscheme options @shortname-options*
+
+ *g:@optionprefix_transp_bg*
+Set to 1 if you want a transparent background.
+Takes effect only in the terminal.
+
+ let g:@optionprefix_transp_bg = 0
+
+enddocumentation
--- /dev/null
+# vim: ft=colortemplate sessionoptions=buffers,tabpages,winsize,folds
+
+# Comment out (do not delete) the definitions that you want to keep at their default.
+# Color name GUI Base256 Base16 (optional)
+Color: black #121419 ~ Black
+Color: darkgray #575c66 ~ DarkGray
+Color: red #ae1528 ~ Red
+Color: brightred #ddabbc ~ LightRed
+Color: darkred #971223 ~ DarkRed
+Color: green #009a5a ~ Green
+Color: brightgreen #abddcc ~ LightGreen
+Color: darkgreen #00814b ~ DarkGreen
+Color: yellow #ff8c00 ~ Yellow
+Color: brightyellow #ffc57f ~ LightYellow
+Color: darkyellow #cc7000 ~ DarkYellow
+Color: blue #004bb4 ~ Blue
+Color: brightblue #aec0e0 ~ LightBlue
+Color: darkblue #00409b ~ DarkBlue
+Color: magenta #b300a4 ~ Magenta
+Color: brightmagenta #fc86ec ~ LightMagenta
+Color: darkmagenta #9a008d ~ DarkMagenta
+Color: cyan #008d9a ~ Cyan
+Color: brightcyan #00d3e7 ~ LightCyan
+Color: darkcyan #007681 ~ DarkCyan
+Color: white #eff1f4 ~ White
+Color: brightwhite #ffffff ~ White
+
+Term Colors: black darkred darkgreen darkyellow darkblue darkmagenta darkcyan white
+Term Colors: darkgray red green yellow blue magenta cyan brightwhite
+
+Include: _common.colortemplate
--- /dev/null
+# vim: ft=colortemplate sessionoptions=buffers,tabpages,winsize,folds
+
+Full name: Artesanal
+Short name: artesanal
+Author: Stefan Wimmer <wimstefan@gmail.com>
+Maintainer: Stefan Wimmer <wimstefan@gmail.com>
+Website: https://github.com/wimstefan/vim-artesanal
+Description: A Vim colorscheme with light and dark variants originally based on Material Design (now strongly modified to my likings).
+Variant: gui 256 16
+Option Prefix: artesanal
+NeoVim: yes
+
+Include: _help.colortemplate
+
+Background: light
+Variant: gui 256 16
+Color: fg0 #2e3440 ~ Black
+Color: fg1 #37474f ~ Black
+Color: fg2 #455a64 ~ DarkGrey
+Color: fg3 #546e7a ~ DarkGrey
+Color: fg4 #90a4ae ~ LightGrey
+Color: bg0 #eff1f4 ~ White
+Color: bg1 #e4e6eb ~ White
+Color: bg2 #cdd2db ~ LightGrey
+Color: bg3 #b6bdcb ~ DarkGrey
+Color: bg4 #9fa8ba ~ DarkGrey
+Include: _light.colortemplate
+
+Background: dark
+Variant: gui 256 16
+Color: fg0 #eff1f4 ~ White
+Color: fg1 #e4e6eb ~ White
+Color: fg2 #cdd2db ~ LightGrey
+Color: fg3 #b6bdcb ~ DarkGrey
+Color: fg4 #9fa8ba ~ DarkGrey
+Color: bg0 #2e3440 ~ Black
+Color: bg1 #37474f ~ Black
+Color: bg2 #455a64 ~ DarkGrey
+Color: bg3 #546e7a ~ DarkGrey
+Color: bg4 #90a4ae ~ LightGrey
+Include: _dark.colortemplate
+
--- /dev/null
+Copyright (c) 2014, Vincent Driessen
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
--- /dev/null
+vim-flake8
+==========
+`vim-flake8` is a Vim plugin that runs the currently open file through Flake8,
+a static syntax and style checker for Python source code. It supersedes both
+[vim-pyflakes](https://github.com/nvie/vim-pyflakes) and
+[vim-pep8](https://github.com/nvie/vim-pep8).
+
+[Flake8](https://pypi.python.org/pypi/flake8/) is a wrapper around PyFlakes
+(static syntax checker), PEP8 (style checker) and Ned's MacCabe script
+(complexity checker).
+
+
+Installation
+------------
+
+Make sure you've installed the
+[flake8](https://pypi.python.org/pypi/flake8/) package.
+
+If you use vim >= 8, install this plugin with:
+```
+mkdir -p ~/.vim/pack/flake8/start/
+cd ~/.vim/pack/flake8/start/
+git clone https://github.com/nvie/vim-flake8.git
+```
+
+Otherwise, install [vim-pathogen](https://github.com/tpope/vim-pathogen)
+if you're not using it already. Then, simply put the
+contents of this repository in your `~/.vim/bundle` directory.
+
+Usage
+-----
+1. Open a Python file
+2. Press `<F7>` to run `flake8` on it
+
+It shows the errors inside a quickfix window, which will allow your to quickly
+jump to the error locations by simply pressing [Enter].
+
+If any of `g:flake8_show_in_gutter` or `g:flake8_show_in_file` are set to `1`, call:
+
+ call flake8#Flake8UnplaceMarkers()
+
+To remove all markers. No default mapping is provided.
+
+Customization
+-------------
+If you don't want to use the `<F7>` key for flake8-checking, simply remap it to
+another key. It autodetects whether it has been remapped and won't register
+the `<F7>` key if so. For example, to remap it to `<F3>` instead, use:
+
+ autocmd FileType python map <buffer> <F3> :call flake8#Flake8()<CR>
+
+For flake8 configuration options please consult the following page:
+
+http://flake8.pycqa.org/en/latest/user/configuration.html
+
+To customize the location of your flake8 binary, set `g:flake8_cmd`:
+
+ let g:flake8_cmd="/opt/strangebin/flake8000"
+
+To customize the location of quick fix window, set `g:flake8_quickfix_location`:
+
+ let g:flake8_quickfix_location="topleft"
+
+To customize the height of quick fix window, set `g:flake8_quickfix_height`:
+
+ let g:flake8_quickfix_height=7
+
+To customize whether the quickfix window opens, set `g:flake8_show_quickfix`:
+
+ let g:flake8_show_quickfix=0 " don't show
+ let g:flake8_show_quickfix=1 " show (default)
+
+To customize whether the show signs in the gutter, set `g:flake8_show_in_gutter`:
+
+ let g:flake8_show_in_gutter=0 " don't show (default)
+ let g:flake8_show_in_gutter=1 " show
+
+To customize whether the show marks in the file, set `g:flake8_show_in_file`:
+
+ let g:flake8_show_in_file=0 " don't show (default)
+ let g:flake8_show_in_file=1 " show
+
+To customize the number of marks to show, set `g:flake8_max_markers`:
+
+ let g:flake8_max_markers=500 " (default)
+
+To customize the gutter markers, set any of `flake8_error_marker`, `flake8_warning_marker`,
+`flake8_pyflake_marker`, `flake8_complexity_marker`, `flake8_naming_marker`. Setting one to
+the empty string disables it. Ex.:
+
+ flake8_error_marker='EE' " set error marker to 'EE'
+ flake8_warning_marker='WW' " set warning marker to 'WW'
+ flake8_pyflake_marker='' " disable PyFlakes warnings
+ flake8_complexity_marker='' " disable McCabe complexity warnings
+ flake8_naming_marker='' " disable naming warnings
+
+To customize the colors used for markers, define the highlight groups, `Flake8_Error`,
+`Flake8_Warning`, `Flake8_PyFlake`, `Flake8_Complexity`, `Flake8_Naming`:
+
+ " to use colors defined in the colorscheme
+ highlight link Flake8_Error Error
+ highlight link Flake8_Warning WarningMsg
+ highlight link Flake8_Complexity WarningMsg
+ highlight link Flake8_Naming WarningMsg
+ highlight link Flake8_PyFlake WarningMsg
+
+To show the error message of the current line in the ruler, call `flake8#ShowError()`:
+
+ " add binding to call the function
+ nnoremap <C-K> :call flake8#Flake8ShowError()<cr>
+
+
+Tips
+----
+A tip might be to run the Flake8 check every time you write a Python file, to
+enable this, add the following line to your `.vimrc` file (thanks
+[Godefroid](https://github.com/gotcha)!):
+
+ autocmd BufWritePost *.py call flake8#Flake8()
+
+This plugin goes well together with the following plugin:
+
+- [PyUnit](https://github.com/nvie/vim-pyunit) (unit test helper under `<F8>`
+ and `<F9>`)
+
+
+Max line lengths
+----------------
+
+One particular customization a lot of people like to make is relaxing the
+maximum line length default. This is a config setting that should be set in
+flake8 itself. (vim-flake8 "just" invokes it and deals with showing the output
+in Vim's quickfix window.)
+
+To do so, put the following into your `~/.config/flake8` file:
+
+ [flake8]
+ max-line-length = 120
+
+
+History
+-------
+1.6: Deprecated configuring flake8 options through Vim settings. Instead,
+advise users to use the `~/.config/flake8` config file.
+
+ - Decprecated options:
+ - `g:flake8_builtins`
+ - `g:flake8_ignore`
+ - `g:flake8_max_line_length`
+ - `g:flake8_max_complexity`
+
+ - New options:
+ - `g:flake8_quickfix_height`
+
+1.5: Added markers and the option to don't show the quickfix window, also split
+functions into a autoload file. Added:
+
+ - Options:
+ - `g:flake8_show_quickfix`
+ - `g:flake8_show_in_gutter`
+ - `g:flake8_show_in_file`
+ - `g:flake8_max_markers`
+ - `flake8_error_marker`
+ - `flake8_warning_marker`
+ - `flake8_pyflake_marker`
+ - `flake8_complexity_marker`
+ - `flake8_naming_marker`
+ - Functions:
+ - `flake8#Flake8UnplaceMarkers()`
+ - `flake8#Flake8()`
+ - Highlighting:
+ - `Flake8_Error`
+ - `Flake8_Warning`
+ - `Flake8_Complexity`
+ - `Flake8_Naming`
+ - `Flake8_PyFlake`
+
+1.4: Suppress output to stdout.
+
+1.3: Added the following options:
+
+ - `g:flake8_builtins="_,apply"`
+ - `g:flake8_max_complexity=10`
+
+1.2: Added the following options:
+
+ - `g:flake8_cmd="/opt/strangebin/flake8000"`
+ - `g:flake8_max_line_length=120`
+ - `g:flake8_ignore="E501,W293"`
+
+1.1: Added `g:flake8_ignore` option.
+
+1.0: Initial version.
+
+
+License
+-------
+
+Liberally licensed under BSD terms.
--- /dev/null
+"
+" Python filetype plugin for running flake8
+" Language: Python (ft=python)
+" Maintainer: Vincent Driessen <vincent@3rdcloud.com>
+" Version: Vim 7 (may work with lower Vim versions, but not tested)
+" URL: http://github.com/nvie/vim-flake8
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+"" ** external ** {{{
+
+function! flake8#Flake8()
+ call s:Flake8()
+ call s:Warnings()
+endfunction
+
+function! flake8#Flake8UnplaceMarkers()
+ call s:UnplaceMarkers()
+ call s:Warnings()
+endfunction
+
+function! flake8#Flake8ShowError()
+ call s:ShowErrorMessage()
+endfunction
+
+"" }}}
+
+"" ** internal ** {{{
+
+"" warnings
+
+let s:displayed_warnings = 0
+function s:Warnings()
+ if !s:displayed_warnings
+ let l:show_website_url = 0
+
+ let l:msg = "has been deprecated in favour of flake8 config files"
+ for setting_name in ['g:flake8_ignore', 'g:flake8_builtins', 'g:flake8_max_line_length', 'g:flake8_max_complexity']
+ if exists(setting_name)
+ echohl WarningMsg | echom setting_name l:msg | echohl None
+ let l:show_website_url = 1
+ endif
+ endfor
+
+ if l:show_website_url
+ let l:url = "http://flake8.readthedocs.org/en/latest/config.html"
+ echohl WarningMsg | echom l:url | echohl None
+ endif
+ let s:displayed_warnings = 1
+ endif
+endfunction
+
+"" config
+
+function! s:DeclareOption(name, globalPrefix, default) " {{{
+ if !exists('g:'.a:name)
+ if a:default != ''
+ execute 'let s:'.a:name.'='.a:default
+ else
+ execute 'let s:'.a:name.'=""'
+ endif
+ else
+ execute 'let l:global="g:".a:name'
+ if l:global != ''
+ execute 'let s:'.a:name.'="'.a:globalPrefix.'".g:'.a:name
+ else
+ execute 'let s:'.a:name.'=""'
+ endif
+ endif
+endfunction " }}}
+
+function! s:Setup() " {{{
+ "" read options
+
+ " flake8 command
+ call s:DeclareOption('flake8_cmd', '', '"flake8"')
+ " quickfix
+ call s:DeclareOption('flake8_quickfix_location', '', '"belowright"')
+ call s:DeclareOption('flake8_quickfix_height', '', 5)
+ call s:DeclareOption('flake8_show_quickfix', '', 1)
+ " markers to show
+ call s:DeclareOption('flake8_show_in_gutter', '', 0)
+ call s:DeclareOption('flake8_show_in_file', '', 0)
+ call s:DeclareOption('flake8_max_markers', '', 500)
+ " marker signs
+ call s:DeclareOption('flake8_error_marker', '', '"E>"')
+ call s:DeclareOption('flake8_warning_marker', '', '"W>"')
+ call s:DeclareOption('flake8_pyflake_marker', '', '"F>"')
+ call s:DeclareOption('flake8_complexity_marker', '', '"C>"')
+ call s:DeclareOption('flake8_naming_marker', '', '"N>"')
+
+ "" setup markerdata
+
+ if !exists('s:markerdata')
+ let s:markerdata = {}
+ let s:markerdata['E'] = {'name': 'Flake8_Error'}
+ let s:markerdata['W'] = {'name': 'Flake8_Warning'}
+ let s:markerdata['F'] = {'name': 'Flake8_PyFlake'}
+ let s:markerdata['C'] = {'name': 'Flake8_Complexity'}
+ let s:markerdata['N'] = {'name': 'Flake8_Nameing'}
+ endif
+ let s:markerdata['E'].marker = s:flake8_error_marker
+ let s:markerdata['W'].marker = s:flake8_warning_marker
+ let s:markerdata['F'].marker = s:flake8_pyflake_marker
+ let s:markerdata['C'].marker = s:flake8_complexity_marker
+ let s:markerdata['N'].marker = s:flake8_naming_marker
+
+endfunction " }}}
+
+"" do flake8
+
+function! s:Flake8() " {{{
+ " read config
+ call s:Setup()
+
+ let l:executable = split(s:flake8_cmd)[0]
+
+ if !executable(l:executable)
+ echoerr "File " . l:executable . " not found. Please install it first."
+ return
+ endif
+
+ " clear old
+ call s:UnplaceMarkers()
+ let s:matchids = []
+ let s:signids = []
+
+ " store old grep settings (to restore later)
+ let l:old_gfm=&grepformat
+ let l:old_gp=&grepprg
+ let l:old_shellpipe=&shellpipe
+ let l:old_t_ti=&t_ti
+ let l:old_t_te=&t_te
+
+ " write any changes before continuing
+ if &readonly == 0
+ update
+ endif
+
+ set lazyredraw " delay redrawing
+
+ " prevent terminal from blinking
+ set shellpipe=>
+ set t_ti=
+ set t_te=
+
+ " perform the grep itself
+ let &grepformat="%f:%l:%c: %m\,%f:%l: %m,%-G%\\d"
+ let &grepprg=s:flake8_cmd
+ silent! grep! "%"
+ " close any existing cwindows,
+ " placed after 'grep' in case quickfix is open on autocmd QuickFixCmdPost
+ cclose
+
+ " restore grep settings
+ let &grepformat=l:old_gfm
+ let &grepprg=l:old_gp
+ let &shellpipe=l:old_shellpipe
+ let &t_ti=l:old_t_ti
+ let &t_te=l:old_t_te
+ " store mapping of line number to error string
+
+ " process results
+ let s:resultDict = {}
+
+ let l:results=getqflist()
+ let l:has_results=results != []
+ if l:has_results
+ " save line number of each error message
+ for result in l:results
+ let linenum = result.lnum
+ let s:resultDict[linenum] = result.text
+ endfor
+
+ " markers
+ if !s:flake8_show_in_gutter == 0 || !s:flake8_show_in_file == 0
+ call s:PlaceMarkers(l:results)
+ endif
+ " quickfix
+ if !s:flake8_show_quickfix == 0
+ " open cwindow
+ execute s:flake8_quickfix_location." copen".s:flake8_quickfix_height
+ setlocal wrap
+ nnoremap <buffer> <silent> c :cclose<CR>
+ nnoremap <buffer> <silent> q :cclose<CR>
+ endif
+ endif
+
+ set nolazyredraw
+ redraw!
+
+ " Show status
+ if l:has_results == 0
+ echon "Flake8 check OK"
+ else
+ echon "Flake8 found issues"
+ endif
+endfunction " }}}
+
+
+
+"" markers
+function! s:PlaceMarkers(results) " {{{
+ " in gutter?
+ if !s:flake8_show_in_gutter == 0
+ " define signs
+ for val in values(s:markerdata)
+ if val.marker != ''
+ execute "sign define ".val.name." text=".val.marker." texthl=".val.name
+ endif
+ endfor
+ endif
+
+ " place
+ let l:index0 = 100
+ let l:index = l:index0
+ for result in a:results
+ if l:index >= (s:flake8_max_markers+l:index0)
+ break
+ endif
+ let l:type = strpart(result.text, 0, 1)
+ if has_key(s:markerdata, l:type) && s:markerdata[l:type].marker != ''
+ " file markers
+ if !s:flake8_show_in_file == 0
+ if !has_key(s:markerdata[l:type], 'matchstr')
+ let s:markerdata[l:type].matchstr = '\%('
+ else
+ let s:markerdata[l:type].matchstr .= '\|'
+ endif
+ let s:markerdata[l:type].matchstr .= '\%'.result.lnum.'l\%'.result.col.'c'
+ endif
+ " gutter markers
+ if !s:flake8_show_in_gutter == 0
+ execute ":sign place ".index." name=".s:markerdata[l:type].name
+ \ . " line=".result.lnum." file=".expand("%:p")
+ let s:signids += [l:index]
+ endif
+ let l:index += 1
+ endif
+ endfor
+
+ " in file?
+ if !s:flake8_show_in_file == 0
+ for l:val in values(s:markerdata)
+ if l:val.marker != '' && has_key(l:val, 'matchstr')
+ let l:val.matchid = matchadd(l:val.name, l:val.matchstr.'\)')
+ endif
+ endfor
+ endif
+endfunction " }}}
+
+function! s:UnplaceMarkers() " {{{
+ " gutter markers
+ if exists('s:signids')
+ for i in s:signids
+ execute ":sign unplace ".i
+ endfor
+ unlet s:signids
+ endif
+ " file markers
+ for l:val in values(s:markerdata)
+ if has_key(l:val, 'matchid')
+ call matchdelete(l:val.matchid)
+ unlet l:val.matchid
+ unlet l:val.matchstr
+ endif
+ endfor
+endfunction " }}}
+
+function! s:ShowErrorMessage() " {{{
+ let l:cursorPos = getpos(".")
+ if !exists('s:resultDict')
+ return
+ endif
+ if !exists('b:showing_message')
+ " ensure showing msg is always defined
+ let b:showing_message = ' '
+ endif
+
+ " if there is a message on the current line,
+ " then echo it
+ if has_key(s:resultDict, l:cursorPos[1])
+ let l:errorText = get(s:resultDict, l:cursorPos[1])
+ echo strpart(l:errorText, 0, &columns-1)
+ let b:showing_message = 1
+ endif
+
+ " if a message is already being shown,
+ " then clear it
+ if !b:showing_message == 0
+ echo
+ let b:showing_message = 0
+ endif
+
+endfunction " }}}
+
+"" }}}
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
--- /dev/null
+"
+" Python filetype plugin for running flake8
+" Language: Python (ft=python)
+" Maintainer: Vincent Driessen <vincent@3rdcloud.com>
+" Version: Vim 7 (may work with lower Vim versions, but not tested)
+" URL: http://github.com/nvie/vim-flake8
+"
+" Only do this when not done yet for this buffer
+if exists("b:loaded_flake8_ftplugin")
+ finish
+endif
+let b:loaded_flake8_ftplugin=1
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+"" Highlight groups for errors
+" pep8 errors
+highlight default Flake8_Error
+ \ ctermbg=DarkRed ctermfg=Red cterm=bold
+ \ guibg=DarkRed guifg=Red gui=bold
+" pep8 warnings
+highlight default Flake8_Warning
+ \ ctermbg=Yellow ctermfg=DarkYellow cterm=bold
+ \ guibg=Yellow guifg=DarkYellow gui=bold
+" PyFlakes codes
+highlight default Flake8_PyFlake
+ \ ctermbg=DarkBlue ctermfg=Blue cterm=bold
+ \ guibg=DarkBlue guifg=Blue gui=bold
+" McCabe complexity warnings
+highlight default Flake8_Complexity
+ \ ctermbg=DarkBlue ctermfg=Blue cterm=bold
+ \ guibg=DarkBlue guifg=Blue gui=bold
+" naming conventions
+highlight default Flake8_Naming
+ \ ctermbg=DarkBlue ctermfg=Blue cterm=bold
+ \ guibg=DarkBlue guifg=Blue gui=bold
+
+" to not break with old versions
+function! Flake8()
+ call flake8#Flake8()
+endfunction
+
+" Add mappings, unless the user didn't want this.
+" The default mapping is registered under to <F7> by default, unless the user
+" remapped it already (or a mapping exists already for <F7>)
+if !exists("no_plugin_maps") && !exists("no_flake8_maps")
+ if !hasmapto('Flake8(') && !hasmapto('flake8#Flake8(')
+ noremap <buffer> <F7> :call flake8#Flake8()<CR>
+ endif
+endif
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
--- /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
+version: 2
+
+common: &common
+ working_directory: ~/repo
+ docker:
+ - image: blueyed/vim-python-pep8-indent-vims-for-test:3@sha256:e7e3c4f4b021954a40f2f1d88dc470f119dc65603c63724d1c58cbe437fdc2d4
+
+jobs:
+ test:
+ <<: *common
+ steps:
+ - checkout
+ - run:
+ name: Run tests
+ command: |
+ spec/make-coverage
+ - run:
+ name: Report coverage
+ command: |
+ covimerage xml
+ codecov -X search gcov pycov -f coverage.xml
+
+ checkqa:
+ <<: *common
+ steps:
+ - checkout
+ - run:
+ name: Lint
+ command: |
+ vint **/*.vim
+
+workflows:
+ version: 2
+ test:
+ jobs:
+ - test
+ - checkqa
--- /dev/null
+[run]
+plugins = covimerage
+data_file = .coverage_covimerage
+source = indent/python.vim
+
+[report]
+include = indent/python.vim
--- /dev/null
+*
+!Gemfile
--- /dev/null
+.*.swp
+.coverage_covimerage
+Gemfile.lock
--- /dev/null
+How To Contribute
+=================
+
+``vim-python-pep8-indent`` is always open for suggestions and contributions by generous developers.
+I’ve collected a few tips to get you started.
+
+Please:
+
+- *Always* add tests for your code.
+- Write `good commit messages`_.
+
+
+Running Tests
+-------------
+
+- They are written in Ruby_ (sorry :() using vimrunner_ which requires rspec_.
+- The tests go into ``spec/indent/indent_spec.rb``.
+ Look at the ``describe`` blocks to get the hang of it.
+- Run the tests with the command::
+
+ $ rspec spec
+- Alternatively you can use Docker::
+
+ $ make test_docker
+
+- You can select tests based on line numbers, e.g.::
+
+ $ rspec ./spec/indent/indent_spec.rb:385
+ $ make test_docker RSPEC_ARGS=./spec/indent/indent_spec.rb:385
+
+Thank you for considering to contribute!
+
+
+.. _Ruby: https://www.ruby-lang.org/
+.. _`good commit messages`: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
+.. _vimrunner: https://github.com/AndrewRadev/vimrunner
+.. _rspec: https://github.com/rspec/rspec
--- /dev/null
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+ HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display,
+ communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+ likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+ v. rights protecting the extraction, dissemination, use and reuse of data
+ in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation
+ thereof, including any amended or successor version of such
+ directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+ world based on applicable law or treaty, and any national
+ implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+ warranties of any kind concerning the Work, express, implied,
+ statutory or otherwise, including without limitation warranties of
+ title, merchantability, fitness for a particular purpose, non
+ infringement, or the absence of latent or other defects, accuracy, or
+ the present or absence of errors, whether or not discoverable, all to
+ the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without
+ limitation any person's Copyright and Related Rights in the Work.
+ Further, Affirmer disclaims responsibility for obtaining any necessary
+ consents, permissions or other rights required for any use of the
+ Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to
+ this CC0 or use of the Work.
--- /dev/null
+FROM testbed/vim:latest
+
+RUN apk --no-cache add gtk+2.0-dev libx11-dev libxt-dev mcookie xauth xvfb
+# NOTE: +profile needs huge features.
+RUN install_vim -tag v8.1.0129 -name vim --with-features=huge \
+ --disable-channel --disable-netbeans --disable-xim \
+ --enable-gui=gtk2 --with-x -build
+RUN ln -s /vim-build/bin/vim /usr/bin/gvim
+RUN gvim --version
+
+# Install covimerage and vint.
+# NOTE: we have py2 already via gtk+2.0-dev.
+# NOTE: enum34+pathlib+typing gets installed as workaround for broken vim-vint wheel.
+RUN apk --no-cache add py2-pip \
+ && pip install --no-cache-dir codecov covimerage==0.0.9 vim-vint enum34 pathlib typing \
+ && rm -rf /usr/include /usr/lib/python*/turtle* /usr/lib/python*/tkinter
+
+WORKDIR /vim-python-pep8-indent
+
+ADD Gemfile .
+RUN apk --no-cache add coreutils ruby-bundler
+RUN bundle install
+
+ENTRYPOINT ["rspec", "spec"]
--- /dev/null
+source 'https://rubygems.org'
+gem "vimrunner", "0.3.4"
+gem "rspec"
--- /dev/null
+test:
+ VIMRUNNER_REUSE_SERVER=1 xvfb-run bundle exec rspec
+
+# Run tests in dockerized Vims.
+DOCKER_REPO:=blueyed/vim-python-pep8-indent-vims-for-test
+DOCKER_TAG:=3
+DOCKER_IMAGE:=$(DOCKER_REPO):$(DOCKER_TAG)
+
+docker_image:
+ docker build -t $(DOCKER_REPO):$(DOCKER_TAG) .
+docker_push:
+ docker push $(DOCKER_REPO):$(DOCKER_TAG)
+docker_update_latest:
+ docker tag $(DOCKER_REPO):$(DOCKER_TAG) $(DOCKER_REPO):latest
+ docker push $(DOCKER_REPO):latest
+
+test_docker: XVFB_ERRORFILE:=/dev/null
+test_docker:
+ @set -x; export DISPLAY=$(if $(VIMRUNNER_TEST_DISPLAY),$(VIMRUNNER_TEST_DISPLAY),172.17.0.1:99; Xvfb -ac -listen tcp :99 >$(XVFB_ERRORFILE) 2>&1 & XVFB_PID=$$!); \
+ docker run --rm -ti -e DISPLAY -e VIMRUNNER_REUSE_SERVER=1 \
+ -v $(CURDIR):/vim-python-pep8-indent $(DOCKER_IMAGE) $(RSPEC_ARGS) \
+ $(if $(VIMRUNNER_TEST_DISPLAY),,; ret=$$?; kill $$XVFB_PID; exit $$ret)
+
+test_coverage:
+ spec/make-coverage
--- /dev/null
+vim-python-pep8-indent
+======================
+
+.. image:: https://circleci.com/gh/Vimjas/vim-python-pep8-indent.svg?style=svg
+ :target: https://circleci.com/gh/Vimjas/vim-python-pep8-indent
+.. image:: https://codecov.io/gh/Vimjas/vim-python-pep8-indent/branch/master/graph/badge.svg
+ :target: https://codecov.io/gh/Vimjas/vim-python-pep8-indent
+
+This small script modifies Vim_’s indentation behavior to comply with PEP8_ and my aesthetic preferences.
+Most importantly::
+
+ foobar(foo,
+ bar)
+
+and::
+
+ foobar(
+ foo,
+ bar
+ )
+
+
+Installation
+------------
+
+Install the plugin using your favorite plugin manager / method, a few examples
+follow:
+
+Pathogen
+^^^^^^^^
+
+Follow the instructions on installing Pathogen_ and then:
+
+.. code-block:: shell-session
+
+ $ cd ~/.vim/bundle
+ $ git clone https://github.com/Vimjas/vim-python-pep8-indent.git
+
+
+Vundle
+^^^^^^
+
+Follow the instructions on installing Vundle_ and add the appropriate plugin line into your ``.vimrc``:
+
+.. code-block:: vim
+
+ Plugin 'Vimjas/vim-python-pep8-indent'
+
+
+NeoBundle
+^^^^^^^^^
+
+Follow the instructions on installing NeoBundle_ and add the appropriate NeoBundle line into your ``.vimrc``:
+
+.. code-block:: vim
+
+ NeoBundle 'Vimjas/vim-python-pep8-indent'
+
+
+Configuration
+-------------
+
+g:python_pep8_indent_multiline_string
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+You can configure the initial indentation of multiline strings using ``g:python_pep8_indent_multiline_string`` (which can also be set per buffer).
+This defaults to ``0``, which means that multiline strings are not indented.
+``-1`` and positive values will be used as-is, where ``-1`` is a special value for Vim's ``indentexpr``, and will keep the existing indent (using Vim's ``autoindent`` setting).
+``-2`` is meant to be used for strings that are wrapped with ``textwrap.dedent`` etc. It will add a level of indentation if the multiline string started in the previous line, without any content in it already::
+
+ testdir.makeconftest("""
+ _
+
+With content already, it will be aligned to the opening parenthesis::
+
+ testdir.makeconftest("""def pytest_addoption(parser):
+ _
+
+Existing indentation (including ``0``) in multiline strings will be kept, so this setting only applies to the indentation of new/empty lines.
+
+g:python_pep8_indent_hang_closing
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Control closing bracket indentation with ``python_pep8_indent_hang_closing``, set globally or per buffer.
+
+By default (set to ``0``), closing brackets line up with the opening line::
+
+ my_list = [
+ 1, 2, 3,
+ 4, 5, 6,
+ ]
+ result = some_function_that_takes_arguments(
+ 'a', 'b', 'c',
+ 'd', 'e', 'f',
+ )
+
+With ``python_pep8_indent_hang_closing = 1``, closing brackets line up with the items::
+
+ my_list = [
+ 1, 2, 3,
+ 4, 5, 6,
+ ]
+ result = some_function_that_takes_arguments(
+ 'a', 'b', 'c',
+ 'd', 'e', 'f',
+ )
+
+
+Troubleshooting
+---------------
+
+In case it is not working, please make sure your Vim is configured to load
+indent files (``filetype indent on``).
+This is typically the case when using a plugin manager, but check its docs.
+
+Check ``:verbose set indentexpr?`` in a Python file, which should show
+something like the following:
+
+ indentexpr=GetPythonPEPIndent(v:lnum)
+ Last set from ~/…/plugged/vim-python-pep8-indent/indent/python.vim
+
+
+Notes
+-----
+
+Please note that Kirill Klenov’s python-mode_ ships its own version of this bundle.
+Therefore, if you want to use this version specifically, you’ll have to disable python-mode’s using:
+
+.. code-block:: vim
+
+ let g:pymode_indent = 0
+
+
+License and Authorship
+----------------------
+
+This script is based on one from Vim’s official `script repo`_ that was *not* originally written by me.
+Unfortunately the indentation was off by one character in one case and the script hasn’t been updated since 2005.
+
+Even more unfortunately, I wasn’t able to reach any of the original authors/maintainers:
+**David Bustos** and **Eric Mc Sween**.
+
+So I fixed the annoyance with the help of `Steve Losh`_ and am putting it out here so you don’t have to patch the original yourself.
+The original patch is still available here_.
+
+Over the time a lot more improvements have been contributed_ by `generous people`_.
+
+I’d like to thank the original authors here for their work and release it hereby to the *Public Domain* (using the CC0_ licence) since I hope that would be in their spirit.
+If anyone with a say in this objects, please let me_ know immediately.
+Also, if someone is in contact with one of them, I would appreciate being introduced.
+
+While my Vimscript_ skills are still feeble, I intend to maintain it for now.
+This mainly means that I’ll triage through bugs and pull requests but won’t be fixing much myself.
+
+
+.. _Vim: http://www.vim.org/
+.. _PEP8: http://www.python.org/dev/peps/pep-0008/
+.. _`script repo`: http://www.vim.org/scripts/script.php?script_id=974
+.. _`Steve Losh`: http://stevelosh.com/
+.. _here: https://gist.github.com/2965846
+.. _Neobundle: https://github.com/Shougo/neobundle.vim
+.. _Pathogen: https://github.com/tpope/vim-pathogen
+.. _python-mode: https://github.com/klen/python-mode
+.. _`Vimscript`: http://learnvimscriptthehardway.stevelosh.com/
+.. _vundle: https://github.com/gmarik/Vundle.vim
+.. _me: https://hynek.me/
+.. _CC0: http://creativecommons.org/publicdomain/zero/1.0/
+.. _contributed: https://github.com/hynek/vim-python-pep8-indent/blob/master/CONTRIBUTING.rst
+.. _`generous people`: https://github.com/hynek/vim-python-pep8-indent/graphs/contributors
--- /dev/null
+version: '2'
+services:
+ rspec:
+ build: .
+ volumes:
+ - .:/vim-python-pep8-indent
--- /dev/null
+python.vim
\ No newline at end of file
--- /dev/null
+" PEP8 compatible Python indent file
+" Language: Python
+" Maintainer: Daniel Hahler <https://daniel.hahler.de/>
+" Prev Maintainer: Hynek Schlawack <hs@ox.cx>
+" Prev Maintainer: Eric Mc Sween <em@tomcom.de> (address invalid)
+" Original Author: David Bustos <bustos@caltech.edu> (address invalid)
+" License: CC0
+"
+" vim-python-pep8-indent - A nicer Python indentation style for vim.
+" Written in 2004 by David Bustos <bustos@caltech.edu>
+" Maintained from 2004-2005 by Eric Mc Sween <em@tomcom.de>
+" Maintained from 2013 by Hynek Schlawack <hs@ox.cx>
+" Maintained from 2017 by Daniel Hahler <https://daniel.hahler.de/>
+"
+" To the extent possible under law, the author(s) have dedicated all copyright
+" and related and neighboring rights to this software to the public domain
+" worldwide. This software is distributed without any warranty.
+" You should have received a copy of the CC0 Public Domain Dedication along
+" with this software. If not, see
+" <http://creativecommons.org/publicdomain/zero/1.0/>.
+
+" Only load this indent file when no other was loaded.
+if exists('b:did_indent')
+ finish
+endif
+let b:did_indent = 1
+
+setlocal nolisp
+setlocal autoindent
+setlocal indentexpr=GetPythonPEPIndent(v:lnum)
+setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif,=except
+
+if !exists('g:python_pep8_indent_multiline_string')
+ let g:python_pep8_indent_multiline_string = 0
+endif
+
+if !exists('g:python_pep8_indent_hang_closing')
+ let g:python_pep8_indent_hang_closing = 0
+endif
+
+" TODO: check required patch for timeout argument, likely lower than 7.3.429 though.
+if !exists('g:python_pep8_indent_searchpair_timeout')
+ if has('patch-8.0.1483')
+ let g:python_pep8_indent_searchpair_timeout = 150
+ else
+ let g:python_pep8_indent_searchpair_timeout = 0
+ endif
+endif
+
+let s:block_rules = {
+ \ '^\s*elif\>': [['if', 'elif'], ['else']],
+ \ '^\s*except\>': [['try', 'except'], []],
+ \ '^\s*finally\>': [['try', 'except', 'else'], []]
+ \ }
+let s:block_rules_multiple = {
+ \ '^\s*else\>': [['if', 'elif', 'for', 'try', 'except'], []]
+ \ }
+" Pairs to look for when searching for opening parenthesis.
+" The value is the maximum offset in lines.
+let s:paren_pairs = {'()': 50, '[]': 100, '{}': 1000}
+
+if &filetype ==# 'pyrex' || &filetype ==# 'cython'
+ let b:control_statement = '\v^\s*(class|def|if|while|with|for|except|cdef|cpdef)>'
+else
+ let b:control_statement = '\v^\s*(class|def|if|while|with|for|except)>'
+endif
+let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>'
+
+let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
+ \ '=~? "\\vcomment|jedi\\S"'
+
+let s:special_chars_syn_pattern = "\\vstring|comment|^pythonbytes%(contents)=$|pythonTodo|jedi\\S"
+
+if !get(g:, 'python_pep8_indent_skip_concealed', 0) || !has('conceal')
+ " Skip strings and comments. Return 1 for chars to skip.
+ " jedi* refers to syntax definitions from jedi-vim for call signatures, which
+ " are inserted temporarily into the buffer.
+ function! s:_skip_special_chars(line, col)
+ return synIDattr(synID(a:line, a:col, 0), 'name')
+ \ =~? s:special_chars_syn_pattern
+ endfunction
+else
+ " Also ignore anything concealed.
+ " TODO: doc; likely only necessary with jedi-vim, where a better version is
+ " planned (https://github.com/Vimjas/vim-python-pep8-indent/pull/98).
+
+ " Wrapper around synconcealed for older Vim (7.3.429, used on Travis CI).
+ function! s:is_concealed(line, col)
+ let concealed = synconcealed(a:line, a:col)
+ return len(concealed) && concealed[0]
+ endfunction
+
+ function! s:_skip_special_chars(line, col)
+ return synIDattr(synID(a:line, a:col, 0), 'name')
+ \ =~? s:special_chars_syn_pattern
+ \ || s:is_concealed(a:line, a:col)
+ endfunction
+endif
+
+" Use 'shiftwidth()' instead of '&sw'.
+" (Since Vim patch 7.3.629, 'shiftwidth' can be set to 0 to follow 'tabstop').
+if exists('*shiftwidth')
+ function! s:sw()
+ return shiftwidth()
+ endfunction
+else
+ function! s:sw()
+ return &shiftwidth
+ endfunction
+endif
+
+" Find backwards the closest open parenthesis/bracket/brace.
+function! s:find_opening_paren(lnum, col)
+ " Return if cursor is in a comment.
+ if synIDattr(synID(a:lnum, a:col, 0), 'name') =~? 'comment'
+ return [0, 0]
+ endif
+
+ call cursor(a:lnum, a:col)
+
+ let nearest = [0, 0]
+ let timeout = g:python_pep8_indent_searchpair_timeout
+ let skip_special_chars = 's:_skip_special_chars(line("."), col("."))'
+ for [p, maxoff] in items(s:paren_pairs)
+ let stopline = max([0, line('.') - maxoff, nearest[0]])
+ let next = searchpairpos(
+ \ '\V'.p[0], '', '\V'.p[1], 'bnW', skip_special_chars, stopline, timeout)
+ if next[0] && (next[0] > nearest[0] || (next[0] == nearest[0] && next[1] > nearest[1]))
+ let nearest = next
+ endif
+ endfor
+ return nearest
+endfunction
+
+" Find the start of a multi-line statement
+function! s:find_start_of_multiline_statement(lnum)
+ let lnum = a:lnum
+ while lnum > 0
+ if getline(lnum - 1) =~# '\\$'
+ let lnum = prevnonblank(lnum - 1)
+ else
+ let [paren_lnum, _] = s:find_opening_paren(lnum, 1)
+ if paren_lnum < 1
+ return lnum
+ else
+ let lnum = paren_lnum
+ endif
+ endif
+ endwhile
+endfunction
+
+" Find possible indent(s) of the block starter that matches the current line.
+function! s:find_start_of_block(lnum, types, skip, multiple) abort
+ let r = []
+ let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>'
+ if !empty(a:skip)
+ let re_skip = '\V\^\s\*\('.join(a:skip, '\|').'\)\>'
+ else
+ let re_skip = ''
+ endif
+ let last_indent = indent(a:lnum) + 1
+ let lnum = a:lnum - 1
+ while lnum > 0 && last_indent > 0
+ let indent = indent(lnum)
+ if indent < last_indent
+ let line = getline(lnum)
+ if !empty(re_skip) && line =~# re_skip
+ let last_indent = indent
+ elseif line =~# re
+ if !a:multiple
+ return [indent]
+ endif
+ if index(r, indent) == -1
+ let r += [indent]
+ endif
+ let last_indent = indent
+ endif
+ endif
+ let lnum = prevnonblank(lnum - 1)
+ endwhile
+ return r
+endfunction
+
+" Is "expr" true for every position in "lnum", beginning at "start"?
+" (optionally up to a:1 / 4th argument)
+function! s:match_expr_on_line(expr, lnum, start, ...)
+ let text = getline(a:lnum)
+ let end = a:0 ? a:1 : len(text)
+ if a:start > end
+ return 1
+ endif
+ let save_pos = getpos('.')
+ let r = 1
+ for i in range(a:start, end)
+ call cursor(a:lnum, i)
+ if !(eval(a:expr) || text[i-1] =~# '\s')
+ let r = 0
+ break
+ endif
+ endfor
+ call setpos('.', save_pos)
+ return r
+endfunction
+
+" Line up with open parenthesis/bracket/brace.
+function! s:indent_like_opening_paren(lnum)
+ let [paren_lnum, paren_col] = s:find_opening_paren(a:lnum, 1)
+ if paren_lnum <= 0
+ return -2
+ endif
+ let text = getline(paren_lnum)
+ let base = indent(paren_lnum)
+
+ let nothing_after_opening_paren = s:match_expr_on_line(
+ \ s:skip_after_opening_paren, paren_lnum, paren_col+1)
+ let starts_with_closing_paren = getline(a:lnum) =~# '^\s*[])}]'
+
+ let hang_closing = get(b:, 'python_pep8_indent_hang_closing',
+ \ get(g:, 'python_pep8_indent_hang_closing', 0))
+
+ if nothing_after_opening_paren
+ if starts_with_closing_paren && !hang_closing
+ let res = base
+ else
+ let res = base + s:sw()
+
+ " Special case for parenthesis.
+ if text[paren_col-1] ==# '(' && getline(a:lnum) !~# '\v\)\s*:?\s*$'
+ return res
+ endif
+ endif
+ else
+ " Indent to match position of opening paren.
+ let res = paren_col
+ endif
+
+ " If this line is the continuation of a control statement
+ " indent further to distinguish the continuation line
+ " from the next logical line.
+ if text =~# b:control_statement && res == base + s:sw()
+ " But only if not inside parens itself (Flake's E127).
+ let [paren_lnum, _] = s:find_opening_paren(paren_lnum, 1)
+ if paren_lnum <= 0
+ return res + s:sw()
+ endif
+ endif
+ return res
+endfunction
+
+" Match indent of first block of this type.
+function! s:indent_like_block(lnum)
+ let text = getline(a:lnum)
+ for [multiple, block_rules] in [
+ \ [0, s:block_rules],
+ \ [1, s:block_rules_multiple],
+ \ ]
+ for [line_re, blocks_ignore] in items(block_rules)
+ if text !~# line_re
+ continue
+ endif
+
+ let [blocks, skip] = blocks_ignore
+ let indents = s:find_start_of_block(a:lnum, blocks, skip, multiple)
+ if empty(indents)
+ return -1
+ endif
+ if len(indents) == 1
+ return indents[0]
+ endif
+
+ " Multiple valid indents, e.g. for 'else' with both try and if.
+ let indent = indent(a:lnum)
+ if index(indents, indent) != -1
+ " The indent is valid, keep it.
+ return indent
+ endif
+ " Fallback to the first/nearest one.
+ return indents[0]
+ endfor
+ endfor
+ return -2
+endfunction
+
+function! s:indent_like_previous_line(lnum)
+ let lnum = prevnonblank(a:lnum - 1)
+
+ " No previous line, keep current indent.
+ if lnum < 1
+ return -1
+ endif
+
+ let text = getline(lnum)
+ let start = s:find_start_of_multiline_statement(lnum)
+ let base = indent(start)
+ let current = indent(a:lnum)
+
+ " Ignore last character in previous line?
+ let lastcol = len(text)
+ let col = lastcol
+
+ " Search for final colon that is not inside something to be ignored.
+ while 1
+ if col == 1 | break | endif
+ if text[col-1] =~# '\s' || s:_skip_special_chars(lnum, col)
+ let col = col - 1
+ continue
+ elseif text[col-1] ==# ':'
+ return base + s:sw()
+ endif
+ break
+ endwhile
+
+ if text =~# '\\$' && !s:_skip_special_chars(lnum, lastcol)
+ " If this line is the continuation of a control statement
+ " indent further to distinguish the continuation line
+ " from the next logical line.
+ if getline(start) =~# b:control_statement
+ return base + s:sw() * 2
+ endif
+
+ " Nest (other) explicit continuations only one level deeper.
+ return base + s:sw()
+ endif
+
+ let empty = getline(a:lnum) =~# '^\s*$'
+
+ " Current and prev line are empty, next is not -> indent like next.
+ if empty && a:lnum > 1 &&
+ \ (getline(a:lnum - 1) =~# '^\s*$') &&
+ \ !(getline(a:lnum + 1) =~# '^\s*$')
+ return indent(a:lnum + 1)
+ endif
+
+ " If the previous statement was a stop-execution statement or a pass
+ if getline(start) =~# s:stop_statement
+ " Remove one level of indentation if the user hasn't already dedented
+ if empty || current > base - s:sw()
+ return base - s:sw()
+ endif
+ " Otherwise, trust the user
+ return -1
+ endif
+
+ if (current || !empty) && s:is_dedented_already(current, base)
+ return -1
+ endif
+
+ " In all other cases, line up with the start of the previous statement.
+ return base
+endfunction
+
+" If this line is dedented and the number of indent spaces is valid
+" (multiple of the indentation size), trust the user.
+function! s:is_dedented_already(current, base)
+ let dedent_size = a:current - a:base
+ return (dedent_size < 0 && a:current % s:sw() == 0) ? 1 : 0
+endfunction
+
+" Is the syntax at lnum (and optionally cnum) a python string?
+function! s:is_python_string(lnum, ...)
+ let line = getline(a:lnum)
+ if a:0
+ let cols = type(a:1) != type([]) ? [a:1] : a:1
+ else
+ let cols = range(1, max([1, len(line)]))
+ endif
+ for cnum in cols
+ if match(map(synstack(a:lnum, cnum),
+ \ "synIDattr(v:val, 'name')"), 'python\S*String') == -1
+ return 0
+ end
+ endfor
+ return 1
+endfunction
+
+function! GetPythonPEPIndent(lnum)
+ " First line has indent 0
+ if a:lnum == 1
+ return 0
+ endif
+
+ let line = getline(a:lnum)
+ let prevline = getline(a:lnum-1)
+
+ " Multilinestrings: continous, docstring or starting.
+ if s:is_python_string(a:lnum-1, max([1, len(prevline)]))
+ \ && (s:is_python_string(a:lnum, 1)
+ \ || match(line, '^\%("""\|''''''\)') != -1)
+
+ " Indent closing quotes as the line with the opening ones.
+ let match_quotes = match(line, '^\s*\zs\%("""\|''''''\)')
+ if match_quotes != -1
+ " closing multiline string
+ let quotes = line[match_quotes:(match_quotes+2)]
+ call cursor(a:lnum, 1)
+ let pairpos = searchpairpos(quotes, '', quotes, 'bW', '', 0, g:python_pep8_indent_searchpair_timeout)
+ if pairpos[0] != 0
+ return indent(pairpos[0])
+ else
+ return -1
+ endif
+ endif
+
+ if s:is_python_string(a:lnum-1)
+ " Previous line is (completely) a string: keep current indent.
+ return -1
+ endif
+
+ if match(prevline, '^\s*\%("""\|''''''\)') != -1
+ " docstring.
+ return indent(a:lnum-1)
+ endif
+
+ let indent_multi = get(b:, 'python_pep8_indent_multiline_string',
+ \ get(g:, 'python_pep8_indent_multiline_string', 0))
+ if match(prevline, '\v%("""|'''''')$') != -1
+ " Opening multiline string, started in previous line.
+ if (&autoindent && indent(a:lnum) == indent(a:lnum-1))
+ \ || match(line, '\v^\s+$') != -1
+ " <CR> with empty line or to split up 'foo("""bar' into
+ " 'foo("""' and 'bar'.
+ if indent_multi == -2
+ return indent(a:lnum-1) + s:sw()
+ endif
+ return indent_multi
+ endif
+ endif
+
+ " Keep existing indent.
+ if match(line, '\v^\s*\S') != -1
+ return -1
+ endif
+
+ if indent_multi != -2
+ return indent_multi
+ endif
+
+ return s:indent_like_opening_paren(a:lnum)
+ endif
+
+ " Parens: If we can find an open parenthesis/bracket/brace, line up with it.
+ let indent = s:indent_like_opening_paren(a:lnum)
+ if indent >= -1
+ return indent
+ endif
+
+ " Blocks: Match indent of first block of this type.
+ let indent = s:indent_like_block(a:lnum)
+ if indent >= -1
+ return indent
+ endif
+
+ return s:indent_like_previous_line(a:lnum)
+endfunction
--- /dev/null
+require "spec_helper"
+
+describe "handles byte strings" do
+ before(:all) {
+ vim.command 'syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell'
+ vim.command "syn match pythonBytesEscape '\\\\$'"
+ }
+
+ before(:each) {
+ # clear buffer
+ vim.normal 'gg"_dG'
+
+ # Insert two blank lines.
+ # The first line is a corner case in this plugin that would shadow the
+ # correct behaviour of other tests. Thus we explicitly jump to the first
+ # line when we require so.
+ vim.feedkeys 'i\<CR>\<CR>\<ESC>'
+ }
+
+ it "it does not indent to bracket in byte string" do
+ vim.feedkeys 'ireg = b"["\<Esc>'
+ vim.echo('map(synstack(line("."), col(".")), "synIDattr(v:val, \"name\")")'
+ ).should == "['pythonBytes']"
+ vim.feedkeys 'o'
+ indent.should == 0
+ end
+
+ it "it indents backslash continuation correctly" do
+ vim.feedkeys 'iwith foo, \<Bslash>\<Esc>'
+ vim.echo('getline(".")').should == "with foo, \\"
+ vim.echo('map(synstack(line("."), col(".")), "synIDattr(v:val, \"name\")")'
+ ).should == "['pythonBytesEscape']"
+ vim.feedkeys 'o'
+ indent.should == 8
+ end
+end
--- /dev/null
+require "spec_helper"
+
+describe "vim for cython" do
+ before(:all) {
+ vim.command "new"
+ vim.command "set ft=cython"
+ vim.command("set indentexpr?").should include "GetPythonPEPIndent("
+ }
+ before(:each) {
+ # clear buffer
+ vim.normal 'gg"_dG'
+
+ # Insert two blank lines.
+ # The first line is a corner case in this plugin that would shadow the
+ # correct behaviour of other tests. Thus we explicitly jump to the first
+ # line when we require so.
+ vim.feedkeys 'i\<CR>\<CR>\<ESC>'
+ }
+ after(:all) {
+ vim.command "bwipe!"
+ }
+
+ describe "when using a cdef function definition" do
+ it "indents shiftwidth spaces" do
+ vim.feedkeys 'icdef long_function_name(\<CR>arg'
+ indent.should == shiftwidth
+ end
+ end
+
+ describe "when using a cpdef function definition" do
+ it "indents shiftwidth spaces" do
+ vim.feedkeys 'icpdef long_function_name(\<CR>arg'
+ indent.should == shiftwidth
+ end
+ end
+end
--- /dev/null
+require "spec_helper"
+
+shared_examples_for "vim" do
+ before(:each) {
+ # clear buffer
+ vim.normal 'gg"_dG'
+
+ # Insert two blank lines.
+ # The first line is a corner case in this plugin that would shadow the
+ # correct behaviour of other tests. Thus we explicitly jump to the first
+ # line when we require so.
+ vim.feedkeys 'i\<CR>\<CR>\<ESC>'
+ }
+
+ describe "when using the indent plugin" do
+ it "sets the indentexpr and indentkeys options" do
+ vim.command("set indentexpr?").should include "GetPythonPEPIndent("
+ vim.command("set indentkeys?").should include "=elif"
+ end
+
+ it "sets autoindent and expandtab" do
+ vim.command("set autoindent?").should match(/\s*autoindent/)
+ vim.command("set expandtab?").should match(/\s*expandtab/)
+ end
+ end
+
+ describe "when entering the first line" do
+ before { vim.feedkeys '0ggipass' }
+
+ it "does not indent" do
+ indent.should == 0
+ proposed_indent.should == 0
+ end
+
+ it "does not indent when using '=='" do
+ vim.normal "=="
+ indent.should == 0
+ end
+ end
+
+ describe "when after a '(' that is at the end of its line" do
+ before { vim.feedkeys 'itest(\<CR>' }
+
+ it "indents by one level" do
+ proposed_indent.should == shiftwidth
+ vim.feedkeys 'something'
+ indent.should == shiftwidth
+ vim.normal '=='
+ indent.should == shiftwidth
+ end
+
+ it "puts the closing parenthesis at the same level" do
+ vim.feedkeys ')'
+ indent.should == (hang_closing ? shiftwidth : 0)
+ end
+ end
+
+ describe "when after an '(' that is followed by something" do
+ before { vim.feedkeys 'itest(something,\<CR>' }
+
+ it "lines up on following lines" do
+ indent.should == 5
+ vim.feedkeys 'more,\<CR>'
+ indent.should == 5
+ end
+
+ it "lines up the closing parenthesis" do
+ vim.feedkeys ')'
+ indent.should == 5
+ end
+
+ it "does not touch the closing parenthesis if it is already indented further" do
+ vim.feedkeys ' )'
+ indent.should == 7
+ end
+ end
+
+ describe "when after an '{' that is followed by a comment" do
+ before { vim.feedkeys 'imydict = { # comment\<CR>' }
+
+ it "indent by one level" do
+ indent.should == shiftwidth
+ vim.feedkeys '1: 1,\<CR>'
+ indent.should == shiftwidth
+ end
+
+ it "lines up the closing parenthesis" do
+ vim.feedkeys '}'
+ indent.should == (hang_closing ? shiftwidth : 0)
+ end
+ end
+
+ describe "when using gq to reindent a '(' that is" do
+ before { vim.feedkeys 'itest(' }
+ it "something and has a string without spaces at the end" do
+ vim.feedkeys 'something_very_long_blaaaaaaaaa, "some_very_long_string_blaaaaaaaaaaaaaaaaaaaa"\<esc>gqq'
+ indent.should == 5
+ end
+ end
+
+ describe "when after multiple parens of different types" do
+ it "indents by one level" do
+ vim.feedkeys 'if({\<CR>'
+ indent.should == shiftwidth
+ end
+
+ it "lines up with the last paren" do
+ vim.feedkeys 'ifff({123: 456,\<CR>'
+ indent.should == 5
+ end
+ end
+
+ describe "when '#' is contained in a string that is followed by a colon" do
+ it "indents by one level" do
+ vim.feedkeys 'iif "some#thing" == "test":#test\<CR>pass'
+ indent.should == shiftwidth
+ end
+ end
+
+ describe "when '#' is not contained in a string and is followed by a colon" do
+ it "does not indent" do
+ vim.feedkeys 'iif "some#thing" == "test"#:test\<CR>'
+ indent.should == 0
+ end
+ end
+
+ describe "when inside an unfinished string" do
+ it "does not indent" do
+ vim.feedkeys 'i"test:\<ESC>'
+ vim.echo('synIDattr(synID(line("."), col("."), 0), "name")'
+ ).downcase.should include 'string'
+ vim.feedkeys 'a\<CR>'
+ proposed_indent.should == -1
+ indent.should == 0
+ end
+
+ it "does not dedent" do
+ vim.feedkeys 'iif True:\<CR>"test:\<ESC>'
+ vim.echo('synIDattr(synID(line("."), col("."), 0), "name")'
+ ).downcase.should include 'string'
+ proposed_indent.should == shiftwidth
+ indent.should == shiftwidth
+ end
+ end
+
+ describe "when the previous line has a colon in a string" do
+ before { vim.feedkeys 'itest(":".join(["1","2"]))\<CR>' }
+ it "does not indent" do
+ vim.feedkeys 'if True:'
+ indent.should == 0
+ proposed_indent.should == 0
+ end
+ end
+
+ describe "when the previous line has a list slice" do
+ it "does not indent" do
+ vim.feedkeys 'ib = a[2:]\<CR>'
+ indent.should == 0
+ proposed_indent.should == 0
+ end
+ end
+
+ describe "when line is empty inside a block" do
+ it "is indented like the previous line" do
+ vim.feedkeys 'idef a():\<CR>1\<CR>\<CR>2\<ESC>kcc'
+ indent.should == shiftwidth
+ end
+ end
+
+ describe "when an empty line is after empty line / before non-empty" do
+ it "is indented like the next line" do
+ vim.feedkeys 'idef a():\<CR>1\<CR>\<CR>\<CR>2\<ESC><<kcc'
+ indent.should == 0
+ end
+ end
+
+ describe "when an empty line is after empty line / before non-empty (nested)" do
+ it "is indented like the next line" do
+ vim.feedkeys 'idef a():\<CR>1\<CR>\<CR>\<CR>\<ESC>0i\<TAB>2\<ESC>kcc'
+ indent.should == shiftwidth
+ end
+ end
+
+ describe "when line is empty inside a block following multi-line statement" do
+ it "is indented like the previous line" do
+ vim.feedkeys 'idef a():\<CR>x = (1 +\<CR>2)\<CR>\<CR>y\<ESC>kcc'
+ indent.should == shiftwidth
+ end
+ end
+
+ describe "when line is empty inside a block following stop statement" do
+ it "is indented like the previous line minus shiftwidth" do
+ vim.feedkeys 'iif x:\<CR>if y:\<CR>pass\<CR>\<CR>z\<ESC>kcc'
+ indent.should == shiftwidth
+ end
+ end
+
+ describe "when using simple control structures" do
+ it "indents shiftwidth spaces" do
+ vim.feedkeys 'iwhile True:\<CR>pass'
+ indent.should == shiftwidth
+ end
+ end
+
+ describe "when using a function definition" do
+ it "handles indent with closing parenthesis on same line" do
+ vim.feedkeys 'idef long_function_name(\<CR>arg'
+ indent.should == shiftwidth
+ vim.feedkeys '):'
+ indent.should == shiftwidth * 2
+ end
+
+ it "handles indent with closing parenthesis on new line" do
+ vim.feedkeys 'idef long_function_name(\<CR>arg'
+ indent.should == shiftwidth
+ vim.feedkeys '\<CR>'
+ indent.should == shiftwidth
+ vim.feedkeys ')'
+ indent.should == (hang_closing ? shiftwidth * 2 : 0)
+ vim.feedkeys ':'
+ indent.should == (hang_closing ? shiftwidth * 2 : 0)
+ vim.feedkeys '\<Esc>k'
+ indent.should == shiftwidth
+ end
+ end
+
+ describe "when using a class definition" do
+ it "indents shiftwidth spaces" do
+ vim.feedkeys 'iclass Foo(\<CR>'
+ indent.should == shiftwidth
+ end
+ end
+
+ describe "when writing an 'else' block" do
+ it "aligns to the preceeding 'for' block" do
+ vim.feedkeys 'ifor x in "abc":\<CR>pass\<CR>else:'
+ indent.should == 0
+ end
+
+ it "aligns to the preceeding 'if' block" do
+ vim.feedkeys 'ifor x in "abc":\<CR>if True:\<CR>pass\<CR>else:'
+ indent.should == shiftwidth
+ end
+ end
+
+ describe "when using parens and control statements" do
+ it "avoids ambiguity by using extra indentation" do
+ vim.feedkeys 'iif (111 and\<CR>'
+ if shiftwidth == 4
+ indent.should == shiftwidth * 2
+ else
+ indent.should == 4
+ end
+ vim.feedkeys '222):\<CR>'
+ indent.should == shiftwidth
+ vim.feedkeys 'pass\<CR>'
+ indent.should == 0
+ end
+
+ it "still aligns parens properly if not ambiguous" do
+ vim.feedkeys 'iwhile (111 and\<CR>'
+ indent.should == 7
+ vim.feedkeys '222):\<CR>'
+ indent.should == shiftwidth
+ vim.feedkeys 'pass\<CR>'
+ indent.should == 0
+ end
+
+ it "handles nested expressions (Flake8's E127)" do
+ vim.feedkeys 'i[\<CR>x for x in foo\<CR>if (\<CR>'
+ indent.should == shiftwidth * 2
+ end
+
+ it "still handles multiple parens correctly" do
+ vim.feedkeys 'iif (111 and (222 and 333\<CR>'
+ indent.should == 13
+ vim.feedkeys 'and 444\<CR>'
+ indent.should == 13
+ vim.feedkeys ')\<CR>'
+ if shiftwidth == 4
+ indent.should == shiftwidth * 2
+ else
+ indent.should == 4
+ end
+ vim.feedkeys 'and 555):\<CR>'
+ indent.should == shiftwidth
+ vim.feedkeys 'pass\<CR>'
+ indent.should == 0
+ end
+ end
+
+ describe "when a line breaks with a manual '\\'" do
+ it "indents shiftwidth spaces on normal line" do
+ vim.feedkeys 'ivalue = test + \\\\\<CR>'
+ indent.should == shiftwidth
+ end
+
+ it "indents 2x shiftwidth spaces for control structures" do
+ vim.feedkeys 'iif somevalue == xyz and \\\\\<CR>'
+ indent.should == shiftwidth * 2
+ end
+
+ it "indents relative to line above" do
+ vim.feedkeys 'i\<TAB>value = test + \\\\\<CR>'
+ indent.should == shiftwidth * 2
+ end
+ end
+
+ describe "when current line is dedented compared to previous line" do
+ before { vim.feedkeys 'i\<TAB>\<TAB>if x:\<CR>y = True\<CR>\<ESC>' }
+ it "and current line has a valid indentation (Part 1)" do
+ vim.feedkeys '0i\<TAB>if y:'
+ proposed_indent.should == -1
+ end
+
+ it "and current line has a valid indentation (Part 2)" do
+ vim.feedkeys '0i\<TAB>\<TAB>if y:'
+ proposed_indent.should == -1
+ end
+
+ it "and current line has an invalid indentation" do
+ vim.feedkeys 'i while True:\<CR>'
+ indent.should == previous_indent + shiftwidth
+ end
+ end
+
+ describe "when current line is dedented compared to the last non-empty line" do
+ before { vim.feedkeys 'i\<TAB>\<TAB>if x:\<CR>y = True\<CR>\<CR>\<ESC>' }
+ it "and current line has a valid indentation" do
+ vim.feedkeys '0i\<TAB>if y:'
+ proposed_indent.should == -1
+ end
+ end
+
+ describe "when an 'if' is followed by" do
+ before { vim.feedkeys 'i\<TAB>\<TAB>if x:\<CR>' }
+ it "an elif, it lines up with the 'if'" do
+ vim.feedkeys 'elif y:'
+ indent.should == shiftwidth * 2
+ end
+
+ it "an 'else', it lines up with the 'if'" do
+ vim.feedkeys 'else:'
+ indent.should == shiftwidth * 2
+ end
+ end
+
+ describe "when an 'if' contains a try-except" do
+ before {
+ vim.feedkeys 'iif x:\<CR>try:\<CR>pass\<CR>except:\<CR>pass\<CR>'
+ indent.should == shiftwidth
+ }
+ it "an 'else' should be indented to the try" do
+ vim.feedkeys 'else:'
+ indent.should == shiftwidth
+ proposed_indent.should == shiftwidth
+ end
+ it "an 'else' should keep the indent of the 'if'" do
+ vim.feedkeys 'else:\<ESC><<'
+ indent.should == 0
+ proposed_indent.should == 0
+ end
+ end
+
+ describe "when a 'for' is followed by" do
+ before { vim.feedkeys 'i\<TAB>\<TAB>for x in y:\<CR>' }
+ it "an 'else', it lines up with the 'for'" do
+ vim.feedkeys 'else:'
+ indent.should == shiftwidth * 2
+ end
+ end
+
+ describe "when an 'else' is followed by" do
+ before { vim.feedkeys 'i\<TAB>\<TAB>else:\<CR>XXX\<CR>' }
+ it "a 'finally', it lines up with the 'else'" do
+ vim.feedkeys 'finally:'
+ indent.should == shiftwidth * 2
+ end
+ end
+
+
+ describe "when a 'try' is followed by" do
+ before { vim.feedkeys 'i\<TAB>\<TAB>try:\<CR>' }
+ it "an 'except', it lines up with the 'try'" do
+ vim.feedkeys 'except:'
+ indent.should == shiftwidth * 2
+ end
+
+ it "an 'else', it lines up with the 'try'" do
+ vim.feedkeys 'else:'
+ indent.should == shiftwidth * 2
+ end
+
+ it "a 'finally', it lines up with the 'try'" do
+ vim.feedkeys 'finally:'
+ indent.should == shiftwidth * 2
+ end
+ end
+
+ describe "when an 'except' is followed by" do
+ before { vim.feedkeys 'i\<TAB>\<TAB>except:\<CR>' }
+ it "an 'else', it lines up with the 'except'" do
+ vim.feedkeys 'else:'
+ indent.should == shiftwidth * 2
+ end
+
+ it "another 'except', it lines up with the previous 'except'" do
+ vim.feedkeys 'except:'
+ indent.should == shiftwidth * 2
+ end
+
+ it "a 'finally', it lines up with the 'except'" do
+ vim.feedkeys 'finally:'
+ indent.should == shiftwidth * 2
+ end
+ end
+
+ describe "when an else is used inside of a nested if" do
+ before { vim.feedkeys 'iif foo:\<CR>if bar:\<CR>pass\<CR>' }
+ it "indents the else to the inner if" do
+ vim.feedkeys 'else:'
+ indent.should == shiftwidth
+ end
+ end
+
+ describe "when an else is used outside of a nested if" do
+ before { vim.feedkeys 'iif True:\<CR>if True:\<CR>pass\<CR>\<Esc>0' }
+ it "indents the else to the outer if" do
+ indent.should == 0
+ proposed_indent.should == shiftwidth
+
+ vim.feedkeys 'ielse:'
+ indent.should == 0
+ proposed_indent.should == 0
+ end
+ end
+
+ describe "when jedi-vim call signatures are used" do
+ before { vim.command 'syn match jediFunction "JEDI_CALL_SIGNATURE" keepend extend' }
+
+ it "ignores the call signature after a colon" do
+ vim.feedkeys 'iif True: JEDI_CALL_SIGNATURE\<CR>'
+ indent.should == shiftwidth
+ end
+
+ it "ignores the call signature after a function" do
+ vim.feedkeys 'idef f( JEDI_CALL_SIGNATURE\<CR>'
+ indent.should == shiftwidth
+ end
+ end
+end
+
+shared_examples_for "multiline strings" do
+ before(:each) {
+ # clear buffer
+ vim.normal 'gg"_dG'
+
+ # Insert two blank lines.
+ # The first line is a corner case in this plugin that would shadow the
+ # correct behaviour of other tests. Thus we explicitly jump to the first
+ # line when we require so.
+ vim.feedkeys 'i\<CR>\<CR>\<ESC>'
+ }
+
+ describe "when after an '(' that is followed by an unfinished string" do
+ before { vim.feedkeys 'itest("""' }
+
+ it "it indents the next line" do
+ vim.feedkeys '\<CR>'
+ expected_proposed, expected_indent = multiline_indent(0, shiftwidth)
+ proposed_indent.should == expected_proposed
+ indent.should == expected_indent
+ end
+
+ it "with contents it indents the second line to the parenthesis" do
+ vim.feedkeys 'second line\<CR>'
+ expected_proposed, expected_indent = multiline_indent(0, 5)
+ proposed_indent.should == expected_proposed
+ indent.should == expected_indent
+ end
+ end
+
+ describe "when after assigning an unfinished string" do
+ before { vim.feedkeys 'itest = """' }
+
+ it "it indents the next line" do
+ vim.feedkeys '\<CR>'
+ expected_proposed, expected_indent = multiline_indent(0, shiftwidth)
+ proposed_indent.should == expected_proposed
+ indent.should == expected_indent
+ end
+ end
+
+ describe "when after assigning an indented unfinished string" do
+ before { vim.feedkeys 'i test = """' }
+
+ it "it indents the next line" do
+ vim.feedkeys '\<CR>'
+ expected_proposed, expected_indent = multiline_indent(4, shiftwidth + 4)
+ proposed_indent.should == expected_proposed
+ indent.should == expected_indent
+ end
+ end
+
+ describe "when after assigning an indented finished string" do
+ before { vim.feedkeys 'i test = ""' }
+
+ it "it does indent the next line" do
+ vim.feedkeys '\<CR>'
+ indent.should == 4
+ end
+
+ it "and writing a new string, it does indent the next line" do
+ vim.feedkeys '\<CR>""'
+ indent.should == 4
+ end
+ end
+
+ describe "when after a docstring" do
+ it "it does indent the next line to the docstring" do
+ vim.feedkeys 'i """\<CR>'
+ indent.should == 4
+ proposed_indent.should == 4
+ end
+
+ it "indents the closing docstring quotes" do
+ vim.feedkeys 'i """\<CR>\<CR>"""'
+ indent.should == 4
+ proposed_indent.should == 4
+ vim.echo('getline(3)').should == ' """'
+ end
+
+ it "indents non-matching docstring quotes" do
+ vim.feedkeys 'i """\<CR>\<Esc>'
+ vim.feedkeys "0C'''"
+ vim.echo('line(".")').should == "4"
+ vim.echo('getline(".")').should == "'''"
+ indent.should == 0
+ proposed_indent.should == -1
+ end
+ end
+
+ describe "when after a docstring with contents" do
+ before { vim.feedkeys 'i """First line' }
+ it "it does indent the next line to the docstring" do
+ vim.feedkeys '\<CR>'
+ indent.should == 4
+ proposed_indent.should == 4
+ end
+ end
+
+ describe "when breaking a string after opening parenthesis" do
+ before { vim.feedkeys 'i foo("""bar\<Left>\<Left>\<Left>' }
+ it "it does indent the next line as after an opening multistring" do
+ vim.feedkeys '\<CR>'
+ _, expected_indent = multiline_indent(4, 4 + shiftwidth)
+ indent.should == expected_indent
+ proposed_indent.should == -1
+
+ # it keeps the indent after an empty line
+ vim.feedkeys '\<CR>'
+ proposed_indent, expected_indent = multiline_indent(4, 4 + shiftwidth)
+ indent.should == expected_indent
+ proposed_indent.should == proposed_indent
+
+ # it keeps the indent of nonblank above
+ vim.feedkeys '\<End>\<CR>'
+ proposed_indent, expected_indent = multiline_indent(4, 4 + shiftwidth)
+ indent.should == expected_indent
+ proposed_indent.should == proposed_indent
+
+ # it keeps the indent of nonblank above before an empty line
+ vim.feedkeys '\<CR>'
+ proposed_indent, expected_indent = multiline_indent(4, 4 + shiftwidth)
+ indent.should == expected_indent
+ proposed_indent.should == proposed_indent
+ end
+ end
+end
+
+SUITE_SHIFTWIDTHS = [4, 3]
+SUITE_HANG_CLOSINGS = [false, true]
+
+SUITE_SHIFTWIDTHS.each do |sw|
+ describe "vim when using width of #{sw}" do
+ before {
+ vim.command("set sw=#{sw} ts=#{sw} sts=#{sw} et")
+ }
+ it "sets shiftwidth to #{sw}" do
+ shiftwidth.should == sw
+ end
+
+ SUITE_HANG_CLOSINGS.each do |hc|
+ describe "vim when hang_closing is set to #{hc}" do
+ before {
+ set_hang_closing hc
+ }
+ it "sets hang_closing to #{hc}" do
+ hang_closing.should == !!hc
+ end
+
+ it_behaves_like "vim"
+ end
+ end
+ end
+end
+
+describe "vim when not using python_pep8_indent_multiline_string" do
+ before {
+ vim.command("set sw=4 ts=4 sts=4 et")
+ vim.command("unlet! g:python_pep8_indent_multiline_string")
+ }
+ it_behaves_like "multiline strings"
+end
+
+describe "vim when using python_pep8_indent_multiline_first=0" do
+ before {
+ vim.command("set sw=4 ts=4 sts=4 et")
+ vim.command("let g:python_pep8_indent_multiline_string=0")
+ }
+ it_behaves_like "multiline strings"
+end
+
+describe "vim when using python_pep8_indent_multiline_string=-1" do
+ before {
+ vim.command("set sw=4 ts=4 sts=4 et")
+ vim.command("let g:python_pep8_indent_multiline_string=-1")
+ }
+ it_behaves_like "multiline strings"
+end
+
+describe "vim when using python_pep8_indent_multiline_string=-2" do
+ before {
+ vim.command("set sw=4 ts=4 sts=4 et")
+ vim.command("let g:python_pep8_indent_multiline_string=-2")
+ }
+ it_behaves_like "multiline strings"
+end
+
+describe "Handles far away opening parens" do
+ before { vim.feedkeys '\<ESC>ggdGifrom foo import (' }
+
+ it "indents by one level" do
+ vim.feedkeys '\<CR>'
+ proposed_indent.should == shiftwidth
+ end
+
+ it "indents by one level for 10 lines" do
+ vim.command('set paste | exe "norm 9o" | set nopaste')
+ vim.feedkeys '\<Esc>o'
+ indent.should == shiftwidth
+ end
+
+ it "indents by one level for 50 lines" do
+ vim.command('set paste | exe "norm 49o" | set nopaste')
+ vim.feedkeys '\<Esc>o'
+ indent.should == shiftwidth
+ end
+end
+
+describe "Handles far away opening square brackets" do
+ before { vim.feedkeys '\<ESC>ggdGibar = [' }
+
+ it "indents by one level" do
+ vim.feedkeys '\<CR>'
+ proposed_indent.should == shiftwidth
+ end
+
+ it "indents by one level for 10 lines" do
+ vim.command('set paste | exe "norm 9o" | set nopaste')
+ vim.feedkeys '\<Esc>o'
+ indent.should == shiftwidth
+ end
+
+ it "indents by one level for 100 lines" do
+ vim.command('set paste | exe "norm 99o" | set nopaste')
+ vim.feedkeys '\<Esc>o'
+ indent.should == shiftwidth
+ end
+end
+
+describe "Handles far away opening curly brackets" do
+ before { vim.feedkeys '\<ESC>ggdGijson = {' }
+
+ it "indents by one level" do
+ vim.feedkeys '\<CR>'
+ vim.feedkeys '\<Esc>o'
+ proposed_indent.should == shiftwidth
+ end
+
+ it "indents by one level for 10 lines" do
+ vim.command('set paste | exe "norm 9o" | set nopaste')
+ vim.feedkeys '\<Esc>o'
+ indent.should == shiftwidth
+ end
+
+ it "indents by one level for 1000 lines" do
+ vim.command('set paste | exe "norm 999o" | set nopaste')
+ vim.feedkeys '\<Esc>o'
+ indent.should == shiftwidth
+ end
+end
+
+describe "Compact multiline dict" do
+ before { vim.feedkeys '\<ESC>ggdGid = {"one": 1,' }
+
+ it "gets indented correctly" do
+ vim.feedkeys '\<CR>'
+ proposed_indent.should == 5
+
+ vim.feedkeys '"two": 2}'
+ proposed_indent.should == 5
+
+ vim.feedkeys '\<CR>'
+ proposed_indent.should == 0
+ end
+end
+
+describe "Using O" do
+ before {
+ vim.feedkeys '\<ESC>ggdG'
+ vim.feedkeys 'iif foo:\<CR>'
+ }
+
+ it "respects autoindent" do
+ vim.feedkeys '1\<CR>\<CR>'
+ indent.should == shiftwidth
+ vim.feedkeys '\<Esc>ko'
+ indent.should == shiftwidth
+ vim.feedkeys '\<Esc>kO'
+ indent.should == shiftwidth
+ # Uses/keeps indent from line above
+ vim.feedkeys '\<Esc>i2\<Esc>O'
+ indent.should == shiftwidth
+ # Uses/keeps indent from line above
+ vim.feedkeys '\<Esc>j\<Esc>O'
+ indent.should == 0
+ end
+end
+
+describe "searchpairpos" do
+ before { vim.feedkeys '\<ESC>ggdG' }
+ it "handles nested parenthesis" do
+ vim.feedkeys 'iif foo.startswith("("):\<CR>'
+ indent.should == shiftwidth
+ end
+end
+
+describe "o within TODO" do
+ before {
+ vim.feedkeys '\<ESC>ggdG'
+ vim.feedkeys 'iif 1: # TODO\<Esc>'
+ # Assertion that we have a pythonTodo here.
+ vim.echo('synIDattr(synID(line("."), col("."), 0), "name")').should match 'pythonTodo'
+ }
+
+ it "respects autoindent" do
+ vim.feedkeys 'o'
+ indent.should == shiftwidth
+ end
+end
+
+describe "elif after else" do
+ before {
+ vim.feedkeys '\<ESC>ggdG'
+ }
+
+ it "is indented to the outer if" do
+ vim.feedkeys 'iif 1:\<CR>if 2:\<CR>pass\<CR>else:\<CR>pass\<CR>elif 3:\<Esc>'
+ indent.should == 0
+
+ vim.feedkeys '\<ESC>ggdG'
+ vim.feedkeys 'i if 1:\<CR>if 2:\<CR>pass\<CR>else:\<CR>pass\<CR>elif 3:\<Esc>'
+ indent.should == 4
+ end
+end
+
+describe "elif after two ifs" do
+ before {
+ vim.feedkeys '\<ESC>ggdG'
+ }
+
+ it "keeps its indent to the outer if" do
+ vim.feedkeys 'iif 1:\<CR>if 2:\<CR>pass\<CR>elif 3:\<CR>pass\<CR>'
+ indent.should == 4
+ vim.feedkeys '\<Esc>'
+ indent.should == 0
+ proposed_indent.should == shiftwidth
+ vim.feedkeys 'ielif 4:'
+ indent.should == 0
+ proposed_indent.should == 0
+ vim.feedkeys '\<CR>'
+ indent.should == 4
+ proposed_indent.should == 4
+ end
+end
--- /dev/null
+#!/bin/sh
+
+set -ex
+
+rm -f .coverage_covimerage
+export PYTHON_PEP8_INDENT_TEST_PROFILE_BASE=/tmp/vim-python-pep8-profile
+
+Xvfb :99 2>/dev/null >&2 &
+export DISPLAY=:99
+
+export VIMRUNNER_REUSE_SERVER=1
+
+ret=0
+for file in ./spec/indent/*_spec.rb; do
+ # shellcheck disable=SC2086
+ bundle exec rspec "$file" $RSPEC_OPTIONS || ret=1
+
+ for p in "${PYTHON_PEP8_INDENT_TEST_PROFILE_BASE}".*; do
+ covimerage write_coverage --append "$p"
+ rm "$p"
+ covimerage report -m
+ done
+done
+exit $ret
--- /dev/null
+require 'vimrunner'
+require 'vimrunner/rspec'
+require 'vimrunner/server'
+
+# Explicitly enable usage of "should".
+RSpec.configure do |config|
+ config.expect_with(:rspec) { |c| c.syntax = :should }
+end
+
+Vimrunner::RSpec.configure do |config|
+ # Use a single Vim instance for the test suite. Set to false to use an
+ # instance per test (slower, but can be easier to manage).
+ # This requires using gvim, otherwise it hangs after a few tests.
+ config.reuse_server = ENV['VIMRUNNER_REUSE_SERVER'] == '1' ? true : false
+
+ config.start_vim do
+ exe = config.reuse_server ? Vimrunner::Platform.gvim : Vimrunner::Platform.vim
+ vimrc = File.expand_path("../vimrc", __FILE__)
+ vim = Vimrunner::Server.new(:executable => exe,
+ :vimrc => vimrc).start
+ # More friendly killing.
+ # Otherwise profiling information might not be written.
+ def vim.kill
+ normal(':qall!<CR>')
+
+ Timeout.timeout(5) do
+ sleep 0.1 while server.running?
+ end
+ end
+
+ plugin_path = File.expand_path('../..', __FILE__)
+ vim.command "set rtp^=#{plugin_path}"
+ vim.command "set filetype=python"
+
+ def shiftwidth
+ @shiftwidth ||= vim.echo("exists('*shiftwidth') ? shiftwidth() : &sw").to_i
+ end
+ def tabstop
+ @tabstop ||= vim.echo("&tabstop").to_i
+ end
+ def indent
+ vim.echo("indent('.')").to_i
+ end
+ def previous_indent
+ pline = vim.echo("line('.')").to_i - 1
+ vim.echo("indent('#{pline}')").to_i
+ end
+ def proposed_indent
+ line = vim.echo("line('.')")
+ col = vim.echo("col('.')")
+ indent_value = vim.echo("GetPythonPEPIndent(#{line})").to_i
+ vim.command("call cursor(#{line}, #{col})")
+ return indent_value
+ end
+ def multiline_indent(prev, default)
+ i = vim.echo("get(g:, 'python_pep8_indent_multiline_string', 0)").to_i
+ return (i == -2 ? default : i), i < 0 ? (i == -1 ? prev : default) : i
+ end
+ def hang_closing
+ i = vim.echo("get(g:, 'python_pep8_indent_hang_closing', 0)").to_i
+ return (i != 0)
+ end
+ def set_hang_closing(value)
+ i = value ? 1 : 0
+ vim.command("let g:python_pep8_indent_hang_closing=#{i}")
+ end
+
+ vim
+ end
+end
--- /dev/null
+" vint: -ProhibitSetNoCompatible
+set nocompatible
+
+filetype plugin on
+filetype indent on
+syntax on
+
+set noswapfile nobackup
+
+" remove default ~/.vim directories to avoid loading plugins
+set runtimepath-=~/.vim
+set runtimepath-=~/.vim/after
+
+let sfile = expand('<sfile>')
+let plugin_path = fnamemodify(sfile, ':p:h:h')
+exe 'set runtimepath^='.plugin_path
+
+if !empty($PYTHON_PEP8_INDENT_TEST_PROFILE_BASE)
+ execute printf('profile start %s.%s',
+ \ $PYTHON_PEP8_INDENT_TEST_PROFILE_BASE, getpid())
+ execute 'profile! file '. plugin_path . '/indent/python.vim'
+endif
--- /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/doc/Tabular.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
+augroup filetypedetect
+ " detect mediawiki buffers
+ au! BufRead,BufNewFile *.mw setf mediawiki
+augroup END
--- /dev/null
+au BufRead,BufNewFile *.pp setfiletype puppet
--- /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
+" 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
+"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
+" 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/Tabular.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-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
+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/addons/syntax/jinja.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 => ➬
+
+let g:airline_theme='minimalist'
+
+try
+ execute pathogen#infect()
+catch
+ "echo "Pathogen not installed"
+endtry
+
+let g:is_posix = 1
+
+let g:UltiSnipsExpandTrigger = "<leader><tab>"
+let g:UltiSnipsJumpForwardTrigger = "<c-]>"
+let g:UltiSnipsJumpBackwardTrigger = "<c-[>"
+map <F10> :UltiSnipsEdit<cr>
+imap <F10> <esc>:UltiSnipsEdit<cr>
+
+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