2012-08-30 7 views
1

나는 항상 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과 동일한 효과가 있습니다. 다른 시도가 있습니까? 많은 감사드립니다.

답변

3

cpp*.cc*.cpp 파일에 대한 기본 파일 형식입니다.

tcl 파일 형식은 *.tcl, *.tk, *.itcl, *.itk*.jacl 설정된다.

/usr/shhare/vim/vim7x/filetype.vim 
:

/usr/share/vim/vim7x/ftplugin/cpp.vim 
/usr/share/vim/vim7x/indent/cpp.vim 
/usr/share/vim/vim7x/syntax/cpp.vim 

하고 정확한 검사가 이루어 경우 a *.cc 파일을로드 할 때 빔이 tcl에 기본 것입니다하지만 당신은 논문 파일이 설치되어 있는지 확인할 수 있습니다 이유

나는 이유를 볼 수 없습니다

이 컴퓨터에서만 작업하는 사람이 있습니까? 당신은 모드라인을 사용합니까?

+0

젠장, 내가 보지 못했던 모델이 있었어! 왜 내 동료들은 그것을 설정 했습니까? 고마워요 로메인! – Sebastian

+0

모델이 유용하지만 팀이 어떤 것을 표준화해야합니다. – romainl

관련 문제