turn all == into ==# or ==? when comparing strings
or vimwiki#path#is_equal, if the strings are file names
This commit is contained in:
parent
b240b52a3f
commit
9ada4d2041
@ -436,7 +436,7 @@ function! vimwiki#base#open_link(cmd, link, ...) "{{{
|
|||||||
if update_prev_link
|
if update_prev_link
|
||||||
if a:0
|
if a:0
|
||||||
let vimwiki_prev_link = [a:1, []]
|
let vimwiki_prev_link = [a:1, []]
|
||||||
elseif &ft == 'vimwiki'
|
elseif &ft ==# 'vimwiki'
|
||||||
let vimwiki_prev_link = [expand('%:p'), getpos('.')]
|
let vimwiki_prev_link = [expand('%:p'), getpos('.')]
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -519,7 +519,8 @@ function! vimwiki#base#backlinks() "{{{
|
|||||||
let links = s:get_links(source_file, idx)
|
let links = s:get_links(source_file, idx)
|
||||||
for [target_file, _, lnum, col] in links
|
for [target_file, _, lnum, col] in links
|
||||||
" don't include links from the current file to itself
|
" don't include links from the current file to itself
|
||||||
if target_file == current_filename && target_file != source_file
|
if vimwiki#path#is_equal(target_file, current_filename) &&
|
||||||
|
\ !vimwiki#path#is_equal(target_file, source_file)
|
||||||
call add(locations, {'filename':source_file, 'lnum':lnum, 'col':col})
|
call add(locations, {'filename':source_file, 'lnum':lnum, 'col':col})
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@ -689,9 +690,9 @@ function! s:link_target(source_file, wiki_nr, link_text) "{{{
|
|||||||
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]
|
||||||
elseif scheme == 'file'
|
elseif scheme ==# 'file'
|
||||||
return [url, '']
|
return [url, '']
|
||||||
elseif scheme == 'local'
|
elseif scheme ==# 'local'
|
||||||
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 ['', '']
|
||||||
@ -699,7 +700,7 @@ function! s:link_target(source_file, wiki_nr, link_text) "{{{
|
|||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if scheme == 'diary'
|
if scheme ==# 'diary'
|
||||||
let root_dir = VimwikiGet('path',a:wiki_nr).
|
let root_dir = VimwikiGet('path',a:wiki_nr).
|
||||||
\ VimwikiGet('diary_rel_path', a:wiki_nr)
|
\ VimwikiGet('diary_rel_path', a:wiki_nr)
|
||||||
let ext = VimwikiGet('ext', a:wiki_nr)
|
let ext = VimwikiGet('ext', a:wiki_nr)
|
||||||
@ -858,7 +859,7 @@ function! vimwiki#base#edit_file(command, filename, anchor, ...) "{{{
|
|||||||
" which happens if we jump to an achor in the current file.
|
" which happens if we jump to an achor in the current file.
|
||||||
" This hack is necessary because apparently Vim messes up the result of
|
" This hack is necessary because apparently Vim messes up the result of
|
||||||
" getpos() directly after this command. Strange.
|
" getpos() directly after this command. Strange.
|
||||||
if !(a:command == ':e ' && a:filename == expand('%:p'))
|
if !(a:command ==# ':e ' && vimwiki#path#is_equal(a:filename, expand('%:p')))
|
||||||
execute a:command.' '.fname
|
execute a:command.' '.fname
|
||||||
endif
|
endif
|
||||||
if a:anchor != ''
|
if a:anchor != ''
|
||||||
@ -1124,11 +1125,11 @@ function! vimwiki#base#follow_link(split, ...) "{{{ Parse link at cursor and pas
|
|||||||
call vimwiki#{VimwikiGet('syntax')}_base#follow_link(a:split)
|
call vimwiki#{VimwikiGet('syntax')}_base#follow_link(a:split)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
if a:split == "split"
|
if a:split ==# "split"
|
||||||
let cmd = ":split "
|
let cmd = ":split "
|
||||||
elseif a:split == "vsplit"
|
elseif a:split ==# "vsplit"
|
||||||
let cmd = ":vsplit "
|
let cmd = ":vsplit "
|
||||||
elseif a:split == "tabnew"
|
elseif a:split ==# "tabnew"
|
||||||
let cmd = ":tabnew "
|
let cmd = ":tabnew "
|
||||||
else
|
else
|
||||||
let cmd = ":e "
|
let cmd = ":e "
|
||||||
|
@ -134,7 +134,7 @@ fun! s:group_links(links) "{{{
|
|||||||
endfun "}}}
|
endfun "}}}
|
||||||
|
|
||||||
fun! s:sort(lst) "{{{
|
fun! s:sort(lst) "{{{
|
||||||
if VimwikiGet("diary_sort") == 'desc'
|
if VimwikiGet("diary_sort") ==? 'desc'
|
||||||
return reverse(sort(a:lst))
|
return reverse(sort(a:lst))
|
||||||
else
|
else
|
||||||
return sort(a:lst)
|
return sort(a:lst)
|
||||||
@ -311,7 +311,7 @@ endfunction "}}}
|
|||||||
function! vimwiki#diary#generate_diary_section() "{{{
|
function! vimwiki#diary#generate_diary_section() "{{{
|
||||||
let current_file = vimwiki#path#path_norm(expand("%:p"))
|
let current_file = vimwiki#path#path_norm(expand("%:p"))
|
||||||
let diary_file = vimwiki#path#path_norm(s:diary_index())
|
let diary_file = vimwiki#path#path_norm(s:diary_index())
|
||||||
if current_file == diary_file
|
if vimwiki#path#is_equal(current_file, diary_file)
|
||||||
call s:delete_diary_section()
|
call s:delete_diary_section()
|
||||||
call s:insert_diary_section()
|
call s:insert_diary_section()
|
||||||
else
|
else
|
||||||
@ -327,7 +327,7 @@ function! vimwiki#diary#calendar_action(day, month, year, week, dir) "{{{
|
|||||||
|
|
||||||
let link = a:year.'-'.month.'-'.day
|
let link = a:year.'-'.month.'-'.day
|
||||||
if winnr('#') == 0
|
if winnr('#') == 0
|
||||||
if a:dir == 'V'
|
if a:dir ==? 'V'
|
||||||
vsplit
|
vsplit
|
||||||
else
|
else
|
||||||
split
|
split
|
||||||
|
@ -27,7 +27,7 @@ function! s:root_path(subdir) "{{{
|
|||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! s:syntax_supported() " {{{
|
function! s:syntax_supported() " {{{
|
||||||
return VimwikiGet('syntax') == "default"
|
return VimwikiGet('syntax') ==? "default"
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
function! s:remove_blank_lines(lines) " {{{
|
function! s:remove_blank_lines(lines) " {{{
|
||||||
@ -204,7 +204,7 @@ function! s:subst_func(line, regexp, func, ...) " {{{
|
|||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
function! s:save_vimwiki_buffer() "{{{
|
function! s:save_vimwiki_buffer() "{{{
|
||||||
if &filetype == 'vimwiki' && filewritable(expand('%'))
|
if &filetype ==? 'vimwiki' && filewritable(expand('%'))
|
||||||
silent update
|
silent update
|
||||||
endif
|
endif
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
@ -214,7 +214,7 @@ function! s:process_title(placeholders, default_title) "{{{
|
|||||||
if !empty(a:placeholders)
|
if !empty(a:placeholders)
|
||||||
for [placeholder, row, idx] in a:placeholders
|
for [placeholder, row, idx] in a:placeholders
|
||||||
let [type, param] = placeholder
|
let [type, param] = placeholder
|
||||||
if type == 'title' && !empty(param)
|
if type ==# 'title' && !empty(param)
|
||||||
return param
|
return param
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@ -457,8 +457,8 @@ function! s:tag_remove_external_link(value) "{{{
|
|||||||
let lnkElements = split(value)
|
let lnkElements = split(value)
|
||||||
let head = lnkElements[0]
|
let head = lnkElements[0]
|
||||||
let rest = join(lnkElements[1:])
|
let rest = join(lnkElements[1:])
|
||||||
if rest==""
|
if rest == ""
|
||||||
let rest=head
|
let rest = head
|
||||||
endif
|
endif
|
||||||
let line = rest
|
let line = rest
|
||||||
elseif s:is_img_link(value)
|
elseif s:is_img_link(value)
|
||||||
@ -484,7 +484,8 @@ function! s:make_tag(line, regexp, func, ...) "{{{
|
|||||||
|
|
||||||
"FIXME FIXME !!! these can easily occur on the same line!
|
"FIXME FIXME !!! these can easily occur on the same line!
|
||||||
"XXX {{{ }}} ??? obsolete
|
"XXX {{{ }}} ??? obsolete
|
||||||
if '`[^`]\+`' == a:regexp || '{{{.\+}}}' == a:regexp || g:vimwiki_rxEqIn == a:regexp
|
if '`[^`]\+`' ==# a:regexp || '{{{.\+}}}' ==# a:regexp ||
|
||||||
|
\ g:vimwiki_rxEqIn ==# a:regexp
|
||||||
let res_line = s:subst_func(a:line, a:regexp, a:func)
|
let res_line = s:subst_func(a:line, a:regexp, a:func)
|
||||||
else
|
else
|
||||||
let pos = 0
|
let pos = 0
|
||||||
@ -675,7 +676,7 @@ function! s:close_tag_table(table, ldest, header_ids) "{{{
|
|||||||
call s:sum_rowspan(table)
|
call s:sum_rowspan(table)
|
||||||
call s:sum_colspan(table)
|
call s:sum_colspan(table)
|
||||||
|
|
||||||
if table[0] == 'center'
|
if table[0] ==# 'center'
|
||||||
call add(ldest, "<table class='center'>")
|
call add(ldest, "<table class='center'>")
|
||||||
else
|
else
|
||||||
call add(ldest, "<table>")
|
call add(ldest, "<table>")
|
||||||
@ -1402,10 +1403,10 @@ function! vimwiki#html#Wiki2HTML(path_html, wikifile) "{{{
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if !empty(state.placeholder)
|
if !empty(state.placeholder)
|
||||||
if state.placeholder[0] == 'nohtml'
|
if state.placeholder[0] ==# 'nohtml'
|
||||||
let nohtml = 1
|
let nohtml = 1
|
||||||
break
|
break
|
||||||
elseif state.placeholder[0] == 'template'
|
elseif state.placeholder[0] ==# 'template'
|
||||||
let template_name = state.placeholder[1]
|
let template_name = state.placeholder[1]
|
||||||
else
|
else
|
||||||
call add(placeholders, [state.placeholder, len(ldest), len(placeholders)])
|
call add(placeholders, [state.placeholder, len(ldest), len(placeholders)])
|
||||||
|
@ -840,7 +840,7 @@ function! vimwiki#lst#toggle_cb(from_line, to_line) "{{{
|
|||||||
|
|
||||||
"if from_line has CB, toggle it and set all siblings to the same new state
|
"if from_line has CB, toggle it and set all siblings to the same new state
|
||||||
let rate_first_line = s:get_rate(from_item)
|
let rate_first_line = s:get_rate(from_item)
|
||||||
let new_rate = rate_first_line==100 ? 0 : 100
|
let new_rate = rate_first_line == 100 ? 0 : 100
|
||||||
|
|
||||||
for cur_ln in range(from_item.lnum, a:to_line)
|
for cur_ln in range(from_item.lnum, a:to_line)
|
||||||
let cur_item = s:get_item(cur_ln)
|
let cur_item = s:get_item(cur_ln)
|
||||||
@ -922,7 +922,7 @@ endfunction "}}}
|
|||||||
|
|
||||||
function! s:decrease_level(item) "{{{
|
function! s:decrease_level(item) "{{{
|
||||||
let removed_indent = 0
|
let removed_indent = 0
|
||||||
if VimwikiGet('syntax') == 'media' && a:item.type == 1 &&
|
if VimwikiGet('syntax') ==? 'media' && a:item.type == 1 &&
|
||||||
\ index(s:multiple_bullet_chars, s:first_char(a:item.mrkr)) > -1
|
\ index(s:multiple_bullet_chars, s:first_char(a:item.mrkr)) > -1
|
||||||
if s:string_length(a:item.mrkr) >= 2
|
if s:string_length(a:item.mrkr) >= 2
|
||||||
call s:substitute_string_in_line(a:item.lnum,
|
call s:substitute_string_in_line(a:item.lnum,
|
||||||
@ -944,7 +944,7 @@ endfunction "}}}
|
|||||||
|
|
||||||
function! s:increase_level(item) "{{{
|
function! s:increase_level(item) "{{{
|
||||||
let additional_indent = 0
|
let additional_indent = 0
|
||||||
if VimwikiGet('syntax') == 'media' && a:item.type == 1 &&
|
if VimwikiGet('syntax') ==? 'media' && a:item.type == 1 &&
|
||||||
\ index(s:multiple_bullet_chars, s:first_char(a:item.mrkr)) > -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 .
|
call s:substitute_string_in_line(a:item.lnum, a:item.mrkr, a:item.mrkr .
|
||||||
\ s:first_char(a:item.mrkr))
|
\ s:first_char(a:item.mrkr))
|
||||||
@ -966,7 +966,7 @@ endfunction "}}}
|
|||||||
"a:indent_by can be negative
|
"a:indent_by can be negative
|
||||||
function! s:indent_line_by(lnum, indent_by) "{{{
|
function! s:indent_line_by(lnum, indent_by) "{{{
|
||||||
let item = s:get_item(a:lnum)
|
let item = s:get_item(a:lnum)
|
||||||
if VimwikiGet('syntax') == 'media' && item.type == 1 &&
|
if VimwikiGet('syntax') ==? 'media' && item.type == 1 &&
|
||||||
\ index(s:multiple_bullet_chars, s:first_char(item.mrkr)) > -1
|
\ index(s:multiple_bullet_chars, s:first_char(item.mrkr)) > -1
|
||||||
if a:indent_by > 0
|
if a:indent_by > 0
|
||||||
call s:substitute_string_in_line(a:lnum, item.mrkr,
|
call s:substitute_string_in_line(a:lnum, item.mrkr,
|
||||||
@ -983,17 +983,17 @@ endfunction "}}}
|
|||||||
function! s:change_level(from_line, to_line, direction, plus_children) "{{{
|
function! s:change_level(from_line, to_line, direction, plus_children) "{{{
|
||||||
let from_item = s:get_corresponding_item(a:from_line)
|
let from_item = s:get_corresponding_item(a:from_line)
|
||||||
if from_item.type == 0
|
if from_item.type == 0
|
||||||
if a:direction == 'increase' && a:from_line == a:to_line &&
|
if a:direction ==# 'increase' && a:from_line == a:to_line &&
|
||||||
\ empty(getline(a:from_line))
|
\ empty(getline(a:from_line))
|
||||||
"that's because :> doesn't work on an empty line
|
"that's because :> doesn't work on an empty line
|
||||||
normal! gi
|
normal! gi
|
||||||
else
|
else
|
||||||
execute a:from_line.','.a:to_line.(a:direction == 'increase' ? '>' : '<')
|
execute a:from_line.','.a:to_line.(a:direction ==# 'increase' ? '>' : '<')
|
||||||
endif
|
endif
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if a:direction == 'decrease' && s:get_level(from_item.lnum) == 0
|
if a:direction ==# 'decrease' && s:get_level(from_item.lnum) == 0
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -1026,7 +1026,7 @@ function! s:change_level(from_line, to_line, direction, plus_children) "{{{
|
|||||||
let more_than_one_level_concerned = 0
|
let more_than_one_level_concerned = 0
|
||||||
|
|
||||||
let first_line_indented_by =
|
let first_line_indented_by =
|
||||||
\ (a:direction == 'increase') ?
|
\ (a:direction ==# 'increase') ?
|
||||||
\ s:increase_level(from_item) : s:decrease_level(from_item)
|
\ s:increase_level(from_item) : s:decrease_level(from_item)
|
||||||
|
|
||||||
let cur_ln = s:get_next_line(from_item.lnum)
|
let cur_ln = s:get_next_line(from_item.lnum)
|
||||||
@ -1121,7 +1121,7 @@ function! s:set_new_mrkr(item, new_mrkr) "{{{
|
|||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! vimwiki#lst#change_marker(from_line, to_line, new_mrkr, mode) "{{{
|
function! vimwiki#lst#change_marker(from_line, to_line, new_mrkr, mode) "{{{
|
||||||
let cur_col_from_eol = col("$") - (a:mode == "i" ? col("'^") : col('.'))
|
let cur_col_from_eol = col("$") - (a:mode ==# "i" ? col("'^") : col('.'))
|
||||||
let new_mrkr = a:new_mrkr
|
let new_mrkr = a:new_mrkr
|
||||||
let cur_ln = a:from_line
|
let cur_ln = a:from_line
|
||||||
while 1
|
while 1
|
||||||
@ -1138,13 +1138,13 @@ function! vimwiki#lst#change_marker(from_line, to_line, new_mrkr, mode) "{{{
|
|||||||
"use *** if the item above has *** too
|
"use *** if the item above has *** too
|
||||||
let item_above = s:get_prev_list_item(cur_item, 1)
|
let item_above = s:get_prev_list_item(cur_item, 1)
|
||||||
if item_above.type == 1 &&
|
if item_above.type == 1 &&
|
||||||
\ s:first_char(item_above.mrkr) ==s:first_char(new_mrkr)
|
\ s:first_char(item_above.mrkr) ==# s:first_char(new_mrkr)
|
||||||
let new_mrkr = item_above.mrkr
|
let new_mrkr = item_above.mrkr
|
||||||
else
|
else
|
||||||
"use *** if the item below has *** too
|
"use *** if the item below has *** too
|
||||||
let item_below = s:get_next_list_item(cur_item, 1)
|
let item_below = s:get_next_list_item(cur_item, 1)
|
||||||
if item_below.type == 1 &&
|
if item_below.type == 1 &&
|
||||||
\ s:first_char(item_below.mrkr) == s:first_char(new_mrkr)
|
\ s:first_char(item_below.mrkr) ==# s:first_char(new_mrkr)
|
||||||
let new_mrkr = item_below.mrkr
|
let new_mrkr = item_below.mrkr
|
||||||
else
|
else
|
||||||
"if the old is ### and the new is * use ***
|
"if the old is ### and the new is * use ***
|
||||||
@ -1155,7 +1155,7 @@ function! vimwiki#lst#change_marker(from_line, to_line, new_mrkr, mode) "{{{
|
|||||||
"use *** if the parent item has **
|
"use *** if the parent item has **
|
||||||
let parent_item = s:get_parent(cur_item)
|
let parent_item = s:get_parent(cur_item)
|
||||||
if parent_item.type == 1 &&
|
if parent_item.type == 1 &&
|
||||||
\ s:first_char(parent_item.mrkr) == s:first_char(new_mrkr)
|
\ s:first_char(parent_item.mrkr) ==# s:first_char(new_mrkr)
|
||||||
let new_mrkr = repeat(s:first_char(parent_item.mrkr),
|
let new_mrkr = repeat(s:first_char(parent_item.mrkr),
|
||||||
\ s:string_length(parent_item.mrkr)+1)
|
\ s:string_length(parent_item.mrkr)+1)
|
||||||
endif
|
endif
|
||||||
@ -1193,7 +1193,7 @@ endfunction "}}}
|
|||||||
|
|
||||||
"sets kind of the item depending on neighbor items and the parent item
|
"sets kind of the item depending on neighbor items and the parent item
|
||||||
function! s:adjust_mrkr(item) "{{{
|
function! s:adjust_mrkr(item) "{{{
|
||||||
if a:item.type == 0 || VimwikiGet('syntax') == 'media'
|
if a:item.type == 0 || VimwikiGet('syntax') ==? 'media'
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -1208,7 +1208,7 @@ function! s:adjust_mrkr(item) "{{{
|
|||||||
\ index(s:multiple_bullet_chars, s:first_char(a:item.mrkr)) > -1
|
\ index(s:multiple_bullet_chars, s:first_char(a:item.mrkr)) > -1
|
||||||
let parent_item = s:get_parent(a:item)
|
let parent_item = s:get_parent(a:item)
|
||||||
if parent_item.type == 1 &&
|
if parent_item.type == 1 &&
|
||||||
\ s:first_char(parent_item.mrkr) == s:first_char(a:item.mrkr)
|
\ s:first_char(parent_item.mrkr) ==# s:first_char(a:item.mrkr)
|
||||||
let new_mrkr = repeat(s:first_char(parent_item.mrkr),
|
let new_mrkr = repeat(s:first_char(parent_item.mrkr),
|
||||||
\ s:string_length(parent_item.mrkr)+1)
|
\ s:string_length(parent_item.mrkr)+1)
|
||||||
endif
|
endif
|
||||||
|
@ -81,11 +81,11 @@ function! vimwiki#markdown_base#follow_link(split, ...) "{{{ Parse link at curso
|
|||||||
" XXX: @Maxim: most likely! I am still working on a seemless way to
|
" XXX: @Maxim: most likely! I am still working on a seemless way to
|
||||||
" integrate regexp's without complicating syntax/vimwiki.vim
|
" integrate regexp's without complicating syntax/vimwiki.vim
|
||||||
else
|
else
|
||||||
if a:split == "split"
|
if a:split ==# "split"
|
||||||
let cmd = ":split "
|
let cmd = ":split "
|
||||||
elseif a:split == "vsplit"
|
elseif a:split ==# "vsplit"
|
||||||
let cmd = ":vsplit "
|
let cmd = ":vsplit "
|
||||||
elseif a:split == "tabnew"
|
elseif a:split ==# "tabnew"
|
||||||
let cmd = ":tabnew "
|
let cmd = ":tabnew "
|
||||||
else
|
else
|
||||||
let cmd = ":e "
|
let cmd = ":e "
|
||||||
|
@ -17,7 +17,7 @@ if vimwiki#u#is_windows()
|
|||||||
endfunction
|
endfunction
|
||||||
else
|
else
|
||||||
function! vimwiki#path#is_equal(p1, p2)
|
function! vimwiki#path#is_equal(p1, p2)
|
||||||
return a:p1 == a:p2
|
return a:p1 ==# a:p2
|
||||||
endfunction
|
endfunction
|
||||||
endif "}}}
|
endif "}}}
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ function! vimwiki#path#normalize(path) "{{{
|
|||||||
let path = a:path
|
let path = a:path
|
||||||
while 1
|
while 1
|
||||||
let result = substitute(path, '/[^/]\+/\.\.', '', '')
|
let result = substitute(path, '/[^/]\+/\.\.', '', '')
|
||||||
if result == path
|
if result ==# path
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
let path = result
|
let path = result
|
||||||
|
@ -134,11 +134,11 @@ function! vimwiki#tbl#get_cells(line) "{{{
|
|||||||
for idx in range(strlen(a:line))
|
for idx in range(strlen(a:line))
|
||||||
" The only way I know Vim can do Unicode...
|
" The only way I know Vim can do Unicode...
|
||||||
let ch = a:line[idx]
|
let ch = a:line[idx]
|
||||||
if state == 'NONE'
|
if state ==# 'NONE'
|
||||||
if ch == '|'
|
if ch == '|'
|
||||||
let state = 'CELL'
|
let state = 'CELL'
|
||||||
endif
|
endif
|
||||||
elseif state == 'CELL'
|
elseif state ==# 'CELL'
|
||||||
if ch == '[' || ch == '{'
|
if ch == '[' || ch == '{'
|
||||||
let state = 'BEFORE_QUOTE_START'
|
let state = 'BEFORE_QUOTE_START'
|
||||||
let quote = ch
|
let quote = ch
|
||||||
@ -148,7 +148,7 @@ function! vimwiki#tbl#get_cells(line) "{{{
|
|||||||
else
|
else
|
||||||
let cell .= ch
|
let cell .= ch
|
||||||
endif
|
endif
|
||||||
elseif state == 'BEFORE_QUOTE_START'
|
elseif state ==# 'BEFORE_QUOTE_START'
|
||||||
if ch == '[' || ch == '{'
|
if ch == '[' || ch == '{'
|
||||||
let state = 'QUOTE'
|
let state = 'QUOTE'
|
||||||
let quote .= ch
|
let quote .= ch
|
||||||
@ -157,12 +157,12 @@ function! vimwiki#tbl#get_cells(line) "{{{
|
|||||||
let cell .= quote.ch
|
let cell .= quote.ch
|
||||||
let quote = ''
|
let quote = ''
|
||||||
endif
|
endif
|
||||||
elseif state == 'QUOTE'
|
elseif state ==# 'QUOTE'
|
||||||
if ch == ']' || ch == '}'
|
if ch == ']' || ch == '}'
|
||||||
let state = 'BEFORE_QUOTE_END'
|
let state = 'BEFORE_QUOTE_END'
|
||||||
endif
|
endif
|
||||||
let quote .= ch
|
let quote .= ch
|
||||||
elseif state == 'BEFORE_QUOTE_END'
|
elseif state ==# 'BEFORE_QUOTE_END'
|
||||||
if ch == ']' || ch == '}'
|
if ch == ']' || ch == '}'
|
||||||
let state = 'CELL'
|
let state = 'CELL'
|
||||||
endif
|
endif
|
||||||
@ -495,7 +495,7 @@ function! vimwiki#tbl#kbd_shift_tab() "{{{
|
|||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! vimwiki#tbl#format(lnum, ...) "{{{
|
function! vimwiki#tbl#format(lnum, ...) "{{{
|
||||||
if !(&filetype == 'vimwiki')
|
if !(&filetype ==? 'vimwiki')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let line = getline(a:lnum)
|
let line = getline(a:lnum)
|
||||||
@ -570,7 +570,7 @@ function! vimwiki#tbl#align_or_cmd(cmd) "{{{
|
|||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! vimwiki#tbl#reset_tw(lnum) "{{{
|
function! vimwiki#tbl#reset_tw(lnum) "{{{
|
||||||
if !(&filetype == 'vimwiki')
|
if !(&filetype ==? 'vimwiki')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let line = getline(a:lnum)
|
let line = getline(a:lnum)
|
||||||
|
@ -43,7 +43,7 @@ function! Complete_wikifiles(findstart, base)
|
|||||||
if startoflink != -1
|
if startoflink != -1
|
||||||
return startoflink
|
return startoflink
|
||||||
endif
|
endif
|
||||||
if VimwikiGet('syntax') == 'markdown'
|
if VimwikiGet('syntax') ==? 'markdown'
|
||||||
let startofinlinelink = match(line, '\[.*\](\zs.*$')
|
let startofinlinelink = match(line, '\[.*\](\zs.*$')
|
||||||
if startofinlinelink != -1
|
if startofinlinelink != -1
|
||||||
return startofinlinelink
|
return startofinlinelink
|
||||||
@ -84,7 +84,7 @@ function! Complete_wikifiles(findstart, base)
|
|||||||
" we look for anchors in the given wikifile
|
" we look for anchors in the given wikifile
|
||||||
|
|
||||||
let segments = split(a:base, '#', 1)
|
let segments = split(a:base, '#', 1)
|
||||||
let given_wikifile = segments[0]=='' ? expand('%:t:r') : segments[0]
|
let given_wikifile = segments[0] == '' ? expand('%:t:r') : segments[0]
|
||||||
let link_infos = vimwiki#base#resolve_scheme(given_wikifile.'#', 0, 1)
|
let link_infos = vimwiki#base#resolve_scheme(given_wikifile.'#', 0, 1)
|
||||||
let wikifile = link_infos[6]
|
let wikifile = link_infos[6]
|
||||||
let syntax = VimwikiGet('syntax', link_infos[0])
|
let syntax = VimwikiGet('syntax', link_infos[0])
|
||||||
|
@ -39,7 +39,8 @@ function! s:find_wiki(path) "{{{
|
|||||||
while idx < len(g:vimwiki_list)
|
while idx < len(g:vimwiki_list)
|
||||||
let idx_path = expand(VimwikiGet('path', idx))
|
let idx_path = expand(VimwikiGet('path', idx))
|
||||||
let idx_path = vimwiki#path#path_norm(vimwiki#path#chomp_slash(idx_path))
|
let idx_path = vimwiki#path#path_norm(vimwiki#path#chomp_slash(idx_path))
|
||||||
if vimwiki#path#path_common_pfx(idx_path, path) == idx_path
|
if vimwiki#path#is_equal(
|
||||||
|
\ vimwiki#path#path_common_pfx(idx_path, path), idx_path)
|
||||||
return idx
|
return idx
|
||||||
endif
|
endif
|
||||||
let idx += 1
|
let idx += 1
|
||||||
@ -88,14 +89,14 @@ function! s:vimwiki_idx() " {{{
|
|||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
function! s:setup_buffer_leave() "{{{
|
function! s:setup_buffer_leave() "{{{
|
||||||
if g:vimwiki_debug ==3
|
if g:vimwiki_debug == 3
|
||||||
echom "Setup_buffer_leave g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
|
echom "Setup_buffer_leave g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
|
||||||
endif
|
endif
|
||||||
if &filetype == 'vimwiki'
|
if &filetype ==? 'vimwiki'
|
||||||
" cache global vars of current state XXX: SLOW!?
|
" cache global vars of current state XXX: SLOW!?
|
||||||
call vimwiki#base#cache_buffer_state()
|
call vimwiki#base#cache_buffer_state()
|
||||||
endif
|
endif
|
||||||
if g:vimwiki_debug ==3
|
if g:vimwiki_debug == 3
|
||||||
echom " Setup_buffer_leave g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
|
echom " Setup_buffer_leave g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -108,7 +109,7 @@ function! s:setup_buffer_leave() "{{{
|
|||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! s:setup_filetype() "{{{
|
function! s:setup_filetype() "{{{
|
||||||
if g:vimwiki_debug ==3
|
if g:vimwiki_debug == 3
|
||||||
echom "Setup_filetype g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
|
echom "Setup_filetype g:curr_idx=".g:vimwiki_current_idx." b:curr_idx=".s:vimwiki_idx().""
|
||||||
endif
|
endif
|
||||||
let time0 = reltime() " start the clock "XXX
|
let time0 = reltime() " start the clock "XXX
|
||||||
@ -116,7 +117,7 @@ function! s:setup_filetype() "{{{
|
|||||||
let path = expand('%:p:h')
|
let path = expand('%:p:h')
|
||||||
" XXX: find_wiki() does not (yet) take into consideration the ext
|
" XXX: find_wiki() does not (yet) take into consideration the ext
|
||||||
let idx = s:find_wiki(path)
|
let idx = s:find_wiki(path)
|
||||||
if g:vimwiki_debug ==3
|
if g:vimwiki_debug == 3
|
||||||
echom " Setup_filetype g:curr_idx=".g:vimwiki_current_idx." find_idx=".idx." b:curr_idx=".s:vimwiki_idx().""
|
echom " Setup_filetype g:curr_idx=".g:vimwiki_current_idx." find_idx=".idx." b:curr_idx=".s:vimwiki_idx().""
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -210,7 +211,7 @@ function! s:setup_buffer_enter() "{{{
|
|||||||
if g:vimwiki_debug ==3
|
if g:vimwiki_debug ==3
|
||||||
echom " Setup_buffer_enter g:curr_idx=".g:vimwiki_current_idx." (set ft vimwiki) b:curr_idx=".s:vimwiki_idx().""
|
echom " Setup_buffer_enter g:curr_idx=".g:vimwiki_current_idx." (set ft vimwiki) b:curr_idx=".s:vimwiki_idx().""
|
||||||
endif
|
endif
|
||||||
elseif &syntax == 'vimwiki'
|
elseif &syntax ==? 'vimwiki'
|
||||||
" to force a rescan of the filesystem which may have changed
|
" to force a rescan of the filesystem which may have changed
|
||||||
" and update VimwikiLinks syntax group that depends on it;
|
" and update VimwikiLinks syntax group that depends on it;
|
||||||
" b:vimwiki_fs_rescan indicates that setup_filetype() has not been run
|
" b:vimwiki_fs_rescan indicates that setup_filetype() has not been run
|
||||||
@ -227,15 +228,15 @@ function! s:setup_buffer_enter() "{{{
|
|||||||
" Settings foldmethod, foldexpr and foldtext are local to window. Thus in a
|
" Settings foldmethod, foldexpr and foldtext are local to window. Thus in a
|
||||||
" new tab with the same buffer folding is reset to vim defaults. So we
|
" new tab with the same buffer folding is reset to vim defaults. So we
|
||||||
" insist vimwiki folding here.
|
" insist vimwiki folding here.
|
||||||
if g:vimwiki_folding == 'expr'
|
if g:vimwiki_folding ==? 'expr'
|
||||||
setlocal fdm=expr
|
setlocal fdm=expr
|
||||||
setlocal foldexpr=VimwikiFoldLevel(v:lnum)
|
setlocal foldexpr=VimwikiFoldLevel(v:lnum)
|
||||||
setlocal foldtext=VimwikiFoldText()
|
setlocal foldtext=VimwikiFoldText()
|
||||||
elseif g:vimwiki_folding == 'list' || g:vimwiki_folding == 'lists'
|
elseif g:vimwiki_folding ==? 'list' || g:vimwiki_folding ==? 'lists'
|
||||||
setlocal fdm=expr
|
setlocal fdm=expr
|
||||||
setlocal foldexpr=VimwikiFoldListLevel(v:lnum)
|
setlocal foldexpr=VimwikiFoldListLevel(v:lnum)
|
||||||
setlocal foldtext=VimwikiFoldText()
|
setlocal foldtext=VimwikiFoldText()
|
||||||
elseif g:vimwiki_folding == 'syntax'
|
elseif g:vimwiki_folding ==? 'syntax'
|
||||||
setlocal fdm=syntax
|
setlocal fdm=syntax
|
||||||
setlocal foldtext=VimwikiFoldText()
|
setlocal foldtext=VimwikiFoldText()
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user