comparison runtime/doc/eval.txt @ 3875:8235ccf121bb v7.3.694

updated for version 7.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)
author Bram Moolenaar <bram@vim.org>
date Sun, 21 Oct 2012 00:45:18 +0200
parents 04592728474a
children c3036f1dca68
comparison
equal deleted inserted replaced
3874:f2ad0caaea4f 3875:8235ccf121bb
1930 {winnr} in tab page {tabnr} to {val} 1930 {winnr} in tab page {tabnr} to {val}
1931 setwinvar( {nr}, {varname}, {val}) set {varname} in window {nr} to {val} 1931 setwinvar( {nr}, {varname}, {val}) set {varname} in window {nr} to {val}
1932 shellescape( {string} [, {special}]) 1932 shellescape( {string} [, {special}])
1933 String escape {string} for use as shell 1933 String escape {string} for use as shell
1934 command argument 1934 command argument
1935 shiftwidth() Number effective value of 'shiftwidth'
1935 simplify( {filename}) String simplify filename as much as possible 1936 simplify( {filename}) String simplify filename as much as possible
1936 sin( {expr}) Float sine of {expr} 1937 sin( {expr}) Float sine of {expr}
1937 sinh( {expr}) Float hyperbolic sine of {expr} 1938 sinh( {expr}) Float hyperbolic sine of {expr}
1938 sort( {list} [, {func} [, {dict}]]) 1939 sort( {list} [, {func} [, {dict}]])
1939 List sort {list}, using {func} to compare 1940 List sort {list}, using {func} to compare
3752 3753
3753 inputdialog({prompt} [, {text} [, {cancelreturn}]]) *inputdialog()* 3754 inputdialog({prompt} [, {text} [, {cancelreturn}]]) *inputdialog()*
3754 Like |input()|, but when the GUI is running and text dialogs 3755 Like |input()|, but when the GUI is running and text dialogs
3755 are supported, a dialog window pops up to input the text. 3756 are supported, a dialog window pops up to input the text.
3756 Example: > 3757 Example: >
3757 :let n = inputdialog("value for shiftwidth", &sw) 3758 :let n = inputdialog("value for shiftwidth", shiftwidth())
3758 :if n != "" 3759 :if n != ""
3759 : let &sw = n 3760 : let &sw = n
3760 :endif 3761 :endif
3761 < When the dialog is cancelled {cancelreturn} is returned. When 3762 < When the dialog is cancelled {cancelreturn} is returned. When
3762 omitted an empty string is returned. 3763 omitted an empty string is returned.
3763 Hitting <Enter> works like pressing the OK button. Hitting 3764 Hitting <Enter> works like pressing the OK button. Hitting
3764 <Esc> works like pressing the Cancel button. 3765 <Esc> works like pressing the Cancel button.
3765 NOTE: Command-line completion is not supported. 3766 NOTE: Command-line completion is not supported.
5327 Example of use with a |:!| command: > 5328 Example of use with a |:!| command: >
5328 :exe '!dir ' . shellescape(expand('<cfile>'), 1) 5329 :exe '!dir ' . shellescape(expand('<cfile>'), 1)
5329 < This results in a directory listing for the file under the 5330 < This results in a directory listing for the file under the
5330 cursor. Example of use with |system()|: > 5331 cursor. Example of use with |system()|: >
5331 :call system("chmod +w -- " . shellescape(expand("%"))) 5332 :call system("chmod +w -- " . shellescape(expand("%")))
5333
5334
5335 shiftwidth() *shiftwidth()*
5336 Returns the effective value of 'shiftwidth'. This is the
5337 'shiftwidth' value unless it is zero, in which case it is the
5338 'tabstop' value. To be backwards compatible in indent
5339 plugins, use this: >
5340 if exists('*shiftwidth')
5341 func s:sw()
5342 return shiftwidth()
5343 endfunc
5344 else
5345 func s:sw()
5346 return &sw
5347 endfunc
5348 endif
5349 < And then use s:sw() instead of &sw.
5332 5350
5333 5351
5334 simplify({filename}) *simplify()* 5352 simplify({filename}) *simplify()*
5335 Simplify the file name as much as possible without changing 5353 Simplify the file name as much as possible without changing
5336 the meaning. Shortcuts (on MS-Windows) or symbolic links (on 5354 the meaning. Shortcuts (on MS-Windows) or symbolic links (on