vim 中未检测到 mako 文件类型

mako filetype not detected in vim

当我使用 vim 编辑 .mak 文件时,语法突出显示未应用于该文件。这是我的 .vimrc

" Pathogen 

call pathogen#infect()
call pathogen#helptags()

filetype off 
filetype plugin indent on
syntax on

set nu

colorscheme denkai

autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p

let g:NERDTreeWinPos = "right"
let NERDTreeShowHidden=1

nmap <silent> <F3> : wincmd p<CR>
nmap <silent> <F2> : NERDTreeToggle<CR>
nmap <silent> <TAB> : bNext<CR>

set noswapfile
set nobackup
set backspace=indent,eol,start
set undofile
set undodir=$HOME/.vim/undo
set undolevels=1000
set undoreload=10000
set noexpandtab
set listchars=tab:▸-,eol:$,trail:~,nbsp:~

set cursorline 
set cursorcolumn

hi CursorLine   cterm=NONE ctermbg=darkcyan ctermfg=black guibg=darkblue guifg=white
hi CursorColumn   cterm=NONE ctermbg=darkcyan ctermfg=black guibg=darkblue guifg=white

au BufNewFile, BufRead, BufReadPost *.mak set filetype=mako
au BufRead, BufNewFile *.mak set syntax=mako

我试过在文件末尾关闭和打开文件类型和语法(将其从文件顶部移至末尾),但它不起作用。

我希望在编辑这些文件时自动检测文件类型并应用正确的语法 (mako)。

当我输入 :set ft=mako 时,效果非常好。

感谢您的帮助!

您可能想查看 Mako.vim and see if it helps, it's possible that vim doesn't have a syntax file for mako files. Otherwise you will need to create a syntax file as outlined here