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

expandtab not working for Ruby

Expand Messages
  • Marten Veldthuis
    Weird problem time: I ve got expandtab set in my .vimrc file, but apparently it s not working. I d never really noticed this because somehow it *is* working
    Message 1 of 4 , Jun 26, 2011
    View Source
    • 0 Attachment
      Weird problem time:

      I've got expandtab set in my .vimrc file, but apparently it's not working. I'd never really noticed this because somehow it *is* working when I'm in a Rails project, but outside of that I still get tab characters. 

      I've tried grepping for expandtab, or ruby, but I can't figure this one out, so I'm hoping someone knows where or how to look. My vimrc is pasted over here: https://gist.github.com/1047562

      --
      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
    • Gary Johnson
      ... To see if it is really being set in your .vimrc, you can start Vim with no file name on the command line and execute ... That will show you where
      Message 2 of 4 , Jun 26, 2011
      View Source
      • 0 Attachment
        On 2011-06-26, Marten Veldthuis wrote:
        > Weird problem time:
        >
        > I've got expandtab set in my .vimrc file, but apparently it's not working. I'd
        > never really noticed this because somehow it *is* working when I'm in a Rails
        > project, but outside of that I still get tab characters.
        >
        > I've tried grepping for expandtab, or ruby, but I can't figure this one out, so
        > I'm hoping someone knows where or how to look. My vimrc is pasted over here:
        > https://gist.github.com/1047562

        To see if it is really being set in your .vimrc, you can start Vim
        with no file name on the command line and execute

        :verbose set expandtab?

        That will show you where 'expandtab' was set last as well as its
        value. You should see this:

        expandtab
        Last set from ~/.vimrc

        Then, when you edit some file and notice that tabs are not being
        expanded, execute this:

        :verbose set expandtab? filetype?

        That will show you the plugin that set it to 'noexpandtab' and will
        also show the current 'filetype' which may help in finding the
        problem and a solution.

        The solution will probably be to identify the filetype plugin that
        is setting 'noexpandtab' and to put this line

        setlocal expandtab

        in a file named

        ~/.vim/after/plugin/<filetype>.vim

        where <filetype>.vim is the name of the offending filetype plugin.

        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
      • Ben Schmidt
        ... The first thing to do is ask Vim what s setting it. Try ... in a situation where it works (e.g. a rails project) and where it doesn t. Then compare. There
        Message 3 of 4 , Jun 26, 2011
        View Source
        • 0 Attachment
          > I've got expandtab set in my .vimrc file, but apparently it's not working. I'd
          > never really noticed this because somehow it *is* working when I'm in a Rails
          > project, but outside of that I still get tab characters.
          >
          > I've tried grepping for expandtab, or ruby, but I can't figure this one out, so
          > I'm hoping someone knows where or how to look. My vimrc is pasted over here:
          > https://gist.github.com/1047562

          The first thing to do is ask Vim what's setting it. Try

          :verbose set expandtab?

          in a situation where it works (e.g. a rails project) and where it
          doesn't. Then compare. There are lots of places Vim options can be set:
          modelines, vimrc, commandline, indent plugins, etc..

          Ben.



          --
          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
        • Marten Veldthuis
          Thanks to you and Ben, I figured it out. :verbose set expandtab? told me it was set from vimrc even when it wasn t working, so I started moving the set
          Message 4 of 4 , Jun 27, 2011
          View Source
          • 0 Attachment
            Thanks to you and Ben, I figured it out. :verbose set expandtab? told me it was set from vimrc even when it wasn't working, so I started moving the "set expandtab" line around. Turns out it was the "set binary" that was a little bit later in my vimrc that reset it.

            Cheers,
            Marten

            --
            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
          Your message has been successfully submitted and would be delivered to recipients shortly.