Patch 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)
Files:      runtime/doc/eval.txt, src/eval.c


*** ../vim-7.3.693/runtime/doc/eval.txt 2012-06-29 12:54:32.000000000 +0200
--- runtime/doc/eval.txt        2012-10-21 00:43:22.000000000 +0200
***************
*** 1921,1926 ****
--- 1932,1938 ----
  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}
***************
*** 3732,3741 ****
                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
  <             When the dialog is cancelled {cancelreturn} is returned.  When
                omitted an empty string is returned.
                Hitting <Enter> works like pressing the OK button.  Hitting
--- 3755,3764 ----
                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", 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
***************
*** 5308,5313 ****
--- 5332,5354 ----
                    :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
*** ../vim-7.3.693/src/eval.c   2012-08-08 14:33:16.000000000 +0200
--- src/eval.c  2012-10-21 00:29:15.000000000 +0200
***************
*** 687,692 ****
--- 687,693 ----
  static void f_settabwinvar __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_setwinvar __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_shellescape __ARGS((typval_T *argvars, typval_T *rettv));
+ static void f_shiftwidth __ARGS((typval_T *argvars, typval_T *rettv));
  static void f_simplify __ARGS((typval_T *argvars, typval_T *rettv));
  #ifdef FEAT_FLOAT
  static void f_sin __ARGS((typval_T *argvars, typval_T *rettv));
***************
*** 8051,8056 ****
--- 8052,8058 ----
      {"settabwinvar",  4, 4, f_settabwinvar},
      {"setwinvar",     3, 3, f_setwinvar},
      {"shellescape",   1, 2, f_shellescape},
+     {"shiftwidth",    0, 0, f_shiftwidth},
      {"simplify",      1, 1, f_simplify},
  #ifdef FEAT_FLOAT
      {"sin",           1, 1, f_sin},
***************
*** 16652,16657 ****
--- 16654,16670 ----
  }
  
  /*
+  * shiftwidth() function
+  */
+     static void
+ f_shiftwidth(argvars, rettv)
+     typval_T  *argvars;
+     typval_T  *rettv;
+ {
+     rettv->vval.v_number = get_sw_value();
+ }
+ 
+ /*
   * "simplify()" function
   */
      static void
*** ../vim-7.3.693/src/version.c        2012-10-21 00:10:29.000000000 +0200
--- src/version.c       2012-10-21 00:30:27.000000000 +0200
***************
*** 721,722 ****
--- 721,724 ----
  {   /* Add new patch number below this line */
+ /**/
+     694,
  /**/

-- 
CRONE:  Who sent you?
ARTHUR: The Knights Who Say GNU!
CRONE:  Aaaagh!  (she looks around in rear) No!  We have no licenses here.
           "Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
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

Raspunde prin e-mail lui