turn all =~ into =~# or =~?; !~ analogically
This commit is contained in:
parent
6716ba709f
commit
e4de62b7d5
@ -230,7 +230,7 @@ function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme
|
||||
let lnk = a:lnk
|
||||
|
||||
" 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)
|
||||
|
||||
" Get scheme
|
||||
@ -244,7 +244,7 @@ function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme
|
||||
let anchor = ''
|
||||
|
||||
"extract anchor
|
||||
if scheme =~ 'wiki' || scheme =~ 'diary'
|
||||
if scheme =~# 'wiki' || scheme =~# 'diary'
|
||||
let split_lnk = split(lnk, '#', 1)
|
||||
let lnk = split_lnk[0]
|
||||
if len(split_lnk) <= 1 || split_lnk[-1] == ''
|
||||
@ -255,13 +255,13 @@ function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme
|
||||
endif
|
||||
|
||||
" do nothing if scheme is unknown to vimwiki
|
||||
if !(scheme =~ 'wiki.*' || scheme =~ 'diary' || scheme =~ 'local'
|
||||
\ || scheme =~ 'file')
|
||||
if !(scheme =~# 'wiki.*' || scheme =~# 'diary' || scheme =~# 'local'
|
||||
\ || scheme =~# 'file')
|
||||
return [idx, scheme, path, subdir, lnk, ext, scheme.':'.lnk, anchor]
|
||||
endif
|
||||
|
||||
" scheme behaviors
|
||||
if scheme =~ 'wiki\d\+'
|
||||
if scheme =~# 'wiki\d\+'
|
||||
let idx = eval(matchstr(scheme, '\D\+\zs\d\+\ze'))
|
||||
if idx < 0 || idx >= len(g:vimwiki_list)
|
||||
if !quiet
|
||||
@ -305,7 +305,7 @@ function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme
|
||||
if vimwiki#path#is_link_to_dir(lnk)
|
||||
let ext = (g:vimwiki_dir_link != '' ? g:vimwiki_dir_link . ext : '')
|
||||
endif
|
||||
elseif scheme =~ 'diary'
|
||||
elseif scheme =~# 'diary'
|
||||
if a:as_html
|
||||
" use cached value (save time when converting diary index!)
|
||||
let path = VimwikiGet('invsubdir')
|
||||
@ -316,7 +316,7 @@ function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme
|
||||
endif
|
||||
let idx = g:vimwiki_current_idx
|
||||
let subdir = VimwikiGet('diary_rel_path')
|
||||
elseif scheme =~ 'local'
|
||||
elseif scheme =~# 'local'
|
||||
" revisiting the 'lcd'-bug ...
|
||||
let path = VimwikiGet('path')
|
||||
let subdir = VimwikiGet('subdir')
|
||||
@ -324,7 +324,7 @@ function! vimwiki#base#resolve_scheme(lnk, as_html, ...) " {{{ Resolve scheme
|
||||
" prepend browser-specific file: scheme
|
||||
let path = 'file://'.fnamemodify(path, ":p")
|
||||
endif
|
||||
elseif scheme =~ 'file'
|
||||
elseif scheme =~# 'file'
|
||||
" RM repeated leading "/"'s within a link
|
||||
let lnk = substitute(lnk, '^/*', '/', '')
|
||||
" convert "/~..." into "~..." for fnamemodify
|
||||
@ -422,14 +422,14 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{
|
||||
return
|
||||
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'))
|
||||
\ ? 1 : 0)
|
||||
|
||||
let use_system_open = (
|
||||
\ scheme == '' ||
|
||||
\ scheme =~ 'wiki' ||
|
||||
\ scheme =~ 'diary' ? 0 : 1)
|
||||
\ scheme == '' ||
|
||||
\ scheme =~# 'wiki' ||
|
||||
\ scheme =~# 'diary' ? 0 : 1)
|
||||
|
||||
let vimwiki_prev_link = []
|
||||
" 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)
|
||||
let source_dir = fnamemodify(a:source_file, ':p:h').'/'
|
||||
|
||||
if lnk =~ '/$' " link to a directory
|
||||
if lnk =~# '/$' " link to a directory
|
||||
return []
|
||||
elseif url == '' && anchor != '' " only 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), '']
|
||||
elseif target_idx >= len(g:vimwiki_list) " a malformed link
|
||||
return ['', '']
|
||||
elseif scheme !~ '^wiki\d\+\|diary' " unknown scheme
|
||||
elseif scheme !~# '^wiki\d\+\|diary' " unknown scheme
|
||||
return []
|
||||
endif
|
||||
|
||||
@ -706,7 +706,7 @@ function! s:link_target(source_file, wiki_nr, link_text) "{{{
|
||||
let ext = VimwikiGet('ext', a:wiki_nr)
|
||||
else
|
||||
" 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
|
||||
endif
|
||||
|
||||
@ -1028,7 +1028,7 @@ function! s:get_wiki_buffers() "{{{
|
||||
while bcount<=bufnr("$")
|
||||
if bufexists(bcount)
|
||||
let bname = fnamemodify(bufname(bcount), ":p")
|
||||
if bname =~ VimwikiGet('ext')."$"
|
||||
if bname =~# VimwikiGet('ext')."$"
|
||||
let bitem = [bname, getbufvar(bname, "vimwiki_prev_link")]
|
||||
call add(blist, bitem)
|
||||
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
|
||||
" the rest syntax rules as now it has effect being really 'contained'.
|
||||
" Clear it!
|
||||
if ft =~ 'perl'
|
||||
if ft =~? 'perl'
|
||||
syntax clear perlFunctionName
|
||||
endif
|
||||
endfunction "}}}
|
||||
@ -1104,8 +1104,8 @@ endfunction " }}}
|
||||
" vimwiki#base#find_prev_link
|
||||
function! vimwiki#base#find_prev_link() "{{{
|
||||
"Jump 2 times if the cursor is in the middle of a link
|
||||
if synIDattr(synID(line('.'), col('.'), 0), "name") =~ "VimwikiLink.*" &&
|
||||
\ synIDattr(synID(line('.'), col('.')-1, 0), "name") =~ "VimwikiLink.*"
|
||||
if synIDattr(synID(line('.'), col('.'), 0), "name") =~# "VimwikiLink.*" &&
|
||||
\ synIDattr(synID(line('.'), col('.')-1, 0), "name") =~# "VimwikiLink.*"
|
||||
call vimwiki#base#search_word(g:vimwiki_rxAnyLink, 'b')
|
||||
endif
|
||||
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: ')
|
||||
|
||||
if new_link =~ '[/\\]'
|
||||
if new_link =~# '[/\\]'
|
||||
" It is actually doable but I do not have free time to do it.
|
||||
echomsg 'vimwiki: Cannot rename to a filename with path!'
|
||||
return
|
||||
@ -1383,7 +1383,7 @@ function! vimwiki#base#TO_header(inner, visual) "{{{
|
||||
call cursor(line('$'), 0)
|
||||
endif
|
||||
|
||||
if a:inner && getline(line('.')) =~ '^\s*$'
|
||||
if a:inner && getline(line('.')) =~# '^\s*$'
|
||||
let lnum = prevnonblank(line('.') - 1)
|
||||
call cursor(lnum, 0)
|
||||
endif
|
||||
@ -1479,7 +1479,7 @@ function! vimwiki#base#TO_table_col(inner, visual) "{{{
|
||||
" | bla | bla |
|
||||
" |-------+-------|
|
||||
" or it will select wrong column.
|
||||
if strpart(getline('.'), virtcol('.')-1) =~ '^-+'
|
||||
if strpart(getline('.'), virtcol('.')-1) =~# '^-+'
|
||||
let s_flag = 'b'
|
||||
else
|
||||
let s_flag = 'cb'
|
||||
@ -1502,7 +1502,7 @@ function! vimwiki#base#TO_table_col(inner, visual) "{{{
|
||||
normal! `>
|
||||
if !firsttime && getline('.')[virtcol('.')] == '|'
|
||||
normal! l
|
||||
elseif a:inner && getline('.')[virtcol('.')+1] =~ '[|+]'
|
||||
elseif a:inner && getline('.')[virtcol('.')+1] =~# '[|+]'
|
||||
normal! 2l
|
||||
endif
|
||||
" search for the next column separator
|
||||
@ -1533,7 +1533,7 @@ function! vimwiki#base#TO_table_col(inner, visual) "{{{
|
||||
" | bla | bla |
|
||||
" |-------+-------|
|
||||
" or it will select wrong column.
|
||||
if strpart(getline('.'), virtcol('.')-1) =~ '^-+'
|
||||
if strpart(getline('.'), virtcol('.')-1) =~# '^-+'
|
||||
let s_flag = 'b'
|
||||
else
|
||||
let s_flag = 'cb'
|
||||
@ -1576,11 +1576,11 @@ function! vimwiki#base#AddHeaderLevel() "{{{
|
||||
let lnum = line('.')
|
||||
let line = getline(lnum)
|
||||
let rxHdr = g:vimwiki_rxH
|
||||
if line =~ '^\s*$'
|
||||
if line =~# '^\s*$'
|
||||
return
|
||||
endif
|
||||
|
||||
if line =~ g:vimwiki_rxHeader
|
||||
if line =~# g:vimwiki_rxHeader
|
||||
let level = vimwiki#u#count_first_sym(line)
|
||||
if level < 6
|
||||
if g:vimwiki_symH
|
||||
@ -1604,16 +1604,16 @@ function! vimwiki#base#RemoveHeaderLevel() "{{{
|
||||
let lnum = line('.')
|
||||
let line = getline(lnum)
|
||||
let rxHdr = g:vimwiki_rxH
|
||||
if line =~ '^\s*$'
|
||||
if line =~# '^\s*$'
|
||||
return
|
||||
endif
|
||||
|
||||
if line =~ g:vimwiki_rxHeader
|
||||
if line =~# g:vimwiki_rxHeader
|
||||
let level = vimwiki#u#count_first_sym(line)
|
||||
let old = repeat(rxHdr, level)
|
||||
let new = repeat(rxHdr, level - 1)
|
||||
|
||||
let chomp = line =~ rxHdr.'\s'
|
||||
let chomp = line =~# rxHdr.'\s'
|
||||
|
||||
if g:vimwiki_symH
|
||||
let line = substitute(line, old, new, 'g')
|
||||
@ -1665,7 +1665,7 @@ function! vimwiki#base#table_of_contents(create)
|
||||
" delete old TOC
|
||||
if toc_line > 0
|
||||
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
|
||||
endwhile
|
||||
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]]
|
||||
for lnum in range(1, line('$'))
|
||||
let line_content = getline(lnum)
|
||||
if line_content !~ g:vimwiki_rxHeader
|
||||
if line_content !~# g:vimwiki_rxHeader
|
||||
continue
|
||||
endif
|
||||
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)
|
||||
let toc_line += 1
|
||||
endfor
|
||||
if getline(toc_line+1) !~ '^\s*$'
|
||||
if getline(toc_line+1) !~# '^\s*$'
|
||||
call append(toc_line, '')
|
||||
endif
|
||||
call setpos('.', old_cursor_pos)
|
||||
|
@ -28,7 +28,7 @@ endfunction "}}}
|
||||
function! s:link_exists(lines, link) "{{{
|
||||
let link_exists = 0
|
||||
for line in a:lines
|
||||
if line =~ escape(a:link, '[]\')
|
||||
if line =~# escape(a:link, '[]\')
|
||||
let link_exists = 1
|
||||
break
|
||||
endif
|
||||
@ -54,7 +54,7 @@ endfunction "}}}
|
||||
function! s:get_position_links(link) "{{{
|
||||
let idx = -1
|
||||
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())
|
||||
" include 'today' into links
|
||||
if index(links, s:diary_date_link()) == -1
|
||||
@ -81,7 +81,7 @@ fun! s:read_captions(files) "{{{
|
||||
|
||||
if filereadable(fl)
|
||||
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))
|
||||
endif
|
||||
endfor
|
||||
@ -99,10 +99,10 @@ fun! s:get_diary_links(...) "{{{
|
||||
let rx = '^\d\{4}-\d\d-\d\d'
|
||||
let s_files = glob(VimwikiGet('path').VimwikiGet('diary_rel_path').'*'.VimwikiGet('ext'))
|
||||
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~)
|
||||
call filter(files, 'v:val !~ ''.*\~$''')
|
||||
call filter(files, 'v:val !~# ''.*\~$''')
|
||||
|
||||
if a:0
|
||||
call add(files, a:1)
|
||||
|
@ -31,27 +31,27 @@ function! s:syntax_supported() " {{{
|
||||
endfunction " }}}
|
||||
|
||||
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)
|
||||
endwhile
|
||||
endfunction "}}}
|
||||
|
||||
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
|
||||
endif
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_img_link(lnk) "{{{
|
||||
if tolower(a:lnk) =~ '\.\%(png\|jpg\|gif\|jpeg\)$'
|
||||
if tolower(a:lnk) =~# '\.\%(png\|jpg\|gif\|jpeg\)$'
|
||||
return 1
|
||||
endif
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
function! s:has_abs_path(fname) "{{{
|
||||
if a:fname =~ '\(^.:\)\|\(^/\)'
|
||||
if a:fname =~# '\(^.:\)\|\(^/\)'
|
||||
return 1
|
||||
endif
|
||||
return 0
|
||||
@ -243,7 +243,7 @@ endfunction "}}}
|
||||
function! s:html_insert_contents(html_lines, content) "{{{
|
||||
let lines = []
|
||||
for line in a:html_lines
|
||||
if line =~ '%content%'
|
||||
if line =~# '%content%'
|
||||
let parts = split(line, '%content%', 1)
|
||||
if empty(parts)
|
||||
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 descr = substitute(a:descr,'^\s*\(.*\)\s*$','\1','')
|
||||
let descr = (descr == "" ? a:src : descr)
|
||||
let descr_str = (descr =~ g:vimwiki_rxWikiIncl
|
||||
let descr_str = (descr =~# g:vimwiki_rxWikiIncl
|
||||
\ ? s:tag_wikiincl(descr)
|
||||
\ : descr)
|
||||
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 line = ''
|
||||
if value =~ '|'
|
||||
if value =~# '|'
|
||||
let link_parts = split(value, "|", 1)
|
||||
else
|
||||
let link_parts = split(value, "][", 1)
|
||||
@ -735,8 +735,8 @@ function! s:process_tag_pre(line, pre) "{{{
|
||||
let pre = a:pre
|
||||
let processed = 0
|
||||
"XXX huh?
|
||||
"if !pre[0] && a:line =~ '^\s*{{{[^\(}}}\)]*\s*$'
|
||||
if !pre[0] && a:line =~ '^\s*{{{'
|
||||
"if !pre[0] && a:line =~# '^\s*{{{[^\(}}}\)]*\s*$'
|
||||
if !pre[0] && a:line =~# '^\s*{{{'
|
||||
let class = matchstr(a:line, '{{{\zs.*$')
|
||||
"FIXME class cannot contain arbitrary strings
|
||||
let class = substitute(class, '\s\+$', '', 'g')
|
||||
@ -747,7 +747,7 @@ function! s:process_tag_pre(line, pre) "{{{
|
||||
endif
|
||||
let pre = [1, len(matchstr(a:line, '^\s*\ze{{{'))]
|
||||
let processed = 1
|
||||
elseif pre[0] && a:line =~ '^\s*}}}\s*$'
|
||||
elseif pre[0] && a:line =~# '^\s*}}}\s*$'
|
||||
let pre = [0, 0]
|
||||
call add(lines, "</pre>")
|
||||
let processed = 1
|
||||
@ -765,7 +765,7 @@ function! s:process_tag_math(line, math) "{{{
|
||||
let lines = []
|
||||
let math = a:math
|
||||
let processed = 0
|
||||
if !math[0] && a:line =~ '^\s*{{\$[^\(}}$\)]*\s*$'
|
||||
if !math[0] && a:line =~# '^\s*{{\$[^\(}}$\)]*\s*$'
|
||||
let class = matchstr(a:line, '{{$\zs.*$')
|
||||
"FIXME class cannot be any string!
|
||||
let class = substitute(class, '\s\+$', '', 'g')
|
||||
@ -781,7 +781,7 @@ function! s:process_tag_math(line, math) "{{{
|
||||
endif
|
||||
let math = [1, len(matchstr(a:line, '^\s*\ze{{\$'))]
|
||||
let processed = 1
|
||||
elseif math[0] && a:line =~ '^\s*}}\$\s*$'
|
||||
elseif math[0] && a:line =~# '^\s*}}\$\s*$'
|
||||
let math = [0, 0]
|
||||
if 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 quote = a:quote
|
||||
let processed = 0
|
||||
if a:line =~ '^\s\{4,}\S'
|
||||
if a:line =~# '^\s\{4,}\S'
|
||||
if !quote
|
||||
call add(lines, "<blockquote>")
|
||||
let quote = 1
|
||||
@ -843,12 +843,12 @@ function! s:process_tag_list(line, lists) "{{{
|
||||
let lines = []
|
||||
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 lstTagOpen = '<ul>'
|
||||
let lstTagClose = '</ul>'
|
||||
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 lstTagOpen = '<ol>'
|
||||
let lstTagClose = '</ol>'
|
||||
@ -893,7 +893,7 @@ function! s:process_tag_list(line, lists) "{{{
|
||||
call add(lines,
|
||||
\ substitute(a:line, lstRegExp.'\%('.checkbox.'\)\?', '', ''))
|
||||
let processed = 1
|
||||
elseif in_list && a:line =~ '^\s\+\S\+'
|
||||
elseif in_list && a:line =~# '^\s\+\S\+'
|
||||
if g:vimwiki_list_ignore_newline
|
||||
call add(lines, a:line)
|
||||
else
|
||||
@ -934,14 +934,14 @@ function! s:process_tag_para(line, para) "{{{
|
||||
let lines = []
|
||||
let para = a:para
|
||||
let processed = 0
|
||||
if a:line =~ '^\s\{,3}\S'
|
||||
if a:line =~# '^\s\{,3}\S'
|
||||
if !para
|
||||
call add(lines, "<p>")
|
||||
let para = 1
|
||||
endif
|
||||
let processed = 1
|
||||
call add(lines, a:line)
|
||||
elseif para && a:line =~ '^\s*$'
|
||||
elseif para && a:line =~# '^\s*$'
|
||||
call add(lines, "</p>")
|
||||
let para = 0
|
||||
endif
|
||||
@ -955,7 +955,7 @@ function! s:process_tag_h(line, id) "{{{
|
||||
let h_text = ''
|
||||
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)
|
||||
endif
|
||||
if h_level > 0
|
||||
@ -964,7 +964,7 @@ function! s:process_tag_h(line, id) "{{{
|
||||
let h_number = ''
|
||||
let h_complete_id = ''
|
||||
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
|
||||
|
||||
@ -1018,7 +1018,7 @@ endfunction "}}}
|
||||
function! s:process_tag_hr(line) "{{{
|
||||
let line = a:line
|
||||
let processed = 0
|
||||
if a:line =~ '^-----*$'
|
||||
if a:line =~# '^-----*$'
|
||||
let line = '<hr />'
|
||||
let processed = 1
|
||||
endif
|
||||
@ -1029,15 +1029,15 @@ function! s:process_tag_table(line, table, header_ids) "{{{
|
||||
function! s:table_empty_cell(value) "{{{
|
||||
let cell = {}
|
||||
|
||||
if a:value =~ '^\s*\\/\s*$'
|
||||
if a:value =~# '^\s*\\/\s*$'
|
||||
let cell.body = ''
|
||||
let cell.rowspan = 0
|
||||
let cell.colspan = 1
|
||||
elseif a:value =~ '^\s*>\s*$'
|
||||
elseif a:value =~# '^\s*>\s*$'
|
||||
let cell.body = ''
|
||||
let cell.rowspan = 1
|
||||
let cell.colspan = 0
|
||||
elseif a:value =~ '^\s*$'
|
||||
elseif a:value =~# '^\s*$'
|
||||
let cell.body = ' '
|
||||
let cell.rowspan = 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) "{{{
|
||||
if empty(a:table)
|
||||
if a:line =~ '^\s\+'
|
||||
if a:line =~# '^\s\+'
|
||||
let row = ['center', []]
|
||||
else
|
||||
let row = ['normal', []]
|
||||
@ -1134,14 +1134,14 @@ function! s:parse_line(line, state) " {{{
|
||||
"}}}
|
||||
|
||||
if !processed
|
||||
if line =~ g:vimwiki_rxComment
|
||||
if line =~# g:vimwiki_rxComment
|
||||
let processed = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
" nohtml -- placeholder
|
||||
if !processed
|
||||
if line =~ '^\s*%nohtml'
|
||||
if line =~# '^\s*%nohtml'
|
||||
let processed = 1
|
||||
let state.placeholder = ['nohtml']
|
||||
endif
|
||||
@ -1149,7 +1149,7 @@ function! s:parse_line(line, state) " {{{
|
||||
|
||||
" title -- placeholder
|
||||
if !processed
|
||||
if line =~ '^\s*%title'
|
||||
if line =~# '^\s*%title'
|
||||
let processed = 1
|
||||
let param = matchstr(line, '^\s*%title\s\zs.*')
|
||||
let state.placeholder = ['title', param]
|
||||
@ -1158,7 +1158,7 @@ function! s:parse_line(line, state) " {{{
|
||||
|
||||
" html template -- placeholder "{{{
|
||||
if !processed
|
||||
if line =~ '^\s*%template'
|
||||
if line =~# '^\s*%template'
|
||||
let processed = 1
|
||||
let param = matchstr(line, '^\s*%template\s\zs.*')
|
||||
let state.placeholder = ['template', param]
|
||||
|
@ -185,7 +185,7 @@ endfunction "}}}
|
||||
"Returns: level of the line
|
||||
"0 is the 'highest' level
|
||||
function! s:get_level(lnum) "{{{
|
||||
if getline(a:lnum) =~ '^\s*$'
|
||||
if getline(a:lnum) =~# '^\s*$'
|
||||
return 0
|
||||
endif
|
||||
if VimwikiGet('syntax') !=? 'media'
|
||||
@ -207,7 +207,7 @@ function! s:guess_kind_of_numbered_item(item) "{{{
|
||||
let number_chars = a:item.mrkr[:-2]
|
||||
let divisor = a:item.mrkr[-1:]
|
||||
|
||||
if number_chars =~ '\d\+'
|
||||
if number_chars =~# '\d\+'
|
||||
return '1'
|
||||
endif
|
||||
if number_chars =~# '\l\+'
|
||||
@ -1286,7 +1286,7 @@ endfunction "}}}
|
||||
function! vimwiki#lst#kbd_O() "{{{
|
||||
normal! Ox
|
||||
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)
|
||||
else
|
||||
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
|
||||
call s:clone_marker_from_to(a:lnum, a:lnum+1)
|
||||
"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)
|
||||
endif
|
||||
else
|
||||
@ -1393,17 +1393,17 @@ function! vimwiki#lst#kbd_cr(normal, just_mrkr) "{{{
|
||||
endif
|
||||
|
||||
let insert_new_marker = (a:normal == 1 || a:normal == 3)
|
||||
if getline('.')[col("'^")-1:] =~ '^\s\+$'
|
||||
if getline('.')[col("'^")-1:] =~# '^\s\+$'
|
||||
let cur_col = 0
|
||||
else
|
||||
let cur_col = col("$") - col("'^")
|
||||
if getline('.')[col("'^")-1] =~ '\s' && exists("*strdisplaywidth")
|
||||
if getline('.')[col("'^")-1] =~# '\s' && exists("*strdisplaywidth")
|
||||
let ws_behind_cursor =
|
||||
\ strdisplaywidth(matchstr(getline('.')[col("'^")-1:], '\s\+'),
|
||||
\ virtcol("'^")-1)
|
||||
let cur_col -= ws_behind_cursor
|
||||
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
|
||||
endif
|
||||
endif
|
||||
@ -1450,7 +1450,7 @@ function! vimwiki#lst#toggle_list_item() "{{{
|
||||
let new_cur_col = col("$") - cur_col_from_eol
|
||||
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!
|
||||
else
|
||||
startinsert
|
||||
|
@ -50,7 +50,7 @@ endfunction "}}}
|
||||
function! vimwiki#path#is_link_to_dir(link) "{{{
|
||||
" Check if link is to a directory.
|
||||
" It should be ended with \ or /.
|
||||
if a:link =~ '.\+[/\\]$'
|
||||
if a:link =~# '.\+[/\\]$'
|
||||
return 1
|
||||
endif
|
||||
return 0
|
||||
|
@ -54,28 +54,28 @@ function! s:sep_splitter() "{{{
|
||||
endfunction "}}}
|
||||
|
||||
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 "}}}
|
||||
|
||||
function! s:is_separator(line) "{{{
|
||||
return a:line =~ '^\s*'.s:rxSep().'\(--\+'.s:rxSep().'\)\+\s*$'
|
||||
return a:line =~# '^\s*'.s:rxSep().'\(--\+'.s:rxSep().'\)\+\s*$'
|
||||
endfunction "}}}
|
||||
|
||||
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 "}}}
|
||||
|
||||
function! s:is_last_column(lnum, cnum) "{{{
|
||||
let line = strpart(getline(a:lnum), a:cnum - 1)
|
||||
"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*$'
|
||||
"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*$'
|
||||
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_first_column(lnum, cnum) "{{{
|
||||
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())
|
||||
return line =~ '^\s*$' || (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())
|
||||
endfunction "}}}
|
||||
|
||||
function! s:count_separators_up(lnum) "{{{
|
||||
|
@ -51,7 +51,7 @@ function! Complete_wikifiles(findstart, base)
|
||||
endif
|
||||
return -1
|
||||
else
|
||||
if a:base !~ '#'
|
||||
if a:base !~# '#'
|
||||
" we look for wiki files
|
||||
|
||||
if a:base =~# '^wiki\d:'
|
||||
@ -148,12 +148,12 @@ function! VimwikiFoldLevel(lnum) "{{{
|
||||
let line = getline(a:lnum)
|
||||
|
||||
" Header/section folding...
|
||||
if line =~ g:vimwiki_rxHeader
|
||||
if line =~# g:vimwiki_rxHeader
|
||||
return '>'.vimwiki#u#count_first_sym(line)
|
||||
" Code block folding...
|
||||
elseif line =~ '^\s*'.g:vimwiki_rxPreStart
|
||||
elseif line =~# '^\s*'.g:vimwiki_rxPreStart
|
||||
return 'a1'
|
||||
elseif line =~ '^\s*'.g:vimwiki_rxPreEnd.'\s*$'
|
||||
elseif line =~# '^\s*'.g:vimwiki_rxPreEnd.'\s*$'
|
||||
return 's1'
|
||||
else
|
||||
return "="
|
||||
@ -194,7 +194,7 @@ function! VimwikiFoldText() "{{{
|
||||
let main_text = substitute(line, '^\s*', repeat(' ',indent(v:foldstart)), '')
|
||||
let fold_len = v:foldend - v:foldstart + 1
|
||||
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)
|
||||
return main_text.len_text
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user