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

How to turn off auto-indentation?

Expand Messages
  • Yves S. Garret
    Hello, I ve started to use gVim in place of Notepad++ on my Windows 7 machine (something I prefer since I use vim on my Ubuntu box). However, I m running into
    Message 1 of 5 , Jul 31, 2012
      Hello,

         I've started to use gVim in place of Notepad++ on my Windows 7 machine (something I prefer since I use vim on my Ubuntu box).  However, I'm running into 2 particular issues that are quite annoying.

      1 - When I try to modify JavaScript and I write the function, the editor automatically inserts a tab (8 spaces) before the existing spaces and somehow after I delete the tab, it also seems to have deleted 2 spaces on top of that!  I like code high-lighting, makes code readable, but generally I hate any sort of auto-indentation (a preference -- or lack of a preference? -- that spans all existing browsers and now just in VI).  How do I turn of _all_ auto-indentation and just have me worry about that stuff?

      2 - Say I'm modifying multiple files.  The "buffers" feature makes it much easier to have multiple files in a single window and then switch between them.  This keeps my desktop sane by having just one window to look at.  However, when I'm finished with a particular file (or it was modified by one of my apps and I don't care about it any more) I would like to do :close and just be done with it.  But... that buffer does not "close".  What am I doing wrong and what is the purpose of :close?

      --
      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
      ... The Vim program does not have indentation enabled by default. Indentation is enabled by a configuration file or from the command line. If you don t want
      Message 2 of 5 , Jul 31, 2012
        On 2012-07-31, Yves S. Garret wrote:
        > Hello,
        >
        > I've started to use gVim in place of Notepad++ on my Windows 7 machine
        > (something I prefer since I use vim on my Ubuntu box). However, I'm running
        > into 2 particular issues that are quite annoying.
        >
        > 1 - When I try to modify JavaScript and I write the function, the editor
        > automatically inserts a tab (8 spaces) before the existing spaces and somehow
        > after I delete the tab, it also seems to have deleted 2 spaces on top of that!
        > I like code high-lighting, makes code readable, but generally I hate any sort
        > of auto-indentation (a preference -- or lack of a preference? -- that spans all
        > existing browsers and now just in VI). How do I turn of _all_ auto-indentation
        > and just have me worry about that stuff?

        The Vim program does not have indentation enabled by default.
        Indentation is enabled by a configuration file or from the command
        line. If you don't want it enabled, just find the place where it is
        enabled and delete or modify that line.

        In your case, you're probably sourcing $VIMRUNTIME/vimrc_example.vim
        which contains this line:

        filetype plugin indent on

        It's not a good idea to modify any file under $VIMRUNTIME, so you
        can instead just turn off filetype-dependent indentation by putting
        this in your _vimrc:

        filetype indent off

        See

        :help filetype-indent-off


        > 2 - Say I'm modifying multiple files. The "buffers" feature makes it much
        > easier to have multiple files in a single window and then switch between them.
        > This keeps my desktop sane by having just one window to look at. However, when
        > I'm finished with a particular file (or it was modified by one of my apps and I
        > don't care about it any more) I would like to do :close and just be done with
        > it. But... that buffer does not "close". What am I doing wrong and what is
        > the purpose of :close?

        Note that from ":help :close", :close does not close a buffer, it
        closes a window. For an explanation of the difference, see

        :help windows-intro

        Vim cannot display no window and a window cannot contain no
        buffer. When you have only one window, :close will do nothing.

        If you want to replace the buffer in your last window with an empty
        buffer, just use

        :enew

        HTH,
        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
      • sc
        ... you are looking for :bd which is short for :bdelete which deletes buffers from the buffer list -- You received this message from the vim_use maillist. Do
        Message 3 of 5 , Jul 31, 2012
          On Tue, Jul 31, 2012 at 04:33:47PM -0400, Yves S. Garret wrote:
          > Hello,

          > 2 - Say I'm modifying multiple files. The "buffers" feature makes it much
          > easier to have multiple files in a single window and then switch between
          > them. This keeps my desktop sane by having just one window to look at.
          > However, when I'm finished with a particular file (or it was modified by
          > one of my apps and I don't care about it any more) I would like to do
          > :close and just be done with it. But... that buffer does not "close".
          > What am I doing wrong and what is the purpose of :close?

          you are looking for :bd which is short for :bdelete which deletes
          buffers from the buffer list

          --
          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
        • John Beckett
          ... See: http://vim.wikia.com/wiki/How_to_stop_auto_indenting ... The :close command closes the current window, whereas you want to close (that is, delete)
          Message 4 of 5 , Jul 31, 2012
            Yves S. Garret wrote:
            > How do I turn of _all_ auto-indentation and just
            > have me worry about that stuff?

            See:
            http://vim.wikia.com/wiki/How_to_stop_auto_indenting

            > What am I doing wrong and what is the purpose of :close?

            The :close command closes the current window, whereas you want
            to "close" (that is, delete) the current buffer. There is a
            diagram showing what's what here:
            http://vim.wikia.com/wiki/Buffers

            As well as entering :bd to delete the current buffer (if it has
            been saved), you can enter :ls to list buffers then issue a
            command like this to delete several of them (the numbers are
            read from the :ls list):
            :bd 5 13 2

            John

            --
            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
          • Yves S. Garret
            Thanks everyone for your help. I think I got most of my issues resolved. I ll hit up the wiki next time I have a problem (I didn t know it existed). -- You
            Message 5 of 5 , Aug 1, 2012
              Thanks everyone for your help. I think I got most of my issues resolved. I'll hit up the wiki next time I have a problem (I didn't know it existed).

              --
              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.