cino=(0 not working as expected

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

cino=(0 not working as expected

Bobby Impollonia

Hi. I have
set cino=(0
in my vimrc. I also have cindent enabled. However, the cino setting
does not seem to have any effect. When I start a new line inside
unclosed paranthesis, I get indented 2 * shiftwidth characters instead
of being lined up with the parenthesis. Why would this be?
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cino=(0 not working as expected

Tony Mechelynck

On 11/10/08 17:39, Bobby Impollonia wrote:
> Hi. I have
> set cino=(0
> in my vimrc. I also have cindent enabled. However, the cino setting
> does not seem to have any effect. When I start a new line inside
> unclosed paranthesis, I get indented 2 * shiftwidth characters instead
> of being lined up with the parenthesis. Why would this be?

What is the reply to

        :verbose set cino?

?

Most of the ftplugins for filetypes for which 'cinoptions' is relevant
have a line to set that option.


Best regards,
Tony.
--
Chicken Soup, n.:
        An ancient miracle drug containing equal parts of aureomycin,
cocaine, interferon, and TLC.  The only ailment chicken soup can't cure
is neurotic dependence on one's mother.
                -- Arthur Naiman, "Every Goy's Guide to Yiddish"

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cino=(0 not working as expected

Bobby Impollonia

:verbose set cino?
replies with
  cinoptions=(0
        Last set from ~/.vimrc

That seems right, but it is still not having any effect.

On Oct 12, 10:19 am, Tony Mechelynck <[hidden email]>
wrote:

> On 11/10/08 17:39, Bobby Impollonia wrote:
>
> > Hi. I have
> > set cino=(0
> > in my vimrc. I also have cindent enabled. However, the cino setting
> > does not seem to have any effect. When I start a new line inside
> > unclosed paranthesis, I get indented 2 * shiftwidth characters instead
> > of being lined up with the parenthesis. Why would this be?
>
> What is the reply to
>
>         :verbose set cino?
>
> ?
>
> Most of the ftplugins for filetypes for which 'cinoptions' is relevant
> have a line to set that option.
>
> Best regards,
> Tony.
> --
> Chicken Soup, n.:
>         An ancient miracle drug containing equal parts of aureomycin,
> cocaine, interferon, and TLC.  The only ailment chicken soup can't cure
> is neurotic dependence on one's mother.
>                 -- Arthur Naiman, "Every Goy's Guide to Yiddish"
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cino=(0 not working as expected

Tony Mechelynck

On 13/10/08 15:43, Bobby Impollonia wrote:
> :verbose set cino?
> replies with
>    cinoptions=(0
>          Last set from ~/.vimrc
>
> That seems right, but it is still not having any effect.

You did this while editing the file where you were expecting it to had
an effect, and with that file current (i.e., not only visible but with
the visible cursor in it, etc.), right?


Best regards,
Tony.
--
Virtue is its own punishment.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cino=(0 not working as expected

Bobby Impollonia

On Oct 13, 10:22 am, Tony Mechelynck <[hidden email]>
wrote:

> On 13/10/08 15:43, Bobby Impollonia wrote:
>
> > :verbose set cino?
> > replies with
> >    cinoptions=(0
> >          Last set from ~/.vimrc
>
> > That seems right, but it is still not having any effect.
>
> You did this while editing the file where you were expecting it to had
> an effect, and with that file current (i.e., not only visible but with
> the visible cursor in it, etc.), right?

Yes. I only had one open window with one buffer and that is where the
cursor is.

I think you were right in your earlier comment about this relating to
filetypes.
If I start vim with
vim somefile
where somefile is a new file, my cino setting does seem to be
respected. However, if I do
vim a.py
where a.py is an extant python file, then the setting is not respected
and I get the default behavior of indentation by 2 * shiftwidth.

This is problematic because the reason I want to get this working is
specifically for indenting python code.

In both cases, "verbose set cino?" gives the output indicated above
(and vim also claims cindent is enabled). I can understand that the
python ft settings could set its own values for cinoptions that are
clobbering mine, but then shouldn't  "verbose set cino?" reflect those
settings?
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cino=(0 not working as expected

Tony Mechelynck

On 13/10/08 16:59, Bobby Impollonia wrote:

> On Oct 13, 10:22 am, Tony Mechelynck<[hidden email]>
> wrote:
>> On 13/10/08 15:43, Bobby Impollonia wrote:
>>
>>> :verbose set cino?
>>> replies with
>>>     cinoptions=(0
>>>           Last set from ~/.vimrc
>>> That seems right, but it is still not having any effect.
>> You did this while editing the file where you were expecting it to had
>> an effect, and with that file current (i.e., not only visible but with
>> the visible cursor in it, etc.), right?
>
> Yes. I only had one open window with one buffer and that is where the
> cursor is.
>
> I think you were right in your earlier comment about this relating to
> filetypes.
> If I start vim with
> vim somefile
> where somefile is a new file, my cino setting does seem to be
> respected. However, if I do
> vim a.py
> where a.py is an extant python file, then the setting is not respected
> and I get the default behavior of indentation by 2 * shiftwidth.
>
> This is problematic because the reason I want to get this working is
> specifically for indenting python code.
>
> In both cases, "verbose set cino?" gives the output indicated above
> (and vim also claims cindent is enabled). I can understand that the
> python ft settings could set its own values for cinoptions that are
> clobbering mine, but then shouldn't  "verbose set cino?" reflect those
> settings?

Whell, what does ":verbose set cino" say in a python file? Maybe the
equivalent of $VIMRUNTIME/ftplugin/python.vim ? In that case, you can
override it by placing the line

        setlocal cino=(0

(possibly together with other option parts) in the file
$HOME/vimfiles/after/ftplugin/python.vim (on Windows) or
$HOME/.vim/after/ftplugin/python.vim (on Unix).


Best regards,
Tony.
--
Crash programs fail because they are based on the theory that, with
nine women pregnant, you can get a baby a month.
                -- Wernher von Braun

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: cino=(0 not working as expected

Andy Kittner
On Mon, Oct 13, 2008 at 05:11:44PM +0200, Tony Mechelynck wrote:

> [...]
>Whell, what does ":verbose set cino" say in a python file? Maybe the
>equivalent of $VIMRUNTIME/ftplugin/python.vim ? In that case, you can
>override it by placing the line
>
> setlocal cino=(0
>
>(possibly together with other option parts) in the file
>$HOME/vimfiles/after/ftplugin/python.vim (on Windows) or
>$HOME/.vim/after/ftplugin/python.vim (on Unix).
>
>
>Best regards,
>Tony.
Another possibility:
On my system python.vim sets indentexpr which, according to
:he C-indenting, overrides cindent.

In that case also adding the following to after/ftplugin/python.vim
        setlocal indentexpr=
should help.

--
Don't drink when you drive -- you might hit a bump and spill it.

attachment0 (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: cino=(0 not working as expected

Andy Kittner
On Mon, Oct 13, 2008 at 01:56:55PM -0700, Bobby Impollonia wrote:

>Thanks Andy. It looks like indentexpr taking precedence is the
>problem. Unsetting indentexpr makes the right thing happen when I am
>in unclosed parens.
>
>Unfortunately, losing all the other python indentation behavior is not
>worth it just to get it to do what I want inside parentheses.
>
>I guess my only option is to modify the python.vim indentation file? I
>see the part that does indentation inside of parens
>
I think so, yes. I guess the quick & dirty way would be to copy & paste
the function to the after/ftplugin/python.vim file, adjust it to the way
you like it and set indentexpr to the name of the new file.

As there already are some g_pyindent_foo variables I'd probably add
another option for this behaviour and submit it back so
    a) others may benefit from it
    b) I wouldn't have to keep syncing both versions if the original gets
       improvements.

If you need help with the adjustments, I could probably take a stab at
it tomorrow afternoon, but knowing the people around here there probably
be at least 3 different versions floating around by then ;)

Regards,
Andy

--
Brandy-and-water spoils two good things.
                -- Charles Lamb

attachment0 (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: cino=(0 not working as expected

Andy Kittner
On Mon, Oct 13, 2008 at 11:34:01PM +0200, Andy Kittner wrote:
> [...]
>the function to the after/ftplugin/python.vim file, adjust it to the way
actually I meant after/indent/python.vim, sorry for the confusion.



--
What!?  Me worry?
                -- Alfred E. Newman

attachment0 (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: cino=(0 not working as expected

Bobby Impollonia

Thanks for the help. I am traveling right now and may not have a
chance to look at it for a little while, but whenever I come up with a
fix, I will definitely post it for others to use.

On Oct 13, 5:56 pm, Andy Kittner <[hidden email]> wrote:

> On Mon, Oct 13, 2008 at 11:34:01PM +0200, Andy Kittner wrote:
> > [...]
> >the function to the after/ftplugin/python.vim file, adjust it to the way
>
> actually I meant after/indent/python.vim, sorry for the confusion.
>
> --
> What!?  Me worry?
>                 -- Alfred E. Newman
>
>  application_pgp-signature_part
> < 1KViewDownload
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---