wlangstroth / vim-racket

vim bundle for Racket
MIT License
234 stars 60 forks source link

#lang filetype detection is harmful #62

Open dmitrii-ubskii opened 3 years ago

dmitrii-ubskii commented 3 years ago

This needs to be configurable as to which dialects, or at least disableable. As it is now, adding vim-racket removes language support in vim, because what used to at least be recognized as ft=scheme is now ft=sicp or ft=br, which is worse than useless, unless you happen to have the specific plugin.

Temporary workaround for users of vim-plug: Plug 'wlangstroth/vim-racket', { 'do': 'echo au BufRead,BufNewFile *.rkt,*.rktl set filetype=racket > ftdetect/racket.vim' }

benknoble commented 3 years ago

This is at least partially my fault; I advocated for this on the basis that not all *rkt files are actually racket, and the racket syntax shouldn't try to highlight them all.

OTOH, br is now correctly mapped to racket, and it's trivial to add sicp/etc. (My fork adds, for example, info and info/setuptab, which it supports. My fork also supports the new jsond language, but it doesn't need extra configuration precisely because of the new mechanism.)

See g:racket_hash_lang_dict in ftdetect/racket.vim. It would be nicer to merge the user's config with the defaults, but I didn't do that yet as I haven't needed it.

benknoble commented 3 years ago

I've pushed a commit in my fork which supports user overriding much easier. Simply let g:racket_hash_lang_dict = … to install your own overrides, which are merged with some reasonable defaults (user values take precedence).