arm-syntax-vim/autoload/arm/ft.vim

25 lines
683 B
VimL
Raw Normal View History

2020-07-11 23:34:08 -07:00
let s:cpo_save = &cpo
set cpo&vim
function! arm#ft#FTarm()
2023-02-08 21:50:49 -08:00
let line1 = getline(1)
let line2 = getline(2)
let head = ' '.line1.' '.line2.' '.getline(3).' '.getline(4).
2020-07-11 23:34:08 -07:00
\' '.getline(5).' '
" Can't use setf, as we need to overrule the default filetype setting
if matchstr(head, '\s\.arch\s\+armv4') != ''
set filetype=armv4
elseif matchstr(head, '\s\.arch\s\+armv5') != ''
set filetype=armv5
elseif matchstr(head, '\s\.arch\s\+arm') != ''
set filetype=arm
elseif matchstr(head, '\s\.cpu\s\+arm') != ''
set filetype=arm
2023-02-08 21:50:49 -08:00
elseif line1 ==# '@ armv7' || line2 ==# '@ armv7'
set filetype=arm
2020-07-11 23:34:08 -07:00
endif
endfunction
let &cpo = s:cpo_save
unlet s:cpo_save