On Friday, October 5, 2012 10:58:23 AM UTC-5, Ben Fritz wrote:
> On Friday, October 5, 2012 10:36:20 AM UTC-5, So8res wrote:
>
> > 1. Add a function that returns the indent level that the user desires.
> > (Basically exposes get_sw_value() to the user.)*
>
> >
>
> >
>
> >
>
> > 2. Modify the existing ftplugins to use indent() instead of &shiftwidth.
> > Should be pretty easy with awk, s/(&(?:sw|shiftwidth))/indent()/.
>
> >
>
> >
>
> >
>
> > 3. Post a patch.
>
> >
>
> >
>
> >
>
> > * We can either modify the indent() function to return the shift unit when
> > given no params (patch below) or create a new function (shiftwidth()?).
> > Thoughts?
>
> >
>
> >
>
> >
>
> > Attached is a patch that implements the first option. I've done cursory
> > tests but obviously not conclusive ones for all indent file changes. Should
> > be pretty easy to implement a different option, for those who care a quick
> > perl script to fix things up is:
>
> >
>
> >
>
> >
>
> > ยป find runtime/ -type f | xargs perl -pi -e
> > 's/(&(sw|shiftwidth))/<FUNCTION_NAME>()/g'
>
> >
>
> >
>
> >
>
> > (Is there a way to access the value of &sw without using the & sign? If not
> > then this should be a pretty surefire way to fix things.)
>
> >
>
>
>
> getbufvar, getwinvar, gettabwinvar functions can be used, and those will use
> the & sign, but replacing it in this case would cause the script to break.
>
>
>
> Also some scripts might use &sw to SET the value (unlikely in the official
> runtime but possible).
>
>
>
> So you'll need to review your changes before submitting them.
For example, this hunk is wrong from eval.txt in your patch:
@@ -3754,9 +3756,9 @@
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)
+ :let n = inputdialog("value for shiftwidth", indent())
:if n != ""
- : let &sw = n
+ : let indent() = n
:endif
< When the dialog is cancelled {cancelreturn} is returned. When
omitted an empty string is returned.
--
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