turn all =~ into =~# or =~?; !~ analogically

This commit is contained in:
EinfachToll 2015-02-09 20:47:11 +01:00
parent 6716ba709f
commit e4de62b7d5
7 changed files with 87 additions and 87 deletions

View File

@ -230,7 +230,7 @@ function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme
let lnk = a:lnk let lnk = a:lnk
" if link is schemeless add wikiN: scheme " if link is schemeless add wikiN: scheme
let is_schemeless = lnk !~ g:vimwiki_rxSchemeUrl let is_schemeless = lnk !~# g:vimwiki_rxSchemeUrl
let lnk = (is_schemeless ? 'wiki'.g:vimwiki_current_idx.':'.lnk : lnk) let lnk = (is_schemeless ? 'wiki'.g:vimwiki_current_idx.':'.lnk : lnk)
" Get scheme " Get scheme
@ -244,7 +244,7 @@ function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme
let anchor = '' let anchor = ''
"extract anchor "extract anchor
if scheme =~ 'wiki' || scheme =~ 'diary' if scheme =~# 'wiki' || scheme =~# 'diary'
let split_lnk = split(lnk, '#', 1) let split_lnk = split(lnk, '#', 1)
let lnk = split_lnk[0] let lnk = split_lnk[0]
if len(split_lnk) <= 1 || split_lnk[-1] == '' if len(split_lnk) <= 1 || split_lnk[-1] == ''
@ -255,13 +255,13 @@ function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme
endif endif
" do nothing if scheme is unknown to vimwiki " do nothing if scheme is unknown to vimwiki
if !(scheme =~ 'wiki.*' || scheme =~ 'diary' || scheme =~ 'local' if !(scheme =~# 'wiki.*' || scheme =~# 'diary' || scheme =~# 'local'
\ || scheme =~ 'file') \ || scheme =~# 'file')
return [idx, scheme, path, subdir, lnk, ext, scheme.':'.lnk, anchor] return [idx, scheme, path, subdir, lnk, ext, scheme.':'.lnk, anchor]
endif endif
" scheme behaviors " scheme behaviors
if scheme =~ 'wiki\d\+' if scheme =~# 'wiki\d\+'
let idx = eval(matchstr(scheme, '\D\+\zs\d\+\ze')) let idx = eval(matchstr(scheme, '\D\+\zs\d\+\ze'))
if idx < 0 || idx >= len(g:vimwiki_list) if idx < 0 || idx >= len(g:vimwiki_list)
if !quiet if !quiet
@ -305,7 +305,7 @@ function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme
if vimwiki#path#is_link_to_dir(lnk) if vimwiki#path#is_link_to_dir(lnk)
let ext = (g:vimwiki_dir_link != '' ? g:vimwiki_dir_link . ext : '') let ext = (g:vimwiki_dir_link != '' ? g:vimwiki_dir_link . ext : '')
endif endif
elseif scheme =~ 'diary' elseif scheme =~# 'diary'
if a:as_html if a:as_html
" use cached value (save time when converting diary index!) " use cached value (save time when converting diary index!)
let path = VimwikiGet('invsubdir') let path = VimwikiGet('invsubdir')
@ -316,7 +316,7 @@ function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme
endif endif
let idx = g:vimwiki_current_idx let idx = g:vimwiki_current_idx
let subdir = VimwikiGet('diary_rel_path') let subdir = VimwikiGet('diary_rel_path')
elseif scheme =~ 'local' elseif scheme =~# 'local'
" revisiting the 'lcd'-bug ... " revisiting the 'lcd'-bug ...
let path = VimwikiGet('path') let path = VimwikiGet('path')
let subdir = VimwikiGet('subdir') let subdir = VimwikiGet('subdir')
@ -324,7 +324,7 @@ function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme
" prepend browser-specific file: scheme " prepend browser-specific file: scheme
let path = 'file://'.fnamemodify(path, ":p") let path = 'file://'.fnamemodify(path, ":p")
endif endif
elseif scheme =~ 'file' elseif scheme =~# 'file'
" RM repeated leading "/"'s within a link " RM repeated leading "/"'s within a link
let lnk = substitute(lnk, '^/*', '/', '') let lnk = substitute(lnk, '^/*', '/', '')
" convert "/~..." into "~..." for fnamemodify " convert "/~..." into "~..." for fnamemodify
@ -422,14 +422,14 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{
return return
endif endif
let update_prev_link = ( (scheme == '' || scheme =~ 'wiki' || scheme =~ 'diary') let update_prev_link = ( (scheme == '' || scheme =~# 'wiki' || scheme =~# 'diary')
\ && !vimwiki#path#is_equal(lnk, expand('%:t:r')) \ && !vimwiki#path#is_equal(lnk, expand('%:t:r'))
\ ? 1 : 0) \ ? 1 : 0)
let use_system_open = ( let use_system_open = (
\ scheme == '' || \ scheme == '' ||
\ scheme =~ 'wiki' || \ scheme =~# 'wiki' ||
\ scheme =~ 'diary' ? 0 : 1) \ scheme =~# 'diary' ? 0 : 1)
let vimwiki_prev_link = [] let vimwiki_prev_link = []
" update previous link for wiki pages " update previous link for wiki pages
@ -686,7 +686,7 @@ function! s:link_target(source_file, wiki_nr, link_text) "{{{
\ vimwiki#base#resolve_scheme(a:link_text, 0, 1) \ vimwiki#base#resolve_scheme(a:link_text, 0, 1)
let source_dir = fnamemodify(a:source_file, ':p:h').'/' let source_dir = fnamemodify(a:source_file, ':p:h').'/'
if lnk =~ '/$' " link to a directory if lnk =~# '/$' " link to a directory
return [] return []
elseif url == '' && anchor != '' " only anchor elseif url == '' && anchor != '' " only anchor
return [fnamemodify(a:source_file, ':p'), anchor] return [fnamemodify(a:source_file, ':p'), anchor]
@ -696,7 +696,7 @@ function! s:link_target(source_file, wiki_nr, link_text) "{{{
return [vimwiki#path#normalize(source_dir.lnk), ''] return [vimwiki#path#normalize(source_dir.lnk), '']
elseif target_idx >= len(g:vimwiki_list) " a malformed link elseif target_idx >= len(g:vimwiki_list) " a malformed link
return ['', ''] return ['', '']
elseif scheme !~ '^wiki\d\+\|diary' " unknown scheme elseif scheme !~# '^wiki\d\+\|diary' " unknown scheme
return [] return []
endif endif
@ -706,7 +706,7 @@ function! s:link_target(source_file, wiki_nr, link_text) "{{{
let ext = VimwikiGet('ext', a:wiki_nr) let ext = VimwikiGet('ext', a:wiki_nr)
else else
" a schemeless link is like a link to the current wiki " a schemeless link is like a link to the current wiki
if a:link_text !~ '^wiki\d\+:' if a:link_text !~# '^wiki\d\+:'
let target_idx = a:wiki_nr let target_idx = a:wiki_nr
endif endif
@ -1028,7 +1028,7 @@ function! s:get_wiki_buffers() "{{{
while bcount<=bufnr("$") while bcount<=bufnr("$")
if bufexists(bcount) if bufexists(bcount)
let bname = fnamemodify(bufname(bcount), ":p") let bname = fnamemodify(bufname(bcount), ":p")
if bname =~ VimwikiGet('ext')."$" if bname =~# VimwikiGet('ext')."$"
let bitem = [bname, getbufvar(bname, "vimwiki_prev_link")] let bitem = [bname, getbufvar(bname, "vimwiki_prev_link")]
call add(blist, bitem) call add(blist, bitem)
endif endif
@ -1090,7 +1090,7 @@ function! vimwiki#base#nested_syntax(filetype, start, end, textSnipHl) abort "{{
" Here perlFunctionName (with quite an angry regexp "\h\w*[^:]") clashes with " Here perlFunctionName (with quite an angry regexp "\h\w*[^:]") clashes with
" the rest syntax rules as now it has effect being really 'contained'. " the rest syntax rules as now it has effect being really 'contained'.
" Clear it! " Clear it!
if ft =~ 'perl' if ft =~? 'perl'
syntax clear perlFunctionName syntax clear perlFunctionName
endif endif
endfunction "}}} endfunction "}}}
@ -1104,8 +1104,8 @@ endfunction " }}}
" vimwiki#base#find_prev_link " vimwiki#base#find_prev_link
function! vimwiki#base#find_prev_link() "{{{ function! vimwiki#base#find_prev_link() "{{{
"Jump 2 times if the cursor is in the middle of a link "Jump 2 times if the cursor is in the middle of a link
if synIDattr(synID(line('.'), col('.'), 0), "name") =~ "VimwikiLink.*" && if synIDattr(synID(line('.'), col('.'), 0), "name") =~# "VimwikiLink.*" &&
\ synIDattr(synID(line('.'), col('.')-1, 0), "name") =~ "VimwikiLink.*" \ synIDattr(synID(line('.'), col('.')-1, 0), "name") =~# "VimwikiLink.*"
call vimwiki#base#search_word(g:vimwiki_rxAnyLink, 'b') call vimwiki#base#search_word(g:vimwiki_rxAnyLink, 'b')
endif endif
call vimwiki#base#search_word(g:vimwiki_rxAnyLink, 'b') call vimwiki#base#search_word(g:vimwiki_rxAnyLink, 'b')
@ -1252,7 +1252,7 @@ function! vimwiki#base#rename_link() "{{{
let new_link = input('Enter new name: ') let new_link = input('Enter new name: ')
if new_link =~ '[/\\]' if new_link =~# '[/\\]'
" It is actually doable but I do not have free time to do it. " It is actually doable but I do not have free time to do it.
echomsg 'vimwiki: Cannot rename to a filename with path!' echomsg 'vimwiki: Cannot rename to a filename with path!'
return return
@ -1383,7 +1383,7 @@ function! vimwiki#base#TO_header(inner, visual) "{{{
call cursor(line('$'), 0) call cursor(line('$'), 0)
endif endif
if a:inner && getline(line('.')) =~ '^\s*$' if a:inner && getline(line('.')) =~# '^\s*$'
let lnum = prevnonblank(line('.') - 1) let lnum = prevnonblank(line('.') - 1)
call cursor(lnum, 0) call cursor(lnum, 0)
endif endif
@ -1479,7 +1479,7 @@ function! vimwiki#base#TO_table_col(inner, visual) "{{{
" | bla | bla | " | bla | bla |
" |-------+-------| " |-------+-------|
" or it will select wrong column. " or it will select wrong column.
if strpart(getline('.'), virtcol('.')-1) =~ '^-+' if strpart(getline('.'), virtcol('.')-1) =~# '^-+'
let s_flag = 'b' let s_flag = 'b'
else else
let s_flag = 'cb' let s_flag = 'cb'
@ -1502,7 +1502,7 @@ function! vimwiki#base#TO_table_col(inner, visual) "{{{
normal! `> normal! `>
if !firsttime && getline('.')[virtcol('.')] == '|' if !firsttime && getline('.')[virtcol('.')] == '|'
normal! l normal! l
elseif a:inner && getline('.')[virtcol('.')+1] =~ '[|+]' elseif a:inner && getline('.')[virtcol('.')+1] =~# '[|+]'
normal! 2l normal! 2l
endif endif
" search for the next column separator " search for the next column separator
@ -1533,7 +1533,7 @@ function! vimwiki#base#TO_table_col(inner, visual) "{{{
" | bla | bla | " | bla | bla |
" |-------+-------| " |-------+-------|
" or it will select wrong column. " or it will select wrong column.
if strpart(getline('.'), virtcol('.')-1) =~ '^-+' if strpart(getline('.'), virtcol('.')-1) =~# '^-+'
let s_flag = 'b' let s_flag = 'b'
else else
let s_flag = 'cb' let s_flag = 'cb'
@ -1576,11 +1576,11 @@ function! vimwiki#base#AddHeaderLevel() "{{{
let lnum = line('.') let lnum = line('.')
let line = getline(lnum) let line = getline(lnum)
let rxHdr = g:vimwiki_rxH let rxHdr = g:vimwiki_rxH
if line =~ '^\s*$' if line =~# '^\s*$'
return return
endif endif
if line =~ g:vimwiki_rxHeader if line =~# g:vimwiki_rxHeader
let level = vimwiki#u#count_first_sym(line) let level = vimwiki#u#count_first_sym(line)
if level < 6 if level < 6
if g:vimwiki_symH if g:vimwiki_symH
@ -1604,16 +1604,16 @@ function! vimwiki#base#RemoveHeaderLevel() "{{{
let lnum = line('.') let lnum = line('.')
let line = getline(lnum) let line = getline(lnum)
let rxHdr = g:vimwiki_rxH let rxHdr = g:vimwiki_rxH
if line =~ '^\s*$' if line =~# '^\s*$'
return return
endif endif
if line =~ g:vimwiki_rxHeader if line =~# g:vimwiki_rxHeader
let level = vimwiki#u#count_first_sym(line) let level = vimwiki#u#count_first_sym(line)
let old = repeat(rxHdr, level) let old = repeat(rxHdr, level)
let new = repeat(rxHdr, level - 1) let new = repeat(rxHdr, level - 1)
let chomp = line =~ rxHdr.'\s' let chomp = line =~# rxHdr.'\s'
if g:vimwiki_symH if g:vimwiki_symH
let line = substitute(line, old, new, 'g') let line = substitute(line, old, new, 'g')
@ -1665,7 +1665,7 @@ function! vimwiki#base#table_of_contents(create)
" delete old TOC " delete old TOC
if toc_line > 0 if toc_line > 0
let endoftoc = toc_line+1 let endoftoc = toc_line+1
while endoftoc <= line('$') && getline(endoftoc) =~ '^\s*'.rx_bullet.g:vimwiki_rxWikiLink.'\s*$' while endoftoc <= line('$') && getline(endoftoc) =~# '^\s*'.rx_bullet.g:vimwiki_rxWikiLink.'\s*$'
let endoftoc += 1 let endoftoc += 1
endwhile endwhile
silent exe toc_line.','.string(endoftoc-1).'delete _' silent exe toc_line.','.string(endoftoc-1).'delete _'
@ -1678,7 +1678,7 @@ function! vimwiki#base#table_of_contents(create)
let headers_levels = [['', 0], ['', 0], ['', 0], ['', 0], ['', 0], ['', 0]] let headers_levels = [['', 0], ['', 0], ['', 0], ['', 0], ['', 0], ['', 0]]
for lnum in range(1, line('$')) for lnum in range(1, line('$'))
let line_content = getline(lnum) let line_content = getline(lnum)
if line_content !~ g:vimwiki_rxHeader if line_content !~# g:vimwiki_rxHeader
continue continue
endif endif
let h_level = vimwiki#u#count_first_sym(line_content) let h_level = vimwiki#u#count_first_sym(line_content)
@ -1720,7 +1720,7 @@ function! vimwiki#base#table_of_contents(create)
call append(toc_line, startindent.repeat(indentstring, lvl-1).bullet.link) call append(toc_line, startindent.repeat(indentstring, lvl-1).bullet.link)
let toc_line += 1 let toc_line += 1
endfor endfor
if getline(toc_line+1) !~ '^\s*$' if getline(toc_line+1) !~# '^\s*$'
call append(toc_line, '') call append(toc_line, '')
endif endif
call setpos('.', old_cursor_pos) call setpos('.', old_cursor_pos)

View File

@ -28,7 +28,7 @@ endfunction "}}}
function! s:link_exists(lines, link) "{{{ function! s:link_exists(lines, link) "{{{
let link_exists = 0 let link_exists = 0
for line in a:lines for line in a:lines
if line =~ escape(a:link, '[]\') if line =~# escape(a:link, '[]\')
let link_exists = 1 let link_exists = 1
break break
endif endif
@ -54,7 +54,7 @@ endfunction "}}}
function! s:get_position_links(link) "{{{ function! s:get_position_links(link) "{{{
let idx = -1 let idx = -1
let links = [] let links = []
if a:link =~ '^\d\{4}-\d\d-\d\d' if a:link =~# '^\d\{4}-\d\d-\d\d'
let links = keys(s:get_diary_links()) let links = keys(s:get_diary_links())
" include 'today' into links " include 'today' into links
if index(links, s:diary_date_link()) == -1 if index(links, s:diary_date_link()) == -1
@ -81,7 +81,7 @@ fun! s:read_captions(files) "{{{
if filereadable(fl) if filereadable(fl)
for line in readfile(fl, '', s:vimwiki_max_scan_for_caption) for line in readfile(fl, '', s:vimwiki_max_scan_for_caption)
if line =~ g:vimwiki_rxHeader && !has_key(result, fl_key) if line =~# g:vimwiki_rxHeader && !has_key(result, fl_key)
let result[fl_key] = vimwiki#u#trim(matchstr(line, g:vimwiki_rxHeader)) let result[fl_key] = vimwiki#u#trim(matchstr(line, g:vimwiki_rxHeader))
endif endif
endfor endfor
@ -99,10 +99,10 @@ fun! s:get_diary_links(...) "{{{
let rx = '^\d\{4}-\d\d-\d\d' let rx = '^\d\{4}-\d\d-\d\d'
let s_files = glob(VimwikiGet('path').VimwikiGet('diary_rel_path').'*'.VimwikiGet('ext')) let s_files = glob(VimwikiGet('path').VimwikiGet('diary_rel_path').'*'.VimwikiGet('ext'))
let files = split(s_files, '\n') let files = split(s_files, '\n')
call filter(files, 'fnamemodify(v:val, ":t") =~ "'.escape(rx, '\').'"') call filter(files, 'fnamemodify(v:val, ":t") =~# "'.escape(rx, '\').'"')
" remove backup files (.wiki~) " remove backup files (.wiki~)
call filter(files, 'v:val !~ ''.*\~$''') call filter(files, 'v:val !~# ''.*\~$''')
if a:0 if a:0
call add(files, a:1) call add(files, a:1)

View File

@ -31,27 +31,27 @@ function! s:syntax_supported() " {{{
endfunction " }}} endfunction " }}}
function! s:remove_blank_lines(lines) " {{{ function! s:remove_blank_lines(lines) " {{{
while !empty(a:lines) && a:lines[-1] =~ '^\s*$' while !empty(a:lines) && a:lines[-1] =~# '^\s*$'
call remove(a:lines, -1) call remove(a:lines, -1)
endwhile endwhile
endfunction "}}} endfunction "}}}
function! s:is_web_link(lnk) "{{{ function! s:is_web_link(lnk) "{{{
if a:lnk =~ '^\%(https://\|http://\|www.\|ftp://\|file://\|mailto:\)' if a:lnk =~# '^\%(https://\|http://\|www.\|ftp://\|file://\|mailto:\)'
return 1 return 1
endif endif
return 0 return 0
endfunction "}}} endfunction "}}}
function! s:is_img_link(lnk) "{{{ function! s:is_img_link(lnk) "{{{
if tolower(a:lnk) =~ '\.\%(png\|jpg\|gif\|jpeg\)$' if tolower(a:lnk) =~# '\.\%(png\|jpg\|gif\|jpeg\)$'
return 1 return 1
endif endif
return 0 return 0
endfunction "}}} endfunction "}}}
function! s:has_abs_path(fname) "{{{ function! s:has_abs_path(fname) "{{{
if a:fname =~ '\(^.:\)\|\(^/\)' if a:fname =~# '\(^.:\)\|\(^/\)'
return 1 return 1
endif endif
return 0 return 0
@ -243,7 +243,7 @@ endfunction "}}}
function! s:html_insert_contents(html_lines, content) "{{{ function! s:html_insert_contents(html_lines, content) "{{{
let lines = [] let lines = []
for line in a:html_lines for line in a:html_lines
if line =~ '%content%' if line =~# '%content%'
let parts = split(line, '%content%', 1) let parts = split(line, '%content%', 1)
if empty(parts) if empty(parts)
call extend(lines, a:content) call extend(lines, a:content)
@ -338,7 +338,7 @@ function! vimwiki#html#linkify_link(src, descr) "{{{
let src_str = ' href="'.s:safe_html_anchor(a:src).'"' let src_str = ' href="'.s:safe_html_anchor(a:src).'"'
let descr = substitute(a:descr,'^\s*\(.*\)\s*$','\1','') let descr = substitute(a:descr,'^\s*\(.*\)\s*$','\1','')
let descr = (descr == "" ? a:src : descr) let descr = (descr == "" ? a:src : descr)
let descr_str = (descr =~ g:vimwiki_rxWikiIncl let descr_str = (descr =~# g:vimwiki_rxWikiIncl
\ ? s:tag_wikiincl(descr) \ ? s:tag_wikiincl(descr)
\ : descr) \ : descr)
return '<a'.src_str.'>'.descr_str.'</a>' return '<a'.src_str.'>'.descr_str.'</a>'
@ -430,7 +430,7 @@ function! s:tag_remove_internal_link(value) "{{{
let value = s:mid(a:value, 2) let value = s:mid(a:value, 2)
let line = '' let line = ''
if value =~ '|' if value =~# '|'
let link_parts = split(value, "|", 1) let link_parts = split(value, "|", 1)
else else
let link_parts = split(value, "][", 1) let link_parts = split(value, "][", 1)
@ -735,8 +735,8 @@ function! s:process_tag_pre(line, pre) "{{{
let pre = a:pre let pre = a:pre
let processed = 0 let processed = 0
"XXX huh? "XXX huh?
"if !pre[0] && a:line =~ '^\s*{{{[^\(}}}\)]*\s*$' "if !pre[0] && a:line =~# '^\s*{{{[^\(}}}\)]*\s*$'
if !pre[0] && a:line =~ '^\s*{{{' if !pre[0] && a:line =~# '^\s*{{{'
let class = matchstr(a:line, '{{{\zs.*$') let class = matchstr(a:line, '{{{\zs.*$')
"FIXME class cannot contain arbitrary strings "FIXME class cannot contain arbitrary strings
let class = substitute(class, '\s\+$', '', 'g') let class = substitute(class, '\s\+$', '', 'g')
@ -747,7 +747,7 @@ function! s:process_tag_pre(line, pre) "{{{
endif endif
let pre = [1, len(matchstr(a:line, '^\s*\ze{{{'))] let pre = [1, len(matchstr(a:line, '^\s*\ze{{{'))]
let processed = 1 let processed = 1
elseif pre[0] && a:line =~ '^\s*}}}\s*$' elseif pre[0] && a:line =~# '^\s*}}}\s*$'
let pre = [0, 0] let pre = [0, 0]
call add(lines, "</pre>") call add(lines, "</pre>")
let processed = 1 let processed = 1
@ -765,7 +765,7 @@ function! s:process_tag_math(line, math) "{{{
let lines = [] let lines = []
let math = a:math let math = a:math
let processed = 0 let processed = 0
if !math[0] && a:line =~ '^\s*{{\$[^\(}}$\)]*\s*$' if !math[0] && a:line =~# '^\s*{{\$[^\(}}$\)]*\s*$'
let class = matchstr(a:line, '{{$\zs.*$') let class = matchstr(a:line, '{{$\zs.*$')
"FIXME class cannot be any string! "FIXME class cannot be any string!
let class = substitute(class, '\s\+$', '', 'g') let class = substitute(class, '\s\+$', '', 'g')
@ -781,7 +781,7 @@ function! s:process_tag_math(line, math) "{{{
endif endif
let math = [1, len(matchstr(a:line, '^\s*\ze{{\$'))] let math = [1, len(matchstr(a:line, '^\s*\ze{{\$'))]
let processed = 1 let processed = 1
elseif math[0] && a:line =~ '^\s*}}\$\s*$' elseif math[0] && a:line =~# '^\s*}}\$\s*$'
let math = [0, 0] let math = [0, 0]
if s:current_math_env != "" if s:current_math_env != ""
call add(lines, "\\end{".s:current_math_env."}") call add(lines, "\\end{".s:current_math_env."}")
@ -800,7 +800,7 @@ function! s:process_tag_quote(line, quote) "{{{
let lines = [] let lines = []
let quote = a:quote let quote = a:quote
let processed = 0 let processed = 0
if a:line =~ '^\s\{4,}\S' if a:line =~# '^\s\{4,}\S'
if !quote if !quote
call add(lines, "<blockquote>") call add(lines, "<blockquote>")
let quote = 1 let quote = 1
@ -843,12 +843,12 @@ function! s:process_tag_list(line, lists) "{{{
let lines = [] let lines = []
let processed = 0 let processed = 0
if a:line =~ '^\s*'.s:bullets.'\s' if a:line =~# '^\s*'.s:bullets.'\s'
let lstSym = matchstr(a:line, s:bullets) let lstSym = matchstr(a:line, s:bullets)
let lstTagOpen = '<ul>' let lstTagOpen = '<ul>'
let lstTagClose = '</ul>' let lstTagClose = '</ul>'
let lstRegExp = '^\s*'.s:bullets.'\s' let lstRegExp = '^\s*'.s:bullets.'\s'
elseif a:line =~ '^\s*'.s:numbers.'\s' elseif a:line =~# '^\s*'.s:numbers.'\s'
let lstSym = matchstr(a:line, s:numbers) let lstSym = matchstr(a:line, s:numbers)
let lstTagOpen = '<ol>' let lstTagOpen = '<ol>'
let lstTagClose = '</ol>' let lstTagClose = '</ol>'
@ -893,7 +893,7 @@ function! s:process_tag_list(line, lists) "{{{
call add(lines, call add(lines,
\ substitute(a:line, lstRegExp.'\%('.checkbox.'\)\?', '', '')) \ substitute(a:line, lstRegExp.'\%('.checkbox.'\)\?', '', ''))
let processed = 1 let processed = 1
elseif in_list && a:line =~ '^\s\+\S\+' elseif in_list && a:line =~# '^\s\+\S\+'
if g:vimwiki_list_ignore_newline if g:vimwiki_list_ignore_newline
call add(lines, a:line) call add(lines, a:line)
else else
@ -934,14 +934,14 @@ function! s:process_tag_para(line, para) "{{{
let lines = [] let lines = []
let para = a:para let para = a:para
let processed = 0 let processed = 0
if a:line =~ '^\s\{,3}\S' if a:line =~# '^\s\{,3}\S'
if !para if !para
call add(lines, "<p>") call add(lines, "<p>")
let para = 1 let para = 1
endif endif
let processed = 1 let processed = 1
call add(lines, a:line) call add(lines, a:line)
elseif para && a:line =~ '^\s*$' elseif para && a:line =~# '^\s*$'
call add(lines, "</p>") call add(lines, "</p>")
let para = 0 let para = 0
endif endif
@ -955,7 +955,7 @@ function! s:process_tag_h(line, id) "{{{
let h_text = '' let h_text = ''
let h_id = '' let h_id = ''
if a:line =~ g:vimwiki_rxHeader if a:line =~# g:vimwiki_rxHeader
let h_level = vimwiki#u#count_first_sym(a:line) let h_level = vimwiki#u#count_first_sym(a:line)
endif endif
if h_level > 0 if h_level > 0
@ -964,7 +964,7 @@ function! s:process_tag_h(line, id) "{{{
let h_number = '' let h_number = ''
let h_complete_id = '' let h_complete_id = ''
let h_id = s:safe_html_anchor(h_text) let h_id = s:safe_html_anchor(h_text)
let centered = (a:line =~ '^\s') let centered = (a:line =~# '^\s')
if h_text !=# g:vimwiki_toc_header if h_text !=# g:vimwiki_toc_header
@ -1018,7 +1018,7 @@ endfunction "}}}
function! s:process_tag_hr(line) "{{{ function! s:process_tag_hr(line) "{{{
let line = a:line let line = a:line
let processed = 0 let processed = 0
if a:line =~ '^-----*$' if a:line =~# '^-----*$'
let line = '<hr />' let line = '<hr />'
let processed = 1 let processed = 1
endif endif
@ -1029,15 +1029,15 @@ function! s:process_tag_table(line, table, header_ids) "{{{
function! s:table_empty_cell(value) "{{{ function! s:table_empty_cell(value) "{{{
let cell = {} let cell = {}
if a:value =~ '^\s*\\/\s*$' if a:value =~# '^\s*\\/\s*$'
let cell.body = '' let cell.body = ''
let cell.rowspan = 0 let cell.rowspan = 0
let cell.colspan = 1 let cell.colspan = 1
elseif a:value =~ '^\s*&gt;\s*$' elseif a:value =~# '^\s*&gt;\s*$'
let cell.body = '' let cell.body = ''
let cell.rowspan = 1 let cell.rowspan = 1
let cell.colspan = 0 let cell.colspan = 0
elseif a:value =~ '^\s*$' elseif a:value =~# '^\s*$'
let cell.body = '&nbsp;' let cell.body = '&nbsp;'
let cell.rowspan = 1 let cell.rowspan = 1
let cell.colspan = 1 let cell.colspan = 1
@ -1052,7 +1052,7 @@ function! s:process_tag_table(line, table, header_ids) "{{{
function! s:table_add_row(table, line) "{{{ function! s:table_add_row(table, line) "{{{
if empty(a:table) if empty(a:table)
if a:line =~ '^\s\+' if a:line =~# '^\s\+'
let row = ['center', []] let row = ['center', []]
else else
let row = ['normal', []] let row = ['normal', []]
@ -1134,14 +1134,14 @@ function! s:parse_line(line, state) " {{{
"}}} "}}}
if !processed if !processed
if line =~ g:vimwiki_rxComment if line =~# g:vimwiki_rxComment
let processed = 1 let processed = 1
endif endif
endif endif
" nohtml -- placeholder " nohtml -- placeholder
if !processed if !processed
if line =~ '^\s*%nohtml' if line =~# '^\s*%nohtml'
let processed = 1 let processed = 1
let state.placeholder = ['nohtml'] let state.placeholder = ['nohtml']
endif endif
@ -1149,7 +1149,7 @@ function! s:parse_line(line, state) " {{{
" title -- placeholder " title -- placeholder
if !processed if !processed
if line =~ '^\s*%title' if line =~# '^\s*%title'
let processed = 1 let processed = 1
let param = matchstr(line, '^\s*%title\s\zs.*') let param = matchstr(line, '^\s*%title\s\zs.*')
let state.placeholder = ['title', param] let state.placeholder = ['title', param]
@ -1158,7 +1158,7 @@ function! s:parse_line(line, state) " {{{
" html template -- placeholder "{{{ " html template -- placeholder "{{{
if !processed if !processed
if line =~ '^\s*%template' if line =~# '^\s*%template'
let processed = 1 let processed = 1
let param = matchstr(line, '^\s*%template\s\zs.*') let param = matchstr(line, '^\s*%template\s\zs.*')
let state.placeholder = ['template', param] let state.placeholder = ['template', param]

View File

@ -185,7 +185,7 @@ endfunction "}}}
"Returns: level of the line "Returns: level of the line
"0 is the 'highest' level "0 is the 'highest' level
function! s:get_level(lnum) "{{{ function! s:get_level(lnum) "{{{
if getline(a:lnum) =~ '^\s*$' if getline(a:lnum) =~# '^\s*$'
return 0 return 0
endif endif
if VimwikiGet('syntax') !=? 'media' if VimwikiGet('syntax') !=? 'media'
@ -207,7 +207,7 @@ function! s:guess_kind_of_numbered_item(item) "{{{
let number_chars = a:item.mrkr[:-2] let number_chars = a:item.mrkr[:-2]
let divisor = a:item.mrkr[-1:] let divisor = a:item.mrkr[-1:]
if number_chars =~ '\d\+' if number_chars =~# '\d\+'
return '1' return '1'
endif endif
if number_chars =~# '\l\+' if number_chars =~# '\l\+'
@ -1286,7 +1286,7 @@ endfunction "}}}
function! vimwiki#lst#kbd_O() "{{{ function! vimwiki#lst#kbd_O() "{{{
normal! Ox normal! Ox
let cur_ln = line('.') let cur_ln = line('.')
if getline(cur_ln+1) !~ '^\s*$' if getline(cur_ln+1) !~# '^\s*$'
call s:clone_marker_from_to(cur_ln+1, cur_ln) call s:clone_marker_from_to(cur_ln+1, cur_ln)
else else
call s:clone_marker_from_to(cur_ln-1, cur_ln) call s:clone_marker_from_to(cur_ln-1, cur_ln)
@ -1365,7 +1365,7 @@ function! s:cr_on_list_item(lnum, insert_new_marker, not_at_eol) "{{{
normal! gi  normal! gi 
call s:clone_marker_from_to(a:lnum, a:lnum+1) call s:clone_marker_from_to(a:lnum, a:lnum+1)
"tiny sweet extra feature: indent next line if current line ends with : "tiny sweet extra feature: indent next line if current line ends with :
if !a:not_at_eol && getline(a:lnum) =~ ':$' if !a:not_at_eol && getline(a:lnum) =~# ':$'
call s:change_level(a:lnum+1, a:lnum+1, 'increase', 0) call s:change_level(a:lnum+1, a:lnum+1, 'increase', 0)
endif endif
else else
@ -1393,17 +1393,17 @@ function! vimwiki#lst#kbd_cr(normal, just_mrkr) "{{{
endif endif
let insert_new_marker = (a:normal == 1 || a:normal == 3) let insert_new_marker = (a:normal == 1 || a:normal == 3)
if getline('.')[col("'^")-1:] =~ '^\s\+$' if getline('.')[col("'^")-1:] =~# '^\s\+$'
let cur_col = 0 let cur_col = 0
else else
let cur_col = col("$") - col("'^") let cur_col = col("$") - col("'^")
if getline('.')[col("'^")-1] =~ '\s' && exists("*strdisplaywidth") if getline('.')[col("'^")-1] =~# '\s' && exists("*strdisplaywidth")
let ws_behind_cursor = let ws_behind_cursor =
\ strdisplaywidth(matchstr(getline('.')[col("'^")-1:], '\s\+'), \ strdisplaywidth(matchstr(getline('.')[col("'^")-1:], '\s\+'),
\ virtcol("'^")-1) \ virtcol("'^")-1)
let cur_col -= ws_behind_cursor let cur_col -= ws_behind_cursor
endif endif
if insert_new_marker && cur_col == 0 && getline(lnum) =~ '\s$' if insert_new_marker && cur_col == 0 && getline(lnum) =~# '\s$'
let insert_new_marker = 0 let insert_new_marker = 0
endif endif
endif endif
@ -1450,7 +1450,7 @@ function! vimwiki#lst#toggle_list_item() "{{{
let new_cur_col = col("$") - cur_col_from_eol let new_cur_col = col("$") - cur_col_from_eol
call cursor(cur_item.lnum, new_cur_col >= 1 ? new_cur_col : 1) call cursor(cur_item.lnum, new_cur_col >= 1 ? new_cur_col : 1)
if cur_col_from_eol == 0 || getline(cur_item.lnum) =~ '^\s*$' if cur_col_from_eol == 0 || getline(cur_item.lnum) =~# '^\s*$'
startinsert! startinsert!
else else
startinsert startinsert

View File

@ -50,7 +50,7 @@ endfunction "}}}
function! vimwiki#path#is_link_to_dir(link) "{{{ function! vimwiki#path#is_link_to_dir(link) "{{{
" Check if link is to a directory. " Check if link is to a directory.
" It should be ended with \ or /. " It should be ended with \ or /.
if a:link =~ '.\+[/\\]$' if a:link =~# '.\+[/\\]$'
return 1 return 1
endif endif
return 0 return 0

View File

@ -54,28 +54,28 @@ function! s:sep_splitter() "{{{
endfunction "}}} endfunction "}}}
function! s:is_table(line) "{{{ function! s:is_table(line) "{{{
return s:is_separator(a:line) || (a:line !~ s:rxSep().s:rxSep() && a:line =~ '^\s*'.s:rxSep().'.\+'.s:rxSep().'\s*$') return s:is_separator(a:line) || (a:line !~# s:rxSep().s:rxSep() && a:line =~# '^\s*'.s:rxSep().'.\+'.s:rxSep().'\s*$')
endfunction "}}} endfunction "}}}
function! s:is_separator(line) "{{{ function! s:is_separator(line) "{{{
return a:line =~ '^\s*'.s:rxSep().'\(--\+'.s:rxSep().'\)\+\s*$' return a:line =~# '^\s*'.s:rxSep().'\(--\+'.s:rxSep().'\)\+\s*$'
endfunction "}}} endfunction "}}}
function! s:is_separator_tail(line) "{{{ function! s:is_separator_tail(line) "{{{
return a:line =~ '^\{-1}\%(\s*\|-*\)\%('.s:rxSep().'-\+\)\+'.s:rxSep().'\s*$' return a:line =~# '^\{-1}\%(\s*\|-*\)\%('.s:rxSep().'-\+\)\+'.s:rxSep().'\s*$'
endfunction "}}} endfunction "}}}
function! s:is_last_column(lnum, cnum) "{{{ function! s:is_last_column(lnum, cnum) "{{{
let line = strpart(getline(a:lnum), a:cnum - 1) let line = strpart(getline(a:lnum), a:cnum - 1)
"echomsg "DEBUG is_last_column> ".(line =~ s:rxSep().'\s*$' && line !~ s:rxSep().'.*'.s:rxSep().'\s*$') "echomsg "DEBUG is_last_column> ".(line =~# s:rxSep().'\s*$' && line !~# s:rxSep().'.*'.s:rxSep().'\s*$')
return line =~ s:rxSep().'\s*$' && line !~ s:rxSep().'.*'.s:rxSep().'\s*$' return line =~# s:rxSep().'\s*$' && line !~# s:rxSep().'.*'.s:rxSep().'\s*$'
endfunction "}}} endfunction "}}}
function! s:is_first_column(lnum, cnum) "{{{ function! s:is_first_column(lnum, cnum) "{{{
let line = strpart(getline(a:lnum), 0, a:cnum - 1) let line = strpart(getline(a:lnum), 0, a:cnum - 1)
"echomsg "DEBUG is_first_column> ".(line =~ '^\s*'.s:rxSep() && line !~ '^\s*'.s:rxSep().'.*'.s:rxSep()) "echomsg "DEBUG is_first_column> ".(line =~# '^\s*'.s:rxSep() && line !~# '^\s*'.s:rxSep().'.*'.s:rxSep())
return line =~ '^\s*$' || (line =~ '^\s*'.s:rxSep() && line !~ '^\s*'.s:rxSep().'.*'.s:rxSep()) return line =~# '^\s*$' || (line =~# '^\s*'.s:rxSep() && line !~# '^\s*'.s:rxSep().'.*'.s:rxSep())
endfunction "}}} endfunction "}}}
function! s:count_separators_up(lnum) "{{{ function! s:count_separators_up(lnum) "{{{

View File

@ -51,7 +51,7 @@ function! Complete_wikifiles(findstart, base)
endif endif
return -1 return -1
else else
if a:base !~ '#' if a:base !~# '#'
" we look for wiki files " we look for wiki files
if a:base =~# '^wiki\d:' if a:base =~# '^wiki\d:'
@ -148,12 +148,12 @@ function! VimwikiFoldLevel(lnum) "{{{
let line = getline(a:lnum) let line = getline(a:lnum)
" Header/section folding... " Header/section folding...
if line =~ g:vimwiki_rxHeader if line =~# g:vimwiki_rxHeader
return '>'.vimwiki#u#count_first_sym(line) return '>'.vimwiki#u#count_first_sym(line)
" Code block folding... " Code block folding...
elseif line =~ '^\s*'.g:vimwiki_rxPreStart elseif line =~# '^\s*'.g:vimwiki_rxPreStart
return 'a1' return 'a1'
elseif line =~ '^\s*'.g:vimwiki_rxPreEnd.'\s*$' elseif line =~# '^\s*'.g:vimwiki_rxPreEnd.'\s*$'
return 's1' return 's1'
else else
return "=" return "="
@ -194,7 +194,7 @@ function! VimwikiFoldText() "{{{
let main_text = substitute(line, '^\s*', repeat(' ',indent(v:foldstart)), '') let main_text = substitute(line, '^\s*', repeat(' ',indent(v:foldstart)), '')
let fold_len = v:foldend - v:foldstart + 1 let fold_len = v:foldend - v:foldstart + 1
let len_text = ' ['.fold_len.'] ' let len_text = ' ['.fold_len.'] '
if line !~ '^\s*'.g:vimwiki_rxPreStart if line !~# '^\s*'.g:vimwiki_rxPreStart
let [main_text, spare_len] = s:shorten_text(main_text, 50) let [main_text, spare_len] = s:shorten_text(main_text, 50)
return main_text.len_text return main_text.len_text
else else