Also CC’ed maintainer.
Please review the patch: I am not writing cobol, just mentioned the problem
while discussing issue 98: http://code.google.com/p/vim/issues/detail?id=98.
It is also definitely not the only plugin that has problems with &sw: I get
invalid indentation in nearly all ftplugins once I set &shiftwidth to zero and
&softtabstop to -1.
--- /usr/share/vim/vim74/ftplugin/cobol.vim 2013-10-20 15:53:41.000000000
+0400
+++ /tmp/cobol.vim 2013-10-20 18:42:22.968395989 +0400
@@ -113,7 +113,7 @@
function! s:increase(...)
let lnum = '.'
- let sw = &shiftwidth
+ let sw = shiftwidth()
let i = a:0 ? a:1 : indent(lnum)
if i >= 11
return sw - (i - 11) % sw
@@ -128,7 +128,7 @@
function! s:decrease(...)
let lnum = '.'
- let sw = &shiftwidth
+ let sw = shiftwidth()
let i = indent(a:0 ? a:1 : lnum)
if i >= 11 + sw
return 1 + (i + 12) % sw
@@ -147,7 +147,7 @@
let head = strpart(getline('.'),0,7)
let tail = strpart(getline('.'),7)
let indent = match(tail,'[^ ]')
- let sw = &shiftwidth
+ let sw = shiftwidth()
let shift = a:shift
if shift > 0
if indent < 4
@@ -221,7 +221,8 @@
function! s:Tab()
if (strpart(getline('.'),0,col('.')-1) =~ '^\s*$' && &sta)
return s:IncreaseIndent()
- elseif &sts == &sw && &sts != 8 && &et
+ " &softtabstop < 0: &softtabstop follows &shiftwidth
+ elseif (&sts < 0 || &sts == shiftwidth()) && &sts != 8 && &et
return s:repeat(" ",s:increase(col('.')-1))
else
return "\<Tab>"
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
*** /usr/share/vim/vim74/ftplugin/cobol.vim 2013-10-20 15:53:41.000000000 +0400
--- /tmp/cobol.vim 2013-10-20 18:42:22.968395989 +0400
***************
*** 113,119 ****
function! s:increase(...)
let lnum = '.'
! let sw = &shiftwidth
let i = a:0 ? a:1 : indent(lnum)
if i >= 11
return sw - (i - 11) % sw
--- 113,119 ----
function! s:increase(...)
let lnum = '.'
! let sw = shiftwidth()
let i = a:0 ? a:1 : indent(lnum)
if i >= 11
return sw - (i - 11) % sw
***************
*** 128,134 ****
function! s:decrease(...)
let lnum = '.'
! let sw = &shiftwidth
let i = indent(a:0 ? a:1 : lnum)
if i >= 11 + sw
return 1 + (i + 12) % sw
--- 128,134 ----
function! s:decrease(...)
let lnum = '.'
! let sw = shiftwidth()
let i = indent(a:0 ? a:1 : lnum)
if i >= 11 + sw
return 1 + (i + 12) % sw
***************
*** 147,153 ****
let head = strpart(getline('.'),0,7)
let tail = strpart(getline('.'),7)
let indent = match(tail,'[^ ]')
! let sw = &shiftwidth
let shift = a:shift
if shift > 0
if indent < 4
--- 147,153 ----
let head = strpart(getline('.'),0,7)
let tail = strpart(getline('.'),7)
let indent = match(tail,'[^ ]')
! let sw = shiftwidth()
let shift = a:shift
if shift > 0
if indent < 4
***************
*** 221,227 ****
function! s:Tab()
if (strpart(getline('.'),0,col('.')-1) =~ '^\s*$' && &sta)
return s:IncreaseIndent()
! elseif &sts == &sw && &sts != 8 && &et
return s:repeat(" ",s:increase(col('.')-1))
else
return "\<Tab>"
--- 221,228 ----
function! s:Tab()
if (strpart(getline('.'),0,col('.')-1) =~ '^\s*$' && &sta)
return s:IncreaseIndent()
! " &softtabstop < 0: &softtabstop follows &shiftwidth
! elseif (&sts < 0 || &sts == shiftwidth()) && &sts != 8 && &et
return s:repeat(" ",s:increase(col('.')-1))
else
return "\<Tab>"