文法ハイライトを指定する
    Top > Linux > Vim
    文法ハイライトの言語を一時的に指定する
    Vim中で set syntax=syntax-name を実行する. a.pyで次のように書いてみる.*.pyというファイルはPythonのソースコードとして認識されるのでそれに従ってハイライトされる. This file is recognized as Fortran source code by executing set syntax=fortran. The setting moves back when this file was closed. ここで set syntax=fortran を実行すると,このファイルはFortranのソースコードとして認識されるようになる.一度ファイルを閉じると元に戻る.
    文法ハイライトを常に適用する
    Write as follows on ~/.vimrc. ~/.vimrcに次のように書く. BufNewFile: Apply when the file was created. BufRead: Apply when existing file was opened. Files such as "a.fuga" are always recognized as Fortran source code by this setting. BufNewFile: ファイルを新規作成したときに適用する BufRead: 既存のファイルを開いたときに適用する こうすると「a.fuga」などのファイルが常時Fortranのソースコードとして認識されるようになる.
    References
    How to force vim to syntax-highlight a file as html? - Stack Overflow + https://stackoverflow.com/questions/3853028/how-to-force-vim-to-syntax-highlight-a-file-as-html