Use shiftwidth() instead of &shiftwidth

Using &shiftwidth makes VimwikiListChangeLvl misbehave when this option is set
to 0, which is a default configuration of [DetectIndent](https://github.com/roryokane/detectindent).
This commit is contained in:
mMontu 2015-01-08 11:20:34 -02:00
parent 2804a4495d
commit b89c22fe03
2 changed files with 5 additions and 5 deletions

View File

@ -1725,7 +1725,7 @@ function! vimwiki#base#table_of_contents(create)
\ '__Header__', '\='."'".g:vimwiki_toc_header."'", ''))
let startindent = repeat(' ', vimwiki#lst#get_list_margin())
let indentstring = repeat(' ', &shiftwidth)
let indentstring = repeat(' ', shiftwidth())
for [lvl, link, desc] in headers
let esc_link = substitute(link, "'", "''", 'g')
let esc_desc = substitute(desc, "'", "''", 'g')

View File

@ -932,9 +932,9 @@ function! s:decrease_level(item) "{{{
else
let old_indent = indent(a:item.lnum)
if &shiftround
let new_indent = (old_indent - 1) / &shiftwidth * &shiftwidth
let new_indent = (old_indent - 1) / shiftwidth() * shiftwidth()
else
let new_indent = old_indent - &shiftwidth
let new_indent = old_indent - shiftwidth()
endif
call s:set_indent(a:item.lnum, new_indent)
let removed_indent = new_indent - old_indent
@ -952,9 +952,9 @@ function! s:increase_level(item) "{{{
else
let old_indent = indent(a:item.lnum)
if &shiftround
let new_indent = (old_indent / &shiftwidth + 1) * &shiftwidth
let new_indent = (old_indent / shiftwidth() + 1) * shiftwidth()
else
let new_indent = old_indent + &shiftwidth
let new_indent = old_indent + shiftwidth()
endif
call s:set_indent(a:item.lnum, new_indent)
let additional_indent = new_indent - old_indent