From f951416a8396a54bbbe21de1a8b16716428549f2 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 22 Nov 2018 03:08:29 +0100 Subject: patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account Problem: shiftwidth() does not take 'vartabstop' into account. Solution: Use the cursor position or a position explicitly passed. Also make >> and << work better with 'vartabstop'. (Christian Brabandt) --- runtime/doc/change.txt | 8 ++++++++ runtime/doc/eval.txt | 21 +++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index d6b0242d2c..dc3a23c599 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -476,6 +476,10 @@ SHIFTING LINES LEFT OR RIGHT *shift-left-right* *<* <{motion} Shift {motion} lines one 'shiftwidth' leftwards. + If the 'vartabstop' feature is enabled, and the + 'shiftwidth' option is set to zero, the amount of + indent is calculated at the first non-blank character + in the line. *<<* << Shift [count] lines one 'shiftwidth' leftwards. @@ -487,6 +491,10 @@ SHIFTING LINES LEFT OR RIGHT *shift-left-right* *>* >{motion} Shift {motion} lines one 'shiftwidth' rightwards. + If the 'vartabstop' feature is enabled, and the + 'shiftwidth' option is set to zero, the amount of + indent is calculated at the first non-blank character + in the line. *>>* >> Shift [count] lines one 'shiftwidth' rightwards. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 07c88d114c..5e6545cbdd 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2308,7 +2308,6 @@ perleval({expr}) any evaluate |Perl| expression pow({x}, {y}) Float {x} to the power of {y} prevnonblank({lnum}) Number line nr of non-blank line <= {lnum} printf({fmt}, {expr1}...) String format text -prompt_addtext({buf}, {expr}) none add text to a prompt buffer prompt_setcallback({buf}, {expr}) none set prompt callback function prompt_setinterrupt({buf}, {text}) none set prompt interrupt function prompt_setprompt({buf}, {text}) none set prompt text @@ -2386,7 +2385,7 @@ sha256({string}) String SHA256 checksum of {string} shellescape({string} [, {special}]) String escape {string} for use as shell command argument -shiftwidth([{list}]) Number effective value of 'shiftwidth' +shiftwidth([{col}]) Number effective value of 'shiftwidth' simplify({filename}) String simplify filename as much as possible sin({expr}) Float sine of {expr} sinh({expr}) Float hyperbolic sine of {expr} @@ -7639,19 +7638,17 @@ shellescape({string} [, {special}]) *shellescape()* < See also |::S|. -shiftwidth([{list}]) *shiftwidth()* +shiftwidth([{col}]) *shiftwidth()* Returns the effective value of 'shiftwidth'. This is the 'shiftwidth' value unless it is zero, in which case it is the 'tabstop' value. This function was introduced with patch - 7.3.694 in 2012, everybody should have it by now. - - When there is one argument {list} this is used as position - |List| for which to return the 'shiftwidth' value (actually - only the column number is relevant). This matters for the - 'vartabstop' feature. For the {list} arguments see |cursor()| - function. If the 'vartabstop' setting is enabled and no - {list} argument is given, the current cursor position is - taken into account. + 7.3.694 in 2012, everybody should have it by now (however it + did not allow for the optional {col} argument until 8.1.542). + + When there is one argument {col} this is used as column number + for which to return the 'shiftwidth' value. This matters for the + 'vartabstop' feature. If the 'vartabstop' setting is enabled and + no {col} argument is given, column 1 will be assumed. simplify({filename}) *simplify()* -- cgit v1.2.3