How do I control the indentation in shell scripts when using the filetype indent plugin?
I have consulted Vim's documentation and found the section on ft-sh-indent to be confusing. The documenation found on the Web is the same as what I have locally.
I have tried setting the documented values in '~/.vim/after/indent/sh.vim' as well as setting values manually with a shell file loaded. Both result in undefined variable error when trying to set dictionary keys.
I have looked in '/usr/share/vim/vim72/indent/sh.vim' and have not found any references to the variables documented.
I am running Vim 7.2 on Ubuntu 9.04 and have filetype detection, plugin, and indent enabled.
> How do I control the indentation in shell scripts when using the > filetype indent plugin?
> I have consulted Vim's documentation and found the section on > ft-sh-indent to be confusing. The documenation found on the Web is the > same as what I have locally.
> I have tried setting the documented values in > '~/.vim/after/indent/sh.vim' as well as setting values manually with > a shell file loaded. Both result in undefined variable error when > trying to set dictionary keys.
> I have looked in '/usr/share/vim/vim72/indent/sh.vim' and have not found > any references to the variables documented.
> I am running Vim 7.2 on Ubuntu 9.04 and have filetype detection, plugin, > and indent enabled.
What aspect of the indentation are you trying to control? What variables are you trying to set, how exactly are you trying to set them, and what exactly happens when you try?
* Gary Johnson <garyj...@spocom.com> [2009-11-09 09:42 -0800]:
> On 2009-11-09, James Michael Fultz wrote: > > How do I control the indentation in shell scripts when using the > > filetype indent plugin?
> > I have consulted Vim's documentation and found the section on > > ft-sh-indent to be confusing. The documenation found on the Web is the > > same as what I have locally.
Have a look at the documentation. There seems to be conflicting or at least confusing information whether it is b:sh_indent_defaults or b:sh_indent_options.
> What aspect of the indentation are you trying to control? What > variables are you trying to set, how exactly are you trying to set > them, and what exactly happens when you try?
I want to change the indent of case statements. Trying to set any of the documented dictionary keys results in the same error message. For example:
:let b:sh_indent_options['case-labels'] = 0
Results in:
E121: Undefined variable: b:sh_indent_options
Anyway, this may be a wild goose chase since sh_indent_options nor sh_indent_defaults is referenced in none of the installed plugins. As a comparison, look at the documentaton for Python indent.
> How do I control the indentation in shell scripts when using the > filetype indent plugin?
> I have consulted Vim's documentation and found the section on > ft-sh-indent to be confusing. The documenation found on the Web is the > same as what I have locally.
> I have tried setting the documented values in > '~/.vim/after/indent/sh.vim' as well as setting values manually with > a shell file loaded. Both result in undefined variable error when > trying to set dictionary keys.
> I have looked in '/usr/share/vim/vim72/indent/sh.vim' and have not found > any references to the variables documented.
> I am running Vim 7.2 on Ubuntu 9.04 and have filetype detection, plugin, > and indent enabled.
What aspect of the indentation are you trying to control? What variables are you trying to set, how exactly are you trying to set them, and what exactly happens when you try?
> * Gary Johnson <garyj...@spocom.com> [2009-11-09 09:42 -0800]:
> > On 2009-11-09, James Michael Fultz wrote: > > > How do I control the indentation in shell scripts when using the > > > filetype indent plugin?
> > > I have consulted Vim's documentation and found the section on > > > ft-sh-indent to be confusing. The documenation found on the Web is the > > > same as what I have locally.
> Have a look at the documentation. There seems to be conflicting or at > least confusing information whether it is b:sh_indent_defaults or > b:sh_indent_options.
> > What aspect of the indentation are you trying to control? What > > variables are you trying to set, how exactly are you trying to set > > them, and what exactly happens when you try?
> I want to change the indent of case statements. Trying to set any of > the documented dictionary keys results in the same error message. For > example:
> :let b:sh_indent_options['case-labels'] = 0
> Results in:
> E121: Undefined variable: b:sh_indent_options
> Anyway, this may be a wild goose chase since sh_indent_options nor > sh_indent_defaults is referenced in none of the installed plugins. As > a comparison, look at the documentaton for Python indent.
> The documented variables can be found in the python.vim indent plugin.
OK, I see the problem now. The most recent version of vim I have is 7.2.264 and it still came packaged (for Cygwin) with indent/sh.vim revision 2006-04-19, which uses neither b:sh_indent_defaults nor b:sh_indent_options. The vim-7.2.184 for Windows that I got from the Cream project also has the old indent/sh.vim. Yet, ":help ft-sh-indent" for all the versions of vim I have describe b:sh_indent_options.
The problem is that the latest official release of vim is 7.2 with no patches. It is up to anyone building a patched version to download and apply the patches themselves. The patches, however, do not include any updates to the runtime files, so one has to also download and install the latest runtime files. That apparently wasn't done by the folks distributing the vim packages that you and I have. That, or the new indent/sh.vim didn't make it into the runtime repository.
I've been lax in keeping the vim installations I build myself up to date, so I don't know whether the runtime repository currently has the new indent/sh.vim or not.
There is definitely an error in the current help documentation as well, but I don't know whether the correct name for the dictionary is sh_indent_defaults or sh_indent_options.
To find out how to download the latest runtime files, see
* Gary Johnson <garyj...@spocom.com> [2009-11-09 17:13 -0800]:
> On 2009-11-09, James Michael Fultz wrote:
[changing indent of case statements in shell files and incongruity of documented options for 'indent/sh.vim' plugin]
> OK, I see the problem now. The most recent version of vim I have is > 7.2.264 and it still came packaged (for Cygwin) with indent/sh.vim > revision 2006-04-19, which uses neither b:sh_indent_defaults nor > b:sh_indent_options. The vim-7.2.184 for Windows that I got from > the Cream project also has the old indent/sh.vim. Yet, ":help > ft-sh-indent" for all the versions of vim I have describe > b:sh_indent_options.
Vim 7.2.79 here and same revision of 'indent/sh.vim'.
> The problem is that the latest official release of vim is 7.2 with > no patches. It is up to anyone building a patched version to > download and apply the patches themselves. The patches, however, do > not include any updates to the runtime files, so one has to also > download and install the latest runtime files. That apparently > wasn't done by the folks distributing the vim packages that you and > I have. That, or the new indent/sh.vim didn't make it into the > runtime repository.
Would this be a packaging bug?
> I've been lax in keeping the vim installations I build myself up to > date, so I don't know whether the runtime repository currently has > the new indent/sh.vim or not.
OK, seems the new 'indent/sh.vim' isn't in the runtime repository. It is the same revision I already had installed -- 2006-04-19.
> There is definitely an error in the current help documentation as > well, but I don't know whether the correct name for the dictionary > is sh_indent_defaults or sh_indent_options.
Should I file a bug report on it?
> To find out how to download the latest runtime files, see
> * Gary Johnson <garyj...@spocom.com> [2009-11-09 17:13 -0800]: > > The problem is that the latest official release of vim is 7.2 with > > no patches. It is up to anyone building a patched version to > > download and apply the patches themselves. The patches, however, do > > not include any updates to the runtime files, so one has to also > > download and install the latest runtime files. That apparently > > wasn't done by the folks distributing the vim packages that you and > > I have. That, or the new indent/sh.vim didn't make it into the > > runtime repository.
> Would this be a packaging bug?
It's a bug somewhere. If, as you say below, the runtime repository doesn't contain the version of a plugin that matches the latest documentation, then there will be an error in the package but it won't be the fault of the packager.
> > I've been lax in keeping the vim installations I build myself up to > > date, so I don't know whether the runtime repository currently has > > the new indent/sh.vim or not.
> OK, seems the new 'indent/sh.vim' isn't in the runtime repository. It > is the same revision I already had installed -- 2006-04-19.
> > There is definitely an error in the current help documentation as > > well, but I don't know whether the correct name for the dictionary > > is sh_indent_defaults or sh_indent_options.
On Mon, Nov 9, 2009 at 10:56 PM, Gary Johnson wrote:
> On 2009-11-09, James Michael Fultz wrote: >> * Gary Johnson <garyj...@spocom.com> [2009-11-09 17:13 -0800]:
>> > The problem is that the latest official release of vim is 7.2 with >> > no patches. It is up to anyone building a patched version to >> > download and apply the patches themselves. The patches, however, do >> > not include any updates to the runtime files, so one has to also >> > download and install the latest runtime files. That apparently >> > wasn't done by the folks distributing the vim packages that you and >> > I have. That, or the new indent/sh.vim didn't make it into the >> > runtime repository.
>> Would this be a packaging bug?
> It's a bug somewhere. If, as you say below, the runtime repository > doesn't contain the version of a plugin that matches the latest > documentation, then there will be an error in the package but it > won't be the fault of the packager.
> On Mon, Nov 9, 2009 at 10:56 PM, Gary Johnson wrote:
>> On 2009-11-09, James Michael Fultz wrote:
>>> * Gary Johnson<garyj...@spocom.com> [2009-11-09 17:13 -0800]:
>>>> The problem is that the latest official release of vim is 7.2 with
>>>> no patches. It is up to anyone building a patched version to
>>>> download and apply the patches themselves. The patches, however, do
>>>> not include any updates to the runtime files, so one has to also
>>>> download and install the latest runtime files. That apparently
>>>> wasn't done by the folks distributing the vim packages that you and
>>>> I have. That, or the new indent/sh.vim didn't make it into the
>>>> runtime repository.
>>> Would this be a packaging bug?
>> It's a bug somewhere. If, as you say below, the runtime repository
>> doesn't contain the version of a plugin that matches the latest
>> documentation, then there will be an error in the package but it
>> won't be the fault of the packager.
> Since those are the latest runtime files from FTP in both cases, the
> docs definitely don't match up with the indent script.
> ~Matt
I notice that the current indent/sh.vim (which uses that Dictionary) is dated 2009-11-12, i.e., three days after you posted this. So either the change was "in the queue for the next update" when you posted this, or you triggered the fix.
Best regards,
Tony.
-- Don't abandon hope: your Tom Mix decoder ring arrives tomorrow.
* Tony Mechelynck <antoine.mechely...@gmail.com> [2009-12-04 07:58 +0100]:
[ indent/sh.vim help mismatch ]
> I notice that the current indent/sh.vim (which uses that Dictionary) is > dated 2009-11-12, i.e., three days after you posted this. So either the > change was "in the queue for the next update" when you posted this, or > you triggered the fix.
Yeah, I filed a bug report on it, and Bram and Nikolai got right to work
on it.