Skip to content

Commit e99f3f5

Browse files
mhinzchris-morgan
authored andcommitted
:setf FALLBACK is not available in older versions (rust-lang#346)
There is no workaround for this. If we would set the filetype first via `:set filetype=cfg` or `:setfiletype cfg`, more specialized plugins like vim-toml, wouldn't be able to overwrite the filetype with `:setfiletype toml` anymore. Now, we simply don't set a filetype at all for older Vim versions. Not great, but better than an error that keeps rust.vim from getting sourced properly. Fixes rust-lang#345
1 parent f45cdae commit e99f3f5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ftdetect/rust.vim

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
" vint: -ProhibitAutocmdWithNoGroup
22

33
autocmd BufRead,BufNewFile *.rs call s:set_rust_filetype()
4-
autocmd BufRead,BufNewFile Cargo.toml setf FALLBACK cfg
4+
5+
if has('patch-8.0.613')
6+
autocmd BufRead,BufNewFile Cargo.toml setf FALLBACK cfg
7+
endif
58

69
function! s:set_rust_filetype() abort
710
if &filetype !=# 'rust'

0 commit comments

Comments
 (0)