expand tabs problem

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

expand tabs problem

Chris Fonnesbecck
Even though I have the following in my .vimrc:

    set expandtab
    set tabstop=4
    set shiftwidth=4
    set softtabstop=4
    set smarttab

I still get tabs embedded into documents that I am editing. I end up
having to search and replace for them before saving documents.
Understandably, this is not good for python editing. Anyone have a
clue as to why my preferences are being overriden?

Thanks,
Chris
Reply | Threaded
Open this post in threaded view
|

Re: expand tabs problem

Marian Csontos
Hi Chris,

probably some ftplugin reset it. I suppose ftplugin for python.
:he ftplugins
try to look for python*.vim somewhere in your 'runtimepath'
:he 'runtimepath'

other possibility is that there are modelines (line =~ '^# vim:')in your  
python source
:he modeline

Regards

-- Marian

On Wed, 14 Sep 2005 03:22:04 +0200, Chris Fonnesbeck  
<[hidden email]> wrote:

> Even though I have the following in my .vimrc:
>
>     set expandtab
>     set tabstop=4
>     set shiftwidth=4
>     set softtabstop=4
>     set smarttab
>
> I still get tabs embedded into documents that I am editing. I end up
> having to search and replace for them before saving documents.
> Understandably, this is not good for python editing. Anyone have a
> clue as to why my preferences are being overriden?
>
> Thanks,
> Chris


________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com
Reply | Threaded
Open this post in threaded view
|

Re: expand tabs problem

James Vega-3
In reply to this post by Chris Fonnesbecck
On Tue, Sep 13, 2005 at 09:22:04PM -0400, Chris Fonnesbeck wrote:
> Even though I have the following in my .vimrc:
>
>     set expandtab
>     set tabstop=4
>     set shiftwidth=4
>     set softtabstop=4
>     set smarttab

What does ":verbose set expandtab?" report when you experience this
problem?  That will tell you the current setting and where that was last
set.

James
--
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[hidden email]>

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

Re: expand tabs problem

Chris Fonnesbecck
On 9/14/05, James Vega <[hidden email]> wrote:

> On Tue, Sep 13, 2005 at 09:22:04PM -0400, Chris Fonnesbeck wrote:
> > Even though I have the following in my .vimrc:
> >
> >     set expandtab
> >     set tabstop=4
> >     set shiftwidth=4
> >     set softtabstop=4
> >     set smarttab
>
> What does ":verbose set expandtab?" report when you experience this
> problem?  That will tell you the current setting and where that was last
> set.
>

It says:

noexpandtab
      Last set from /Users/chris/.vimrc

This is strange, since my .vimrc says:

set expandtab

I'm not sure where the setting is getting screwed up.

C.
Reply | Threaded
Open this post in threaded view
|

Re: expand tabs problem

James Vega-3
On Wed, Sep 14, 2005 at 11:07:51AM -0400, Chris Fonnesbeck wrote:

> On 9/14/05, James Vega <[hidden email]> wrote:
> > On Tue, Sep 13, 2005 at 09:22:04PM -0400, Chris Fonnesbeck wrote:
> > > Even though I have the following in my .vimrc:
> > >
> > >     set expandtab
> > >     set tabstop=4
> > >     set shiftwidth=4
> > >     set softtabstop=4
> > >     set smarttab
> >
> > What does ":verbose set expandtab?" report when you experience this
> > problem?  That will tell you the current setting and where that was last
> > set.
> >
>
> It says:
>
> noexpandtab
>       Last set from /Users/chris/.vimrc
>
> This is strange, since my .vimrc says:
>
> set expandtab
Check for a later line that says either:

set noexpandtab

or

set noet

James
--
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[hidden email]>

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

Re: expand tabs problem

Chris Fonnesbecck
On 9/14/05, James Vega <[hidden email]> wrote:

> On Wed, Sep 14, 2005 at 11:07:51AM -0400, Chris Fonnesbeck wrote:
> > On 9/14/05, James Vega <[hidden email]> wrote:
> > > On Tue, Sep 13, 2005 at 09:22:04PM -0400, Chris Fonnesbeck wrote:
> > > > Even though I have the following in my .vimrc:
> > > >
> > > >     set expandtab
> > > >     set tabstop=4
> > > >     set shiftwidth=4
> > > >     set softtabstop=4
> > > >     set smarttab
> > >
> > > What does ":verbose set expandtab?" report when you experience this
> > > problem?  That will tell you the current setting and where that was last
> > > set.
> > >
> >
> > It says:
> >
> > noexpandtab
> >       Last set from /Users/chris/.vimrc
> >
> > This is strange, since my .vimrc says:
> >
> > set expandtab
>
> Check for a later line that says either:
>
> set noexpandtab
>
> or
>
> set noet

I found the problem. The following line, placed after by "set
expandtab" statement somehow changes the setting back to noexpandtab:

set binary noeol

Since this is supposed to just stop carriage returns at the end of the
last line, it sounds like there is a side-effect going on.

C.
Reply | Threaded
Open this post in threaded view
|

Re: expand tabs problem

James Vega-3
On Wed, Sep 14, 2005 at 11:30:37AM -0400, Chris Fonnesbeck wrote:

> On 9/14/05, James Vega <[hidden email]> wrote:
> > On Wed, Sep 14, 2005 at 11:07:51AM -0400, Chris Fonnesbeck wrote:
> > > On 9/14/05, James Vega <[hidden email]> wrote:
> > > > On Tue, Sep 13, 2005 at 09:22:04PM -0400, Chris Fonnesbeck wrote:
> > > > > Even though I have the following in my .vimrc:
> > > > >
> > > > >     set expandtab
> > > > >     set tabstop=4
> > > > >     set shiftwidth=4
> > > > >     set softtabstop=4
> > > > >     set smarttab
> > > >
> > > > What does ":verbose set expandtab?" report when you experience this
> > > > problem?  That will tell you the current setting and where that was last
> > > > set.
> > > >
> > >
> > > It says:
> > >
> > > noexpandtab
> > >       Last set from /Users/chris/.vimrc
> > >
> > > This is strange, since my .vimrc says:
> > >
> > > set expandtab
> >
> > Check for a later line that says either:
> >
> > set noexpandtab
> >
> > or
> >
> > set noet
>
> I found the problem. The following line, placed after by "set
> expandtab" statement somehow changes the setting back to noexpandtab:
>
> set binary noeol
>
> Since this is supposed to just stop carriage returns at the end of the
> last line, it sounds like there is a side-effect going on.
All you should need is "set noeol", although I'd recommend against
setting that.  Setting the binary option modifies a number of other
options and should only really be used when you're editing non-plain
text files, such as compressed files, binaries, etc.  Vim will
automatically handle this for you for some compressed files (gzip,
bzip2, zip).

:he 'binary

James
--
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[hidden email]>

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

Re: expand tabs problem

A.J.Mechelynck
----- Original Message -----
From: "James Vega" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, September 14, 2005 5:51 PM
Subject: Re: expand tabs problem

On Wed, Sep 14, 2005 at 11:30:37AM -0400, Chris Fonnesbeck wrote:

> On 9/14/05, James Vega <[hidden email]> wrote:
> > On Wed, Sep 14, 2005 at 11:07:51AM -0400, Chris Fonnesbeck wrote:
> > > On 9/14/05, James Vega <[hidden email]> wrote:
> > > > On Tue, Sep 13, 2005 at 09:22:04PM -0400, Chris Fonnesbeck wrote:
> > > > > Even though I have the following in my .vimrc:
> > > > >
> > > > >     set expandtab
> > > > >     set tabstop=4
> > > > >     set shiftwidth=4
> > > > >     set softtabstop=4
> > > > >     set smarttab
> > > >
> > > > What does ":verbose set expandtab?" report when you experience this
> > > > problem?  That will tell you the current setting and where that was
> > > > last
> > > > set.
> > > >
> > >
> > > It says:
> > >
> > > noexpandtab
> > >       Last set from /Users/chris/.vimrc
> > >
> > > This is strange, since my .vimrc says:
> > >
> > > set expandtab
> >
> > Check for a later line that says either:
> >
> > set noexpandtab
> >
> > or
> >
> > set noet
>
> I found the problem. The following line, placed after by "set
> expandtab" statement somehow changes the setting back to noexpandtab:
>
> set binary noeol
>
> Since this is supposed to just stop carriage returns at the end of the
> last line, it sounds like there is a side-effect going on.

All you should need is "set noeol", although I'd recommend against
setting that.  Setting the binary option modifies a number of other
options and should only really be used when you're editing non-plain
text files, such as compressed files, binaries, etc.  Vim will
automatically handle this for you for some compressed files (gzip,
bzip2, zip).

:he 'binary

James
--
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[hidden email]>
----- End Original Message -----

'noeol' is not acted upon unless 'binary' is set, see ":help 'eol'".

Writing a _text_ file with no EOL on the last line is discouraged. It could
lead to wrong behaviour later on, for instance when concatenating files
(where the last-line-lacking-an-EOL might get joined to the first line of
the next concatenated file).

Best regards,
Tony.