Thursday, June 5, 2014

Re: I realise smart indenting is not working - OK, some progress

Gary,

Thanks for the response - see below:


On 2014-06-06 01:59, Gary Johnson wrote:
> On 2014-06-06, Philip Rhoades wrote:
>> People,
>>
>> I have been using vim for a long time but finally got bored hitting
>> TAB to do indenting on code - I tried to work out why "smart
>> indenting" after the usual stuff "for", "class" etc wasn't working
>> but couldn't see what the problem was. I found out that Fedora 20 is
>> installing Vim 7.4 and all that stuff should "work out of the box" -
>> I renamed my .vim dir and .vimrc file and still no difference. I
>> logged in as a basic user with no .vim or .vimrc and still no joy . .
>>
>> Can someone enlighten me? I must be missing something no?
>
> "Smart indenting" isn't all that smart. My understanding is that it
> was an attempt to improve Vim's indenting capabilities but it never
> acquired enough knowledge of real programming languages to be really
> useful.


From the little I have seen of people using "modern" editors (eg a
friend using "Atom") that seems like it might be right . .


> Use Vim's "automatic indenting" instead. See
>
> :help 30.3
> :help :filetype


Thanks for that.


> which boils down to putting this line in your ~/.vimrc:
>
> filetype indent on
>
> Now it should "just work". There can be situations where it
> doesn't, though, as when you edit programs written in a language
> that Vim doesn't recognize, so if it doesn't work for you, come back
> with an example and we'll see what we can do to help.


OK, so to be clear, now I have:

- my .vim dir renamed to something else

- a single line in my .vimrc file of:

filetype indent on

and yes, now when I edit a test Ruby file, it does indeed do the
automatic indenting but the automatic indent is a tab space - I thought
the convention with Vim 7.3+ was two spaces?

If I add "filetype indent on" to my previous .vimrc, the autoindent
shows only four spaces on the screen but it is still a tab character.

Some progress though - thanks!

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW 2001
Australia
E-mail: phil@pricom.com.au

--
--
You received this message from the "vim_use" 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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: