Tuesday, July 31, 2012

Re: How to turn off auto-indentation?

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

No comments:

Post a Comment