Do some cleaning using vim-vimlint
Mostly turning global variables into script variables
This commit is contained in:
parent
81b7ee0327
commit
44436f4581
@ -474,7 +474,6 @@ function! vimwiki#base#system_open_link(url) "{{{
|
||||
function! s:linux_handler(url)
|
||||
call system('xdg-open ' . shellescape(a:url, 1).' &')
|
||||
endfunction
|
||||
let success = 0
|
||||
try
|
||||
if vimwiki#u#is_windows()
|
||||
call s:win32_handler(a:url)
|
||||
@ -1634,14 +1633,13 @@ endfunction " }}}
|
||||
" vimwiki#base#normalize_imagelink_helper
|
||||
function! vimwiki#base#normalize_imagelink_helper(str, rxUrl, rxDesc, rxStyle, template) "{{{
|
||||
let lnk = vimwiki#base#normalize_link_helper(a:str, a:rxUrl, a:rxDesc, a:template)
|
||||
let style = matchstr(str, a:rxStyle)
|
||||
let style = matchstr(a:str, a:rxStyle)
|
||||
let lnk = substitute(lnk, '__LinkStyle__', '\="'.style.'"', '')
|
||||
return lnk
|
||||
endfunction " }}}
|
||||
|
||||
" s:normalize_link_syntax_n
|
||||
function! s:normalize_link_syntax_n() " {{{
|
||||
let lnum = line('.')
|
||||
|
||||
" try WikiLink
|
||||
let lnk = vimwiki#base#matchstr_at_cursor(g:vimwiki_rxWikiLink)
|
||||
@ -1685,12 +1683,10 @@ endfunction " }}}
|
||||
|
||||
" s:normalize_link_syntax_v
|
||||
function! s:normalize_link_syntax_v() " {{{
|
||||
let lnum = line('.')
|
||||
let sel_save = &selection
|
||||
let &selection = "old"
|
||||
let rv = @"
|
||||
let rt = getregtype('"')
|
||||
let done = 0
|
||||
|
||||
try
|
||||
norm! gv""y
|
||||
@ -1728,8 +1724,8 @@ endfunction "}}}
|
||||
|
||||
" -------------------------------------------------------------------------
|
||||
" Load syntax-specific Wiki functionality
|
||||
for syn in vimwiki#base#get_known_syntaxes()
|
||||
execute 'runtime! autoload/vimwiki/'.syn.'_base.vim'
|
||||
for s:syn in vimwiki#base#get_known_syntaxes()
|
||||
execute 'runtime! autoload/vimwiki/'.s:syn.'_base.vim'
|
||||
endfor
|
||||
" -------------------------------------------------------------------------
|
||||
|
||||
|
@ -714,7 +714,7 @@ function! s:close_tag_list(lists, ldest) "{{{
|
||||
let item = remove(a:lists, 0)
|
||||
call insert(a:ldest, item[0])
|
||||
endwhile
|
||||
endfunction! "}}}
|
||||
endfunction "}}}
|
||||
|
||||
function! s:close_tag_def_list(deflist, ldest) "{{{
|
||||
if a:deflist
|
||||
@ -722,7 +722,7 @@ function! s:close_tag_def_list(deflist, ldest) "{{{
|
||||
return 0
|
||||
endif
|
||||
return a:deflist
|
||||
endfunction! "}}}
|
||||
endfunction "}}}
|
||||
|
||||
function! s:process_tag_pre(line, pre) "{{{
|
||||
" pre is the list of [is_in_pre, indent_of_pre]
|
||||
|
@ -943,7 +943,7 @@ function! s:decrease_level(item) "{{{
|
||||
endfunction "}}}
|
||||
|
||||
function! s:increase_level(item) "{{{
|
||||
let additional_space = 0
|
||||
let additional_indent = 0
|
||||
if VimwikiGet('syntax') == 'media' && a:item.type == 1 &&
|
||||
\ index(s:multiple_bullet_chars, s:first_char(a:item.mrkr)) > -1
|
||||
call s:substitute_string_in_line(a:item.lnum, a:item.mrkr, a:item.mrkr .
|
||||
|
@ -1591,7 +1591,7 @@ Or, to jump to an individual project, use this link: >
|
||||
|
||||
If there are multiple instances of an anchor, you can use the long form which
|
||||
consists of the complete header hierarchy, separated by '#': >
|
||||
[[Todo#My Tasks#Knitting club#Knitting projects#dog]]
|
||||
[[Todo#My tasks#Knitting club#Knitting projects#dog]]
|
||||
|
||||
If you don't feel like typing the whole stuff, type just [[Todo# and then
|
||||
|i_CTRL-X_CTRL-O| to start the omni completion of anchors.
|
||||
@ -1611,7 +1611,7 @@ file as links, so you can directly jump to specific parts of the file.
|
||||
|
||||
For the indentation, the value of |vimwiki-option-list_margin| is used.
|
||||
|
||||
If you don't want the TOC so sit in the very first line, e.g. if you have a
|
||||
If you don't want the TOC to sit in the very first line, e.g. if you have a
|
||||
modeline there, put the magic header in the second or third line and run
|
||||
:VimwikiTOC to update the TOC.
|
||||
|
||||
|
@ -33,7 +33,6 @@ setlocal isfname-=[,]
|
||||
|
||||
" omnicomplete function for wiki files and anchors {{{
|
||||
|
||||
" XXX move to an appropriate place
|
||||
let g:vimwiki_default_header_search = '^\s*\(=\{1,6}\)\([^=].*[^=]\)\1\s*$'
|
||||
let g:vimwiki_default_header_match = '^\s*\(=\{1,6}\)=\@!\s*__Header__\s*\1=\@!\s*$'
|
||||
let g:vimwiki_markdown_header_search = '^\s*\(#\{1,6}\)\([^#].*\)$'
|
||||
@ -193,14 +192,14 @@ let &formatlistpat = g:vimwiki_rxListItem
|
||||
|
||||
if !empty(&langmap)
|
||||
" Valid only if langmap is a comma separated pairs of chars
|
||||
let l_o = matchstr(&langmap, '\C,\zs.\zeo,')
|
||||
if l_o
|
||||
exe 'nnoremap <silent> <buffer> '.l_o.' :call vimwiki#lst#kbd_o()<CR>a'
|
||||
let s:l_o = matchstr(&langmap, '\C,\zs.\zeo,')
|
||||
if s:l_o
|
||||
exe 'nnoremap <silent> <buffer> '.s:l_o.' :call vimwiki#lst#kbd_o()<CR>a'
|
||||
endif
|
||||
|
||||
let l_O = matchstr(&langmap, '\C,\zs.\zeO,')
|
||||
if l_O
|
||||
exe 'nnoremap <silent> <buffer> '.l_O.' :call vimwiki#lst#kbd_O()<CR>a'
|
||||
let s:l_O = matchstr(&langmap, '\C,\zs.\zeO,')
|
||||
if s:l_O
|
||||
exe 'nnoremap <silent> <buffer> '.s:l_O.' :call vimwiki#lst#kbd_O()<CR>a'
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
" GetLatestVimScripts: 2226 1 :AutoInstall: vimwiki
|
||||
|
||||
if exists("loaded_vimwiki") || &cp
|
||||
if exists("g:loaded_vimwiki") || &cp
|
||||
finish
|
||||
endif
|
||||
let loaded_vimwiki = 1
|
||||
let g:loaded_vimwiki = 1
|
||||
|
||||
let s:old_cpo = &cpo
|
||||
set cpo&vim
|
||||
@ -313,7 +313,7 @@ function! VimwikiSet(option, value, ...) "{{{
|
||||
|
||||
endfunction "}}}
|
||||
|
||||
" Clear option for current wiki or if third parameter exists for
|
||||
" Clear option for current wiki or if second parameter exists for
|
||||
" wiki with a given index.
|
||||
" Currently, only works if option was previously saved in the buffer local
|
||||
" dictionary, that acts as a cache.
|
||||
@ -430,20 +430,19 @@ call s:default('web_schemes1', 'http,https,file,ftp,gopher,telnet,nntp,ldap,'.
|
||||
\ 'rsync,imap,pop,irc,ircs,cvs,svn,svn+ssh,git,ssh,fish,sftp')
|
||||
call s:default('web_schemes2', 'mailto,news,xmpp,sip,sips,doi,urn,tel')
|
||||
|
||||
let rxSchemes = '\%('.
|
||||
let s:rxSchemes = '\%('.
|
||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes2, '\s*,\s*'), '\|').
|
||||
\ '\)'
|
||||
|
||||
call s:default('rxSchemeUrl', rxSchemes.':.*')
|
||||
call s:default('rxSchemeUrlMatchScheme', '\zs'.rxSchemes.'\ze:.*')
|
||||
call s:default('rxSchemeUrlMatchUrl', rxSchemes.':\zs.*\ze')
|
||||
call s:default('rxSchemeUrl', s:rxSchemes.':.*')
|
||||
call s:default('rxSchemeUrlMatchScheme', '\zs'.s:rxSchemes.'\ze:.*')
|
||||
call s:default('rxSchemeUrlMatchUrl', s:rxSchemes.':\zs.*\ze')
|
||||
" scheme regexes }}}
|
||||
"}}}
|
||||
|
||||
" AUTOCOMMANDS for all known wiki extensions {{{
|
||||
let extensions = vimwiki#base#get_known_extensions()
|
||||
|
||||
augroup filetypedetect
|
||||
" clear FlexWiki's stuff
|
||||
@ -452,17 +451,17 @@ augroup end
|
||||
|
||||
augroup vimwiki
|
||||
autocmd!
|
||||
for ext in extensions
|
||||
exe 'autocmd BufEnter *'.ext.' call s:setup_buffer_reenter()'
|
||||
exe 'autocmd BufWinEnter *'.ext.' call s:setup_buffer_enter()'
|
||||
exe 'autocmd BufLeave,BufHidden *'.ext.' call s:setup_buffer_leave()'
|
||||
exe 'autocmd BufNewFile,BufRead, *'.ext.' call s:setup_filetype()'
|
||||
exe 'autocmd ColorScheme *'.ext.' call s:setup_cleared_syntax()'
|
||||
for s:ext in vimwiki#base#get_known_extensions()
|
||||
exe 'autocmd BufEnter *'.s:ext.' call s:setup_buffer_reenter()'
|
||||
exe 'autocmd BufWinEnter *'.s:ext.' call s:setup_buffer_enter()'
|
||||
exe 'autocmd BufLeave,BufHidden *'.s:ext.' call s:setup_buffer_leave()'
|
||||
exe 'autocmd BufNewFile,BufRead, *'.s:ext.' call s:setup_filetype()'
|
||||
exe 'autocmd ColorScheme *'.s:ext.' call s:setup_cleared_syntax()'
|
||||
" Format tables when exit from insert mode. Do not use textwidth to
|
||||
" autowrap tables.
|
||||
if g:vimwiki_table_auto_fmt
|
||||
exe 'autocmd InsertLeave *'.ext.' call vimwiki#tbl#format(line("."))'
|
||||
exe 'autocmd InsertEnter *'.ext.' call vimwiki#tbl#reset_tw(line("."))'
|
||||
exe 'autocmd InsertLeave *'.s:ext.' call vimwiki#tbl#format(line("."))'
|
||||
exe 'autocmd InsertEnter *'.s:ext.' call vimwiki#tbl#reset_tw(line("."))'
|
||||
endif
|
||||
endfor
|
||||
augroup END
|
||||
|
@ -11,12 +11,12 @@ elseif exists("b:current_syntax")
|
||||
endif
|
||||
|
||||
"TODO do nothing if ...? (?)
|
||||
let starttime = reltime() " start the clock
|
||||
let s:starttime = reltime() " start the clock
|
||||
if VimwikiGet('maxhi')
|
||||
let b:existing_wikifiles = vimwiki#base#get_links('*'.VimwikiGet('ext'))
|
||||
let b:existing_wikidirs = vimwiki#base#get_links('*/')
|
||||
endif
|
||||
let timescans = vimwiki#u#time(starttime) "XXX
|
||||
let s:timescans = vimwiki#u#time(s:starttime) "XXX
|
||||
"let b:xxx = 1
|
||||
"TODO ? update wikilink syntax group here if really needed (?) for :e and such
|
||||
"if VimwikiGet('maxhi')
|
||||
@ -44,9 +44,8 @@ let g:vimwiki_rxWeblinkUrl = g:vimwiki_rxWebProtocols .
|
||||
|
||||
" }}}
|
||||
|
||||
call vimwiki#u#reload_regexes()
|
||||
|
||||
let time0 = vimwiki#u#time(starttime) "XXX
|
||||
let s:time0 = vimwiki#u#time(s:starttime) "XXX
|
||||
|
||||
" LINKS: setup of larger regexes {{{
|
||||
|
||||
@ -62,13 +61,13 @@ let g:vimwiki_WikiLinkTemplate2 = g:vimwiki_rxWikiLinkPrefix . '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLinkSeparator. '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWikiLinkSuffix
|
||||
"
|
||||
let valid_chars = '[^\\\]]'
|
||||
let s:valid_chars = '[^\\\]]'
|
||||
|
||||
let g:vimwiki_rxWikiLinkPrefix = vimwiki#u#escape(g:vimwiki_rxWikiLinkPrefix)
|
||||
let g:vimwiki_rxWikiLinkSuffix = vimwiki#u#escape(g:vimwiki_rxWikiLinkSuffix)
|
||||
let g:vimwiki_rxWikiLinkSeparator = vimwiki#u#escape(g:vimwiki_rxWikiLinkSeparator)
|
||||
let g:vimwiki_rxWikiLinkUrl = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiLinkDescr = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiLinkUrl = s:valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiLinkDescr = s:valid_chars.'\{-}'
|
||||
|
||||
let g:vimwiki_rxWord = '[^[:blank:]()\\]\+'
|
||||
|
||||
@ -108,13 +107,13 @@ let g:vimwiki_WikiInclTemplate2 = g:vimwiki_rxWikiInclPrefix . '__LinkUrl__'.
|
||||
\ '__LinkDescription__'.
|
||||
\ g:vimwiki_rxWikiInclSuffix
|
||||
|
||||
let valid_chars = '[^\\\}]'
|
||||
let s:valid_chars = '[^\\\}]'
|
||||
|
||||
let g:vimwiki_rxWikiInclPrefix = vimwiki#u#escape(g:vimwiki_rxWikiInclPrefix)
|
||||
let g:vimwiki_rxWikiInclSuffix = vimwiki#u#escape(g:vimwiki_rxWikiInclSuffix)
|
||||
let g:vimwiki_rxWikiInclSeparator = vimwiki#u#escape(g:vimwiki_rxWikiInclSeparator)
|
||||
let g:vimwiki_rxWikiInclUrl = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiInclArg = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiInclUrl = s:valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiInclArg = s:valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiInclArgs = '\%('. g:vimwiki_rxWikiInclSeparator. g:vimwiki_rxWikiInclArg. '\)'.'\{-}'
|
||||
"
|
||||
"
|
||||
@ -231,16 +230,16 @@ if VimwikiGet('maxhi')
|
||||
call s:add_target_syntax_OFF(g:vimwiki_rxWikiIncl)
|
||||
|
||||
" Subsequently, links verified on vimwiki's path are highlighted as existing
|
||||
let time01 = vimwiki#u#time(starttime) "XXX
|
||||
let s:time01 = vimwiki#u#time(s:starttime) "XXX
|
||||
call s:highlight_existing_links()
|
||||
let time02 = vimwiki#u#time(starttime) "XXX
|
||||
let s:time02 = vimwiki#u#time(s:starttime) "XXX
|
||||
else
|
||||
let time01 = vimwiki#u#time(starttime) "XXX
|
||||
let s:time01 = vimwiki#u#time(s:starttime) "XXX
|
||||
" Wikilink
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWikiLink, 'VimwikiLink')
|
||||
" WikiIncl
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWikiIncl, 'VimwikiLink')
|
||||
let time02 = vimwiki#u#time(starttime) "XXX
|
||||
let s:time02 = vimwiki#u#time(s:starttime) "XXX
|
||||
endif
|
||||
|
||||
" Weblink
|
||||
@ -248,74 +247,74 @@ call s:add_target_syntax_ON(g:vimwiki_rxWeblink, 'VimwikiLink')
|
||||
|
||||
" WikiLink
|
||||
" All remaining schemes are highlighted automatically
|
||||
let rxSchemes = '\%('.
|
||||
let s:rxSchemes = '\%('.
|
||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').
|
||||
\ '\):'
|
||||
|
||||
" a) match [[nonwiki-scheme-URL]]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate1,
|
||||
\ rxSchemes.g:vimwiki_rxWikiLinkUrl, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
let s:target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate1,
|
||||
\ s:rxSchemes.g:vimwiki_rxWikiLinkUrl, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
||||
" b) match [[nonwiki-scheme-URL|DESCRIPTION]]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate2,
|
||||
\ rxSchemes.g:vimwiki_rxWikiLinkUrl, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
let s:target = vimwiki#base#apply_template(g:vimwiki_WikiLinkTemplate2,
|
||||
\ s:rxSchemes.g:vimwiki_rxWikiLinkUrl, g:vimwiki_rxWikiLinkDescr, '')
|
||||
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
||||
|
||||
" a) match {{nonwiki-scheme-URL}}
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiInclTemplate1,
|
||||
\ rxSchemes.g:vimwiki_rxWikiInclUrl, g:vimwiki_rxWikiInclArgs, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
let s:target = vimwiki#base#apply_template(g:vimwiki_WikiInclTemplate1,
|
||||
\ s:rxSchemes.g:vimwiki_rxWikiInclUrl, g:vimwiki_rxWikiInclArgs, '')
|
||||
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
||||
" b) match {{nonwiki-scheme-URL}[{...}]}
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiInclTemplate2,
|
||||
\ rxSchemes.g:vimwiki_rxWikiInclUrl, g:vimwiki_rxWikiInclArgs, '')
|
||||
call s:add_target_syntax_ON(target, 'VimwikiLink')
|
||||
let s:target = vimwiki#base#apply_template(g:vimwiki_WikiInclTemplate2,
|
||||
\ s:rxSchemes.g:vimwiki_rxWikiInclUrl, g:vimwiki_rxWikiInclArgs, '')
|
||||
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
||||
|
||||
" }}}
|
||||
|
||||
" generic headers "{{{
|
||||
if g:vimwiki_symH
|
||||
"" symmetric
|
||||
for i in range(1,6)
|
||||
let g:vimwiki_rxH{i}_Template = repeat(g:vimwiki_rxH, i).' __Header__ '.repeat(g:vimwiki_rxH, i)
|
||||
let g:vimwiki_rxH{i} = '^\s*'.g:vimwiki_rxH.'\{'.i.'}[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']'.g:vimwiki_rxH.'\{'.i.'}\s*$'
|
||||
let g:vimwiki_rxH{i}_Start = '^\s*'.g:vimwiki_rxH.'\{'.i.'}[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']'.g:vimwiki_rxH.'\{'.i.'}\s*$'
|
||||
let g:vimwiki_rxH{i}_End = '^\s*'.g:vimwiki_rxH.'\{1,'.i.'}[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']'.g:vimwiki_rxH.'\{1,'.i.'}\s*$'
|
||||
for s:i in range(1,6)
|
||||
let g:vimwiki_rxH{s:i}_Template = repeat(g:vimwiki_rxH, s:i).' __Header__ '.repeat(g:vimwiki_rxH, s:i)
|
||||
let g:vimwiki_rxH{s:i} = '^\s*'.g:vimwiki_rxH.'\{'.s:i.'}[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']'.g:vimwiki_rxH.'\{'.s:i.'}\s*$'
|
||||
let g:vimwiki_rxH{s:i}_Start = '^\s*'.g:vimwiki_rxH.'\{'.s:i.'}[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']'.g:vimwiki_rxH.'\{'.s:i.'}\s*$'
|
||||
let g:vimwiki_rxH{s:i}_End = '^\s*'.g:vimwiki_rxH.'\{1,'.s:i.'}[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']'.g:vimwiki_rxH.'\{1,'.s:i.'}\s*$'
|
||||
endfor
|
||||
let g:vimwiki_rxHeader = '^\s*\('.g:vimwiki_rxH.'\{1,6}\)\zs[^'.g:vimwiki_rxH.'].*[^'.g:vimwiki_rxH.']\ze\1\s*$'
|
||||
else
|
||||
" asymmetric
|
||||
for i in range(1,6)
|
||||
let g:vimwiki_rxH{i}_Template = repeat(g:vimwiki_rxH, i).' __Header__'
|
||||
let g:vimwiki_rxH{i} = '^\s*'.g:vimwiki_rxH.'\{'.i.'}[^'.g:vimwiki_rxH.'].*$'
|
||||
let g:vimwiki_rxH{i}_Start = '^\s*'.g:vimwiki_rxH.'\{'.i.'}[^'.g:vimwiki_rxH.'].*$'
|
||||
let g:vimwiki_rxH{i}_End = '^\s*'.g:vimwiki_rxH.'\{1,'.i.'}[^'.g:vimwiki_rxH.'].*$'
|
||||
for s:i in range(1,6)
|
||||
let g:vimwiki_rxH{s:i}_Template = repeat(g:vimwiki_rxH, s:i).' __Header__'
|
||||
let g:vimwiki_rxH{s:i} = '^\s*'.g:vimwiki_rxH.'\{'.s:i.'}[^'.g:vimwiki_rxH.'].*$'
|
||||
let g:vimwiki_rxH{s:i}_Start = '^\s*'.g:vimwiki_rxH.'\{'.s:i.'}[^'.g:vimwiki_rxH.'].*$'
|
||||
let g:vimwiki_rxH{s:i}_End = '^\s*'.g:vimwiki_rxH.'\{1,'.s:i.'}[^'.g:vimwiki_rxH.'].*$'
|
||||
endfor
|
||||
let g:vimwiki_rxHeader = '^\s*\('.g:vimwiki_rxH.'\{1,6}\)\zs[^'.g:vimwiki_rxH.'].*\ze$'
|
||||
endif
|
||||
|
||||
" Header levels, 1-6
|
||||
for i in range(1,6)
|
||||
execute 'syntax match VimwikiHeader'.i.' /'.g:vimwiki_rxH{i}.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,VimwikiLink,@Spell'
|
||||
execute 'syntax region VimwikiH'.i.'Folding start=/'.g:vimwiki_rxH{i}_Start.
|
||||
\ '/ end=/'.g:vimwiki_rxH{i}_End.'/me=s-1 transparent fold'
|
||||
for s:i in range(1,6)
|
||||
execute 'syntax match VimwikiHeader'.s:i.' /'.g:vimwiki_rxH{s:i}.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,VimwikiLink,@Spell'
|
||||
execute 'syntax region VimwikiH'.s:i.'Folding start=/'.g:vimwiki_rxH{s:i}_Start.
|
||||
\ '/ end=/'.g:vimwiki_rxH{s:i}_End.'/me=s-1 transparent fold'
|
||||
endfor
|
||||
|
||||
|
||||
" }}}
|
||||
|
||||
" possibly concealed chars " {{{
|
||||
let conceal = exists("+conceallevel") ? ' conceal' : ''
|
||||
let s:conceal = exists("+conceallevel") ? ' conceal' : ''
|
||||
|
||||
execute 'syn match VimwikiEqInChar contained /'.g:vimwiki_char_eqin.'/'.conceal
|
||||
execute 'syn match VimwikiBoldChar contained /'.g:vimwiki_char_bold.'/'.conceal
|
||||
execute 'syn match VimwikiItalicChar contained /'.g:vimwiki_char_italic.'/'.conceal
|
||||
execute 'syn match VimwikiBoldItalicChar contained /'.g:vimwiki_char_bolditalic.'/'.conceal
|
||||
execute 'syn match VimwikiItalicBoldChar contained /'.g:vimwiki_char_italicbold.'/'.conceal
|
||||
execute 'syn match VimwikiCodeChar contained /'.g:vimwiki_char_code.'/'.conceal
|
||||
execute 'syn match VimwikiDelTextChar contained /'.g:vimwiki_char_deltext.'/'.conceal
|
||||
execute 'syn match VimwikiSuperScript contained /'.g:vimwiki_char_superscript.'/'.conceal
|
||||
execute 'syn match VimwikiSubScript contained /'.g:vimwiki_char_subscript.'/'.conceal
|
||||
execute 'syn match VimwikiEqInChar contained /'.g:vimwiki_char_eqin.'/'.s:conceal
|
||||
execute 'syn match VimwikiBoldChar contained /'.g:vimwiki_char_bold.'/'.s:conceal
|
||||
execute 'syn match VimwikiItalicChar contained /'.g:vimwiki_char_italic.'/'.s:conceal
|
||||
execute 'syn match VimwikiBoldItalicChar contained /'.g:vimwiki_char_bolditalic.'/'.s:conceal
|
||||
execute 'syn match VimwikiItalicBoldChar contained /'.g:vimwiki_char_italicbold.'/'.s:conceal
|
||||
execute 'syn match VimwikiCodeChar contained /'.g:vimwiki_char_code.'/'.s:conceal
|
||||
execute 'syn match VimwikiDelTextChar contained /'.g:vimwiki_char_deltext.'/'.s:conceal
|
||||
execute 'syn match VimwikiSuperScript contained /'.g:vimwiki_char_superscript.'/'.s:conceal
|
||||
execute 'syn match VimwikiSubScript contained /'.g:vimwiki_char_subscript.'/'.s:conceal
|
||||
" }}}
|
||||
|
||||
" concealed link parts " {{{
|
||||
@ -331,30 +330,30 @@ endif
|
||||
" define the conceal attribute for links only if Vim is new enough to handle it
|
||||
" and the user has g:vimwiki_url_maxsave > 0
|
||||
|
||||
let options = ' contained transparent contains=NONE'
|
||||
let s:options = ' contained transparent contains=NONE'
|
||||
"
|
||||
" A shortener for long URLs: LinkRest (a middle part of the URL) is concealed
|
||||
" VimwikiLinkRest group is left undefined if link shortening is not desired
|
||||
if exists("+conceallevel") && g:vimwiki_url_maxsave > 0
|
||||
let options .= conceal
|
||||
let s:options .= s:conceal
|
||||
execute 'syn match VimwikiLinkRest `\%(///\=[^/ \t]\+/\)\zs\S\+\ze'
|
||||
\.'\%([/#?]\w\|\S\{'.g:vimwiki_url_maxsave.'}\)`'.' cchar=~'.options
|
||||
\.'\%([/#?]\w\|\S\{'.g:vimwiki_url_maxsave.'}\)`'.' cchar=~'.s:options
|
||||
endif
|
||||
|
||||
" VimwikiLinkChar is for syntax markers (and also URL when a description
|
||||
" is present) and may be concealed
|
||||
|
||||
" conceal wikilinks
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkPrefix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkSuffix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkPrefix1.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkSuffix1.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkPrefix.'/'.s:options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkSuffix.'/'.s:options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkPrefix1.'/'.s:options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiLinkSuffix1.'/'.s:options
|
||||
|
||||
" conceal wikiincls
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclPrefix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclSuffix.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclPrefix1.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclSuffix1.'/'.options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclPrefix.'/'.s:options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclSuffix.'/'.s:options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclPrefix1.'/'.s:options
|
||||
execute 'syn match VimwikiLinkChar /'.g:vimwiki_rxWikiInclSuffix1.'/'.s:options
|
||||
" }}}
|
||||
|
||||
" non concealed chars " {{{
|
||||
@ -456,8 +455,8 @@ syntax match VimwikiPlaceholderParam /\s.*/ contained
|
||||
|
||||
" html tags
|
||||
if g:vimwiki_valid_html_tags != ''
|
||||
let html_tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|')
|
||||
exe 'syntax match VimwikiHTMLtag #\c</\?\%('.html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#'
|
||||
let s:html_tags = join(split(g:vimwiki_valid_html_tags, '\s*,\s*'), '\|')
|
||||
exe 'syntax match VimwikiHTMLtag #\c</\?\%('.s:html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#'
|
||||
execute 'syntax match VimwikiBold #\c<b>.\{-}</b># contains=VimwikiHTMLTag'
|
||||
execute 'syntax match VimwikiItalic #\c<i>.\{-}</i># contains=VimwikiHTMLTag'
|
||||
execute 'syntax match VimwikiUnderline #\c<u>.\{-}</u># contains=VimwikiHTMLTag'
|
||||
@ -473,8 +472,8 @@ if g:vimwiki_hl_headers == 0
|
||||
if !exists("g:colors_name")
|
||||
hi Title cterm=bold
|
||||
endif
|
||||
for i in range(1,6)
|
||||
execute 'hi def link VimwikiHeader'.i.' Title'
|
||||
for s:i in range(1,6)
|
||||
execute 'hi def link VimwikiHeader'.s:i.' Title'
|
||||
endfor
|
||||
else
|
||||
" default colors when headers of different levels are highlighted differently
|
||||
@ -483,8 +482,8 @@ else
|
||||
let g:vimwiki_hcolor_ctermfg_light = ['DarkRed','DarkGreen','DarkBlue','Black','Black','Black']
|
||||
let g:vimwiki_hcolor_guifg_dark = ['#e08090','#80e090','#6090e0','#c0c0f0','#e0e0f0','#f0f0f0']
|
||||
let g:vimwiki_hcolor_ctermfg_dark = ['Red','Green','Blue','White','White','White']
|
||||
for i in range(1,6)
|
||||
execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='.g:vimwiki_hcolor_guifg_{&bg}[i-1].' gui=bold ctermfg='.g:vimwiki_hcolor_ctermfg_{&bg}[i-1].' term=bold cterm=bold'
|
||||
for s:i in range(1,6)
|
||||
execute 'hi def VimwikiHeader'.s:i.' guibg=bg guifg='.g:vimwiki_hcolor_guifg_{&bg}[s:i-1].' gui=bold ctermfg='.g:vimwiki_hcolor_ctermfg_{&bg}[s:i-1].' term=bold cterm=bold'
|
||||
endfor
|
||||
endif
|
||||
"}}}
|
||||
@ -579,12 +578,12 @@ call vimwiki#u#reload_regexes_custom()
|
||||
let b:current_syntax="vimwiki"
|
||||
|
||||
" EMBEDDED syntax setup "{{{
|
||||
let nested = VimwikiGet('nested_syntaxes')
|
||||
if !empty(nested)
|
||||
for [hl_syntax, vim_syntax] in items(nested)
|
||||
call vimwiki#base#nested_syntax(vim_syntax,
|
||||
let s:nested = VimwikiGet('nested_syntaxes')
|
||||
if !empty(s:nested)
|
||||
for [s:hl_syntax, s:vim_syntax] in items(s:nested)
|
||||
call vimwiki#base#nested_syntax(s:vim_syntax,
|
||||
\ '^\s*'.g:vimwiki_rxPreStart.'\%(.*[[:blank:][:punct:]]\)\?'.
|
||||
\ hl_syntax.'\%([[:blank:][:punct:]].*\)\?',
|
||||
\ s:hl_syntax.'\%([[:blank:][:punct:]].*\)\?',
|
||||
\ '^\s*'.g:vimwiki_rxPreEnd, 'VimwikiPre')
|
||||
endfor
|
||||
endif
|
||||
@ -598,5 +597,5 @@ call vimwiki#base#nested_syntax('tex',
|
||||
|
||||
syntax spell toplevel
|
||||
|
||||
let timeend = vimwiki#u#time(starttime) "XXX
|
||||
call VimwikiLog_extend('timing',['syntax:scans',timescans],['syntax:regexloaded',time0],['syntax:beforeHLexisting',time01],['syntax:afterHLexisting',time02],['syntax:end',timeend])
|
||||
let s:timeend = vimwiki#u#time(s:starttime) "XXX
|
||||
call VimwikiLog_extend('timing',['syntax:scans',s:timescans],['syntax:regexloaded',s:time0],['syntax:beforeHLexisting',s:time01],['syntax:afterHLexisting',s:time02],['syntax:end',s:timeend])
|
||||
|
@ -42,13 +42,13 @@ let g:vimwiki_WikiLink1Template2 = g:vimwiki_rxWikiLink1Prefix . '__LinkDescript
|
||||
\ g:vimwiki_rxWikiLink1Separator. '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWikiLink1Suffix
|
||||
"
|
||||
let valid_chars = '[^\\\[\]]'
|
||||
let s:valid_chars = '[^\\\[\]]'
|
||||
|
||||
let g:vimwiki_rxWikiLink1Prefix = vimwiki#u#escape(g:vimwiki_rxWikiLink1Prefix)
|
||||
let g:vimwiki_rxWikiLink1Suffix = vimwiki#u#escape(g:vimwiki_rxWikiLink1Suffix)
|
||||
let g:vimwiki_rxWikiLink1Separator = vimwiki#u#escape(g:vimwiki_rxWikiLink1Separator)
|
||||
let g:vimwiki_rxWikiLink1Url = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiLink1Descr = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiLink1Url = s:valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWikiLink1Descr = s:valid_chars.'\{-}'
|
||||
|
||||
let g:vimwiki_rxWikiLink1InvalidPrefix = '[\]\[]\@<!'
|
||||
let g:vimwiki_rxWikiLink1InvalidSuffix = '[\]\[]\@!'
|
||||
@ -124,13 +124,13 @@ let g:vimwiki_Weblink1Template = g:vimwiki_rxWeblink1Prefix . '__LinkDescription
|
||||
\ g:vimwiki_rxWeblink1Separator. '__LinkUrl__'.
|
||||
\ g:vimwiki_rxWeblink1Suffix
|
||||
|
||||
let valid_chars = '[^\\]'
|
||||
let s:valid_chars = '[^\\]'
|
||||
|
||||
let g:vimwiki_rxWeblink1Prefix = vimwiki#u#escape(g:vimwiki_rxWeblink1Prefix)
|
||||
let g:vimwiki_rxWeblink1Suffix = vimwiki#u#escape(g:vimwiki_rxWeblink1Suffix)
|
||||
let g:vimwiki_rxWeblink1Separator = vimwiki#u#escape(g:vimwiki_rxWeblink1Separator)
|
||||
let g:vimwiki_rxWeblink1Url = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWeblink1Descr = valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWeblink1Url = s:valid_chars.'\{-}'
|
||||
let g:vimwiki_rxWeblink1Descr = s:valid_chars.'\{-}'
|
||||
|
||||
"
|
||||
" " 2012-02-04 TODO not starting with [[ or ][ ? ... prefix = '[\[\]]\@<!\['
|
||||
@ -272,14 +272,14 @@ if VimwikiGet('maxhi')
|
||||
call s:add_target_syntax_OFF(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1')
|
||||
|
||||
" Subsequently, links verified on vimwiki's path are highlighted as existing
|
||||
let time01 = vimwiki#u#time(starttime) "XXX
|
||||
let s:time01 = vimwiki#u#time(starttime) "XXX
|
||||
call s:highlight_existing_links()
|
||||
let time02 = vimwiki#u#time(starttime) "XXX
|
||||
let s:time02 = vimwiki#u#time(starttime) "XXX
|
||||
else
|
||||
let time01 = vimwiki#u#time(starttime) "XXX
|
||||
let s:time01 = vimwiki#u#time(starttime) "XXX
|
||||
" Wikilink
|
||||
call s:add_target_syntax_ON(g:vimwiki_rxWikiLink1, 'VimwikiWikiLink1')
|
||||
let time02 = vimwiki#u#time(starttime) "XXX
|
||||
let s:time02 = vimwiki#u#time(starttime) "XXX
|
||||
endif
|
||||
|
||||
" Weblink
|
||||
@ -287,27 +287,27 @@ call s:add_target_syntax_ON(g:vimwiki_rxWeblink1, 'VimwikiWeblink1')
|
||||
|
||||
" WikiLink
|
||||
" All remaining schemes are highlighted automatically
|
||||
let rxSchemes = '\%('.
|
||||
let s:rxSchemes = '\%('.
|
||||
\ join(split(g:vimwiki_schemes, '\s*,\s*'), '\|').'\|'.
|
||||
\ join(split(g:vimwiki_web_schemes1, '\s*,\s*'), '\|').
|
||||
\ '\):'
|
||||
|
||||
" a) match [nonwiki-scheme-URL]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template1,
|
||||
\ rxSchemes.g:vimwiki_rxWikiLink1Url, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
let s:target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template1,
|
||||
\ s:rxSchemes.g:vimwiki_rxWikiLink1Url, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1')
|
||||
" b) match [DESCRIPTION][nonwiki-scheme-URL]
|
||||
let target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template2,
|
||||
\ rxSchemes.g:vimwiki_rxWikiLink1Url, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(target), 'VimwikiWikiLink1')
|
||||
let s:target = vimwiki#base#apply_template(g:vimwiki_WikiLink1Template2,
|
||||
\ s:rxSchemes.g:vimwiki_rxWikiLink1Url, g:vimwiki_rxWikiLink1Descr, '')
|
||||
call s:add_target_syntax_ON(s:wrap_wikilink1_rx(s:target), 'VimwikiWikiLink1')
|
||||
" }}}
|
||||
|
||||
|
||||
" generic headers "{{{
|
||||
|
||||
" Header levels, 1-6
|
||||
for i in range(1,6)
|
||||
execute 'syntax match VimwikiHeader'.i.' /'.g:vimwiki_rxH{i}.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
||||
for s:i in range(1,6)
|
||||
execute 'syntax match VimwikiHeader'.s:i.' /'.g:vimwiki_rxH{s:i}.'/ contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
||||
endfor
|
||||
|
||||
" }}}
|
||||
@ -328,16 +328,16 @@ endif
|
||||
|
||||
" VimwikiWikiLink1Char is for syntax markers (and also URL when a description
|
||||
" is present) and may be concealed
|
||||
let options = ' contained transparent contains=NONE'
|
||||
let s:options = ' contained transparent contains=NONE'
|
||||
" conceal wikilink1
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Prefix.'/'.options
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Suffix.'/'.options
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Prefix1.'/'.options
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Suffix1.'/'.options
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Prefix.'/'.s:options
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Suffix.'/'.s:options
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Prefix1.'/'.s:options
|
||||
execute 'syn match VimwikiWikiLink1Char /'.g:vimwiki_rxWikiLink1Suffix1.'/'.s:options
|
||||
|
||||
" conceal weblink1
|
||||
execute 'syn match VimwikiWeblink1Char "'.g:vimwiki_rxWeblink1Prefix1.'"'.options
|
||||
execute 'syn match VimwikiWeblink1Char "'.g:vimwiki_rxWeblink1Suffix1.'"'.options
|
||||
execute 'syn match VimwikiWeblink1Char "'.g:vimwiki_rxWeblink1Prefix1.'"'.s:options
|
||||
execute 'syn match VimwikiWeblink1Char "'.g:vimwiki_rxWeblink1Suffix1.'"'.s:options
|
||||
|
||||
if exists("+conceallevel")
|
||||
syntax conceal off
|
||||
|
Loading…
Reference in New Issue
Block a user