summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2012-10-21 00:45:18 +0200
committerBram Moolenaar <Bram@vim.org>2012-10-21 00:45:18 +0200
commit2d17fa3ebd378097e3c0feab813a2c60fc9bf474 (patch)
tree1ad99d79e68cbbd6bebdde9a83df835ac9917993 /runtime
parent9f340fa57b91db9c04307c99cd4475f197d7a5c8 (diff)
downloadvim-git-2d17fa3ebd378097e3c0feab813a2c60fc9bf474.tar.gz
updated for version 7.3.694v7.3.694
Problem: Now that 'shiftwidth' may use the value of 'tabstop' it is not so easy to use in indent files. Solution: Add the shiftwidth() function. (so8res)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt26
1 files changed, 22 insertions, 4 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 12ea9c897..8934215eb 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1932,6 +1932,7 @@ setwinvar( {nr}, {varname}, {val}) set {varname} in window {nr} to {val}
shellescape( {string} [, {special}])
String escape {string} for use as shell
command argument
+shiftwidth() 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}
@@ -3754,10 +3755,10 @@ inputdialog({prompt} [, {text} [, {cancelreturn}]]) *inputdialog()*
Like |input()|, but when the GUI is running and text dialogs
are supported, a dialog window pops up to input the text.
Example: >
- :let n = inputdialog("value for shiftwidth", &sw)
- :if n != ""
- : let &sw = n
- :endif
+ :let n = inputdialog("value for shiftwidth", shiftwidth())
+ :if n != ""
+ : let &sw = n
+ :endif
< When the dialog is cancelled {cancelreturn} is returned. When
omitted an empty string is returned.
Hitting <Enter> works like pressing the OK button. Hitting
@@ -5331,6 +5332,23 @@ shellescape({string} [, {special}]) *shellescape()*
:call system("chmod +w -- " . shellescape(expand("%")))
+shiftwidth() *shiftwidth()*
+ Returns the effective value of 'shiftwidth'. This is the
+ 'shiftwidth' value unless it is zero, in which case it is the
+ 'tabstop' value. To be backwards compatible in indent
+ plugins, use this: >
+ if exists('*shiftwidth')
+ func s:sw()
+ return shiftwidth()
+ endfunc
+ else
+ func s:sw()
+ return &sw
+ endfunc
+ endif
+< And then use s:sw() instead of &sw.
+
+
simplify({filename}) *simplify()*
Simplify the file name as much as possible without changing
the meaning. Shortcuts (on MS-Windows) or symbolic links (on