vim的tabstop

| No Comments | No TrackBacks

vim有几个关于tab和space的option让我迷惑了一阵子,查手册tabstop是一个tab几个space,softtabstop是当编辑的时候一个tab表现为几个space,shiftwidth是缩进的时候用几个space。怎么设置才合适呢?

官方给了4个方案.

  1. 保持tabstop是8,把softtabstopshiftwidth设置成4,再加上noexpandtab,这样呢vim就会把space和tab给混用,但是呈现的时候是4个space。
  2. tabstop,shiftwidth设置成同一个值,加上expandtab,这样就会只用space,而不用tab了,这样不管tabstop怎么变样式也不会花了。
  3. modeline的方式把tabstopshiftwidth的设置放在文件里,无论怎样编辑样式都不会花了。
  4. 永远保持tabstopshiftwidth是同一个值,再加上noexpandtab
介于Py3k的Style Changes
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
这样设置应该是比较和谐了。

No TrackBacks

TrackBack URL: http://mt.khsing.net/cgi-bin/mt-tb.cgi/40

Leave a comment

About this Entry

This page contains a single entry by Guixing published on December 12, 2008 2:12 PM.

解决Safari升级失败 was the previous entry in this blog.

逝者已矣,来者可追 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.