Skip to content

Commit

Permalink
:setf FALLBACK is not available in older versions (#346)
Browse files Browse the repository at this point in the history
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 #345
  • Loading branch information
mhinz authored and chris-morgan committed Aug 30, 2019
1 parent f45cdae commit e99f3f5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ftdetect/rust.vim
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
" vint: -ProhibitAutocmdWithNoGroup

autocmd BufRead,BufNewFile *.rs call s:set_rust_filetype()
autocmd BufRead,BufNewFile Cargo.toml setf FALLBACK cfg

if has('patch-8.0.613')
autocmd BufRead,BufNewFile Cargo.toml setf FALLBACK cfg
endif

function! s:set_rust_filetype() abort
if &filetype !=# 'rust'
Expand Down

0 comments on commit e99f3f5

Please sign in to comment.