Bug#493753: vim: default configuration does not properly handle tabs

James Vega jamessan at debian.org
Mon Aug 4 20:23:22 UTC 2008


On Mon, Aug 04, 2008 at 10:28:59PM +0300, Teodor wrote:
> On Mon, Aug 4, 2008 at 9:11 PM, James F Zuelow Jr
> <james_zuelow at ci.juneau.ak.us> wrote:
> > I have always had a problem with vim on Debian where tabs are not
> > handled correctly.
> 
> As a workarround, I've added this line in /etc/skel/.vimrc:
> :set noautoindent
> 
> This prevents adding extra tabs, but I didn't find anything to prevent
> autocomments (with #at the beginning of every line after any comment).

Automatically adding the comment leader to the start of the line is
controlled by a couple of options.

First, there are the "c", "r", and "o" settings of the 'formatoptions'
option.

  c       Auto-wrap comments using textwidth, inserting the current comment 
          leader automatically.
  r       Automatically insert the current comment leader after hitting
          <Enter> in Insert mode.
  o       Automatically insert the current comment leader after hitting 'o' or
          'O' in Normal mode.

Second, there is the 'comments' option, which specifies strings that can
start a comment and how they are formatted.

If you remove "c", "r", and "o" from your 'formatoptions' (":set fo-=c",
":set fo-=r", ":set fo-=o"), then Vim will never automatically insert
the comment leader.

Just be ware that if you have enabled filetype plugins (which you can
check with the ":filetype" command), these plugins may setup
'formatoptions' for you to re-include some of those settings.  In that
case, you can create an override in ~/.vim/after/ftplugin/ for the
specific filetype to undo the system-wide ftplugin's work (documented as
item 3 at ":help ftplugin-overrule").

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan at debian.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20080804/0bd6660a/attachment-0001.pgp 


More information about the pkg-vim-maintainers mailing list