indenting problem (again)

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

indenting problem (again)

Paul Tremblay
I am once again getting an annoying indent problem. When I type a
paragraph of text with a comma at the end (","), the next line jumps 8
spaces from the start:  

bbbb bb b bbbbbbbbb bbb bb bb bbb bbbb bb bbbb b bbbb bb bb bbb bb bb,
        and bbbb

The line should look like:

bbbb bb b bbbbbbbbb bbb bb bb bbb bbbb bb bbbb b bbbb bb bb bbb bb bb,
and bbbb

This problem usually occurs when I have an XML file open, but now it
occurs with any text file.

At the top of my file I have:

:author: Paul Tremblay

:title: The Title

I was told before that this confuses vim because vim thinks it has
found a modeline.

Any ideas what causes this problem? Where should I look to start
debugging it?

Thanks

Paul

--

************************
*Paul Tremblay         *
*[hidden email]    *
************************
Reply | Threaded
Open this post in threaded view
|

Re: indenting problem (again)

A.J.Mechelynck
Paul Tremblay wrote:

> I am once again getting an annoying indent problem. When I type a
> paragraph of text with a comma at the end (","), the next line jumps 8
> spaces from the start:  
>
> bbbb bb b bbbbbbbbb bbb bb bb bbb bbbb bb bbbb b bbbb bb bb bbb bb bb,
>         and bbbb
>
> The line should look like:
>
> bbbb bb b bbbbbbbbb bbb bb bb bbb bbbb bb bbbb b bbbb bb bb bbb bb bb,
> and bbbb
>
> This problem usually occurs when I have an XML file open, but now it
> occurs with any text file.
>
> At the top of my file I have:
>
> :author: Paul Tremblay
>
> :title: The Title
>
> I was told before that this confuses vim because vim thinks it has
> found a modeline.

It shouldn't, see ":help modeline". If you had ": vim: 6.4:007" instead,
then it might perhaps confuse Vim. No line is a modeline unless it
contains the string vim: preceded by at least one whitespace character.

>
> Any ideas what causes this problem? Where should I look to start
> debugging it?
>
> Thanks
>
> Paul
>

I personally hate programs that reindent my text with no regard to what
I like, so I have "filetype indent off" in my vimrc, somewhere after
"runtime vimrc_example.vim".

YMMV.


Best regards,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: indenting problem (again)

Benji Fisher
On Thu, Feb 09, 2006 at 12:40:14AM +0100, A. J. Mechelynck wrote:

> Paul Tremblay wrote:
> > I am once again getting an annoying indent problem. When I type a
> > paragraph of text with a comma at the end (","), the next line jumps 8
> > spaces from the start:  
> >
> > bbbb bb b bbbbbbbbb bbb bb bb bbb bbbb bb bbbb b bbbb bb bb bbb bb bb,
> >         and bbbb
> >
> > The line should look like:
> >
> > bbbb bb b bbbbbbbbb bbb bb bb bbb bbbb bb bbbb b bbbb bb bb bbb bb bb,
> > and bbbb
> >
> > This problem usually occurs when I have an XML file open, but now it
> > occurs with any text file.
> >
> > At the top of my file I have:
> >
> > :author: Paul Tremblay
> >
> > :title: The Title
> >
> > I was told before that this confuses vim because vim thinks it has
> > found a modeline.
>
> It shouldn't, see ":help modeline". If you had ": vim: 6.4:007" instead,
> then it might perhaps confuse Vim. No line is a modeline unless it
> contains the string vim: preceded by at least one whitespace character.

     Well, vi or vim or ex preceded by white space and followed by a
colon (:).  I agree that :author: and :title: should be harmless.

> > Any ideas what causes this problem? Where should I look to start
> > debugging it?

:verbose set autoindent? cindent? smartindent? indentexpr?

HTH --Benji Fisher
Reply | Threaded
Open this post in threaded view
|

Re: indenting problem (again)

Charles E Campbell Jr
In reply to this post by A.J.Mechelynck
A. J. Mechelynck wrote:

>I personally hate programs that reindent my text with no regard to what
>I like, so I have "filetype indent off" in my vimrc, somewhere after
>"runtime vimrc_example.vim".
>  
>

I just re-write the indent files to conform to my own preferences.  
Currently I have 8 such indent files.

What I find irritating is when the indent files, such as  
/usr/local/share/vim/vim70aa/ftplugin/c.vim
set options that I dislike.  The example just given sets formatoption
(to n2croql).  I do know how to
"fix" this -- I have ~/.vim/after/ftplugin/c/c.vim with setlocal fo=nroql2 .

Regards,
Chip Campbell

Reply | Threaded
Open this post in threaded view
|

Re: indenting problem (again)

A.J.Mechelynck
Charles E. Campbell, Jr. wrote:

> A. J. Mechelynck wrote:
>
>> I personally hate programs that reindent my text with no regard to what
>> I like, so I have "filetype indent off" in my vimrc, somewhere after
>> "runtime vimrc_example.vim".
>>  
>>
>
> I just re-write the indent files to conform to my own preferences.
> Currently I have 8 such indent files.
>
> What I find irritating is when the indent files, such as
> /usr/local/share/vim/vim70aa/ftplugin/c.vim
> set options that I dislike.  The example just given sets formatoption
> (to n2croql).  I do know how to
> "fix" this -- I have ~/.vim/after/ftplugin/c/c.vim with setlocal
> fo=nroql2 .
>
> Regards,
> Chip Campbell


Huh-huh. Most of what I write is HTML (plus some plaintext, bash and CMD
shell scripts, etc.), and those pesky indent scripts wanted to enforce
some sort of "programming style". I want to set indenting width "on the
fly" depending on circumstances, so what suits my style best is

        :filetype indent off
        :set autoindent nocindent nosmartindent

, which I set in the vimrc. Of course, YMMV ;-)


Best regards,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: indenting problem (again)

Gerald Lai-2
In reply to this post by Charles E Campbell Jr
On Thu, 9 Feb 2006, Charles E. Campbell, Jr. wrote:

> A. J. Mechelynck wrote:
>
>> I personally hate programs that reindent my text with no regard to what
>> I like, so I have "filetype indent off" in my vimrc, somewhere after
>> "runtime vimrc_example.vim".
>>
>
> I just re-write the indent files to conform to my own preferences.  Currently
> I have 8 such indent files.
>
> What I find irritating is when the indent files, such as
> /usr/local/share/vim/vim70aa/ftplugin/c.vim
> set options that I dislike.  The example just given sets formatoption (to
> n2croql).  I do know how to
> "fix" this -- I have ~/.vim/after/ftplugin/c/c.vim with setlocal fo=nroql2 .

Yeah, I noticed that too. The way I counteracted that is by placing this
in my vimrc:

   set formatoptions=tc
   "enforce formatoptions for all filetypes
   autocmd FileType * setlocal formatoptions=tc

I don't like people messin' with my 'fo... ;)
--
Gerald
Reply | Threaded
Open this post in threaded view
|

Re: indenting problem (again)

Gerald Lai-2
On Thu, 9 Feb 2006, Gerald Lai wrote:

> On Thu, 9 Feb 2006, Charles E. Campbell, Jr. wrote:
>
>> A. J. Mechelynck wrote:
>>
>>> I personally hate programs that reindent my text with no regard to what
>>> I like, so I have "filetype indent off" in my vimrc, somewhere after
>>> "runtime vimrc_example.vim".
>>>
>>
>> I just re-write the indent files to conform to my own preferences.
>> Currently I have 8 such indent files.
>>
>> What I find irritating is when the indent files, such as
>> /usr/local/share/vim/vim70aa/ftplugin/c.vim
>> set options that I dislike.  The example just given sets formatoption (to
>> n2croql).  I do know how to
>> "fix" this -- I have ~/.vim/after/ftplugin/c/c.vim with setlocal fo=nroql2
>> .
>
> Yeah, I noticed that too. The way I counteracted that is by placing this
> in my vimrc:
>
>  set formatoptions=tc
>  "enforce formatoptions for all filetypes
>  autocmd FileType * setlocal formatoptions=tc
>
> I don't like people messin' with my 'fo... ;)

Oops, I forgot to add BufEnter. Actually, "set formatoptions=tc" isn't
necessary, so this is all that's needed:

   autocmd FileType,BufEnter * set formatoptions=tc
--
Gerald
Reply | Threaded
Open this post in threaded view
|

Re: indenting problem (again)

Matthew Winn
In reply to this post by A.J.Mechelynck
On Thu, Feb 09, 2006 at 07:57:17PM +0100, A. J. Mechelynck wrote:

>
> Huh-huh. Most of what I write is HTML (plus some plaintext, bash and CMD
> shell scripts, etc.), and those pesky indent scripts wanted to enforce
> some sort of "programming style". I want to set indenting width "on the
> fly" depending on circumstances, so what suits my style best is
>
> :filetype indent off
> :set autoindent nocindent nosmartindent
>
> , which I set in the vimrc. Of course, YMMV ;-)

That's exactly what I use.  Having become accustomed to using ^D/^T for
indenting I find it far faster -- almost instinctive, in fact -- to use
those than to let some script indent the line for me and then have to
pause for some think time while I confirm that the indentation it has
given me is what I want for that line.

--
Matthew Winn ([hidden email])
Reply | Threaded
Open this post in threaded view
|

Re: indenting problem (again)

Antony Scriven
On Feb 10, Matthew Winn wrote:

 > On Thu, Feb 09, 2006 at 07:57:17PM +0100, A. J.
 > Mechelynck wrote:
 > >
 > > Huh-huh. Most of what I write is HTML (plus some
 > > plaintext, bash and CMD shell scripts, etc.), and those
 > > pesky indent scripts wanted to enforce some sort of
 > > "programming style". I want to set indenting width "on
 > > the fly" depending on circumstances, so what suits my
 > > style best is
 > >
 > >    :filetype indent off
 > >    :set autoindent nocindent nosmartindent
 > >
 > > , which I set in the vimrc. Of course, YMMV ;-)
 >
 > That's exactly what I use.  Having become accustomed to
 > using ^D/^T for indenting I find it far faster -- almost
 > instinctive, in fact -- to use those than to let some
 > script indent the line for me and then have to pause for
 > some think time while I confirm that the indentation it
 > has given me is what I want for that line.

That's similar to me too. Except I have filetype indent on
and unset 'cinkeys' and 'indentkeys' so that I can still
reindent stuff with =. The only problem with that is that
the automatic indenting appears to affect S, regardless of
'cinkeys' and 'indentkeys'. I wonder if that is intentional?

Antony