Loading ...
Sorry, an error occurred while loading the content.

I realise smart indenting is not working

Expand Messages
  • Philip Rhoades
    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
    Message 1 of 4 , Jun 5, 2014
    • 0 Attachment
      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?

      Thanks,

      Phil.

      --
      Philip Rhoades

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

      --
      --
      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@....
      For more options, visit https://groups.google.com/d/optout.
    • Gary Johnson
      ... 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
      Message 2 of 4 , Jun 5, 2014
      • 0 Attachment
        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.

        Use Vim's "automatic indenting" instead. See

        :help 30.3
        :help :filetype

        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.

        Regards,
        Gary

        --
        --
        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@....
        For more options, visit https://groups.google.com/d/optout.
      • Philip Rhoades
        Gary, Thanks for the response - see below: ... From the little I have seen of people using modern editors (eg a friend using Atom ) that seems like it might
        Message 3 of 4 , Jun 5, 2014
        • 0 Attachment
          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@...

          --
          --
          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@....
          For more options, visit https://groups.google.com/d/optout.
        • Erik Christiansen
          ... Why worry about defaults, especially if they don t suit? For a couple of decades I ve been happy with: tabstop=3 shiftwidth=3 To avoid any text movement if
          Message 4 of 4 , Jun 6, 2014
          • 0 Attachment
            On 06.06.14 15:44, Philip Rhoades wrote:
            > 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?

            Why worry about defaults, especially if they don't suit? For a couple of
            decades I've been happy with:

            tabstop=3
            shiftwidth=3

            To avoid any text movement if tabstop were changed, e.g. if the files
            were shared with another user, I also set:

            expandtab

            except in makefiles, naturally. (With modelines, rather than filetype.)

            Incidentally, +1 for autoindent - it works well enough that I've never
            tried smartindent or cindent.

            Erik

            --
            Sack the teachers, send in the missionaries. Pie in the sky when you die.
            Captain Catholic rules, OK? - Mungo MacCallum, when Australia's new right-wing
            government viciously cut $30,000,000,000 from school funding, but sneaked in
            $250,000,000 for _school_chaplains_!
            - http://www.abc.net.au/news/2014-05-19/maccallum-budget-fairness-goes-up-in-cigar-smoke/5461390

            --
            --
            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@....
            For more options, visit https://groups.google.com/d/optout.
          Your message has been successfully submitted and would be delivered to recipients shortly.