Closed andreyorst closed 5 years ago
First, I think this should enable for racket out of the box. But there are other, weird lispy things, too.
How about a parinfer_filetypes
option?
It would be a little tricky, since either filetype
or parinfer_filetypes
could be set first in a window context, but then you'd just have set-option -add global parinfer_filetypes racket
in your config section.
First, I think this should enable for racket out of the box. But there are other, weird lispy things, too.
I think it's not. There are too many dialects, so a generic method for enabling or disabling parinfer for current mode is a better option.
How about a parinfer_filetypes option?
Why not to make a command that sets window local hooks for parinfer and let users configure filetypes by hooks? E.g. I have several plugins that do this, for example smarttab.kak
configuration:
hook global WinSetOption filetype=(rust|markdown|kak|lisp|scheme|sh|perl) expandtab
hook global WinSetOption filetype=(makefile|gas) noexpandtab
hook global WinSetOption filetype=(c|cpp) smarttab
Or, tagbar.kak
configuration:
hook global WinSetOption filetype=(c|cpp|rust|gas) tagbar-enable
This way user will be able to just do:
hook global WinSetOption filetype=(racket|arc-lisp) %{ parinfer-enable-buffer -smart }
hook global WinSetOption filetype=(scheme) %{ parinfer-enable-buffer -indent }
OK, you've convinced me.
I can create PR if you sort on time!)
That would be awesome!
In order to have parinfer for racket language I have to install kakoune-racket and add such configuration to my kakrc:
Basically copying your hooks from
rc/
. Maybe put those into functionparinfer-enable -params 1
that accepts amode
as a parameter? Andparinfer-disable
will remove the hooks.after that user will able to define it's own hooks in configuration for only filetypes they need.