- 论坛徽章:
- 0
|
原帖由 newfolder 于 2008-2-4 12:34 发表
用vim
问一下楼上,如果只想.py的文件set那些条件,其余的文件不set怎么写.vimrc?
试了下:
if has(".py")
set tabstop=8
....
endif
不行,tab还是tab..
thanks~
从vim的手册里面看来的
在目录~/.vim/ftplugin/里面放一个文件 python.vim , 里面写上 set softstop 这些内容就可以了。
试了下可以,副作用未知。
以下是手册原文:2. Create the file "~/.vim/ftplugin/c.vim", with the contents:
setlocal softtabstop=4
noremap <buffer> <LocalLeader>c o/**************<CR><CR>/<Esc>
Try editing a C file. You should notice that the 'softtabstop' option is set
to 4. But when you edit another file it's reset to the default zero. That is
because the ":setlocal" command was used. This sets the 'softtabstop' option
only locally to the buffer. As soon as you edit another buffer, it will be
set to the value set for that buffer. For a new buffer it will get the
default value or the value from the last ":set" command.
Likewise, the mapping for "\c" will disappear when editing another buffer.
The ":map <buffer>" command creates a mapping that is local to the current
buffer. This works with any mapping command: ":map!", ":vmap", etc. The
|<LocalLeader>| in the mapping is replaced with the value of "maplocalleader".
You can find examples for filetype plugins in this directory:
$VIMRUNTIME/ftplugin/
More details about writing a filetype plugin can be found here:
|write-plugin|. |
|