나는 항상 cpp 파일 (* .cc)을 tcl
파일로 인식하는 시스템 (리눅스)에있다. 어떤 파일 유형인지는 모르겠지만이를 대체하려고합니다. 수동으로 :set ft=cpp
을 수행하면 올바른 구문 강조 표시가 선택됩니다. 그러나 자동으로 설정하는 데 문제가있어서 modeline
옵션을 사용하고 싶지 않습니다. 내 자신의 .vimrc
은 간섭을주지 않습니다 (이름을 변경하면 동일한 결과). 내가 다른 컴퓨터에 이전에이 옵션을 사용하고 그 일을vim에서 여전히 잘못된 구문 형광펜을 선택하면 어떻게 할 수 있습니까?
*ftplugin-overrule*
If a global filetype plugin does not do exactly what you want, there are three
ways to change this:
1. Add a few settings.
You must create a new filetype plugin in a directory early in
'runtimepath'. For Unix, for example you could use this file:
vim ~/.vim/ftplugin/fortran.vim
You can set those settings and mappings that you would like to add. Note
that the global plugin will be loaded after this, it may overrule the
settings that you do here. If this is the case, you need to use one of the
following two methods.
Vim은 도움말 (:help ftplugin-override
)에서
. 나는 첫 번째 줄이 제대로 나는 :set ft=cpp
말했다 것처럼하지만, 구문 강조 동일 하지 인 filetype
(CPP는 :set ft?
반환)을 설정
<file> .vim/ftplugin/tcl.vim
set filetype=cpp
"au BufRead,BufNewFile * set filetype=cpp
시도했습니다. 여전히 tcl
구문 강조 표시입니다. 두 번째 줄은 아무 것도하지 않습니다.
2. Make a copy of the plugin and change it.
You must put the copy in a directory early in 'runtimepath'. For Unix, for
example, you could do this:
cp $VIMRUNTIME/ftplugin/fortran.vim ~/.vim/ftplugin/fortran.vim
Then you can edit the copied file to your liking. Since the b:did_ftplugin
variable will be set, the global plugin will not be loaded.
A disadvantage of this method is that when the distributed plugin gets
improved, you will have to copy and modify it again.
는 tcl.vim
라는 내 $VIMRUNTIME
디렉토리 /usr/share/vim/vim72/ftplugin/
에는 파일이 없을 것 같다.
1과 동일한 효과가 있습니다. 다른 시도가 있습니까? 많은 감사드립니다.
젠장, 내가 보지 못했던 모델이 있었어! 왜 내 동료들은 그것을 설정 했습니까? 고마워요 로메인! – Sebastian
모델이 유용하지만 팀이 어떤 것을 표준화해야합니다. – romainl