Use backward compatible version of shiftwidth()
This commit is contained in:
parent
b89c22fe03
commit
edb72680a1
@ -1725,7 +1725,7 @@ function! vimwiki#base#table_of_contents(create)
|
|||||||
\ '__Header__', '\='."'".g:vimwiki_toc_header."'", ''))
|
\ '__Header__', '\='."'".g:vimwiki_toc_header."'", ''))
|
||||||
|
|
||||||
let startindent = repeat(' ', vimwiki#lst#get_list_margin())
|
let startindent = repeat(' ', vimwiki#lst#get_list_margin())
|
||||||
let indentstring = repeat(' ', shiftwidth())
|
let indentstring = repeat(' ', vimwiki#u#sw())
|
||||||
for [lvl, link, desc] in headers
|
for [lvl, link, desc] in headers
|
||||||
let esc_link = substitute(link, "'", "''", 'g')
|
let esc_link = substitute(link, "'", "''", 'g')
|
||||||
let esc_desc = substitute(desc, "'", "''", 'g')
|
let esc_desc = substitute(desc, "'", "''", 'g')
|
||||||
|
@ -932,9 +932,9 @@ function! s:decrease_level(item) "{{{
|
|||||||
else
|
else
|
||||||
let old_indent = indent(a:item.lnum)
|
let old_indent = indent(a:item.lnum)
|
||||||
if &shiftround
|
if &shiftround
|
||||||
let new_indent = (old_indent - 1) / shiftwidth() * shiftwidth()
|
let new_indent = (old_indent - 1) / vimwiki#u#sw() * vimwiki#u#sw()
|
||||||
else
|
else
|
||||||
let new_indent = old_indent - shiftwidth()
|
let new_indent = old_indent - vimwiki#u#sw()
|
||||||
endif
|
endif
|
||||||
call s:set_indent(a:item.lnum, new_indent)
|
call s:set_indent(a:item.lnum, new_indent)
|
||||||
let removed_indent = new_indent - old_indent
|
let removed_indent = new_indent - old_indent
|
||||||
@ -952,9 +952,9 @@ function! s:increase_level(item) "{{{
|
|||||||
else
|
else
|
||||||
let old_indent = indent(a:item.lnum)
|
let old_indent = indent(a:item.lnum)
|
||||||
if &shiftround
|
if &shiftround
|
||||||
let new_indent = (old_indent / shiftwidth() + 1) * shiftwidth()
|
let new_indent = (old_indent / vimwiki#u#sw() + 1) * vimwiki#u#sw()
|
||||||
else
|
else
|
||||||
let new_indent = old_indent + shiftwidth()
|
let new_indent = old_indent + vimwiki#u#sw()
|
||||||
endif
|
endif
|
||||||
call s:set_indent(a:item.lnum, new_indent)
|
call s:set_indent(a:item.lnum, new_indent)
|
||||||
let additional_indent = new_indent - old_indent
|
let additional_indent = new_indent - old_indent
|
||||||
|
@ -52,3 +52,14 @@ endfunction "}}}
|
|||||||
function vimwiki#u#reload_regexes_custom() "{{{
|
function vimwiki#u#reload_regexes_custom() "{{{
|
||||||
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'_custom.vim'
|
execute 'runtime! syntax/vimwiki_'.VimwikiGet('syntax').'_custom.vim'
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
|
" Backward compatible version of the built-in function shiftwidth()
|
||||||
|
if exists('*shiftwidth') "{{{
|
||||||
|
func vimwiki#u#sw()
|
||||||
|
return shiftwidth()
|
||||||
|
endfunc
|
||||||
|
else
|
||||||
|
func vimwiki#u#sw()
|
||||||
|
return &sw
|
||||||
|
endfunc
|
||||||
|
endif "}}}
|
||||||
|
Loading…
Reference in New Issue
Block a user