3 ms·
This looks cool but I'd like filetype-independent definitions. For example, to convert a ruby dictionary pasted into a .js file.
by ktusznio 14y ago
This looks cool but I'd like filetype-independent definitions. For example, to convert a ruby dictionary pasted into a .js file.
- AndrewRadev 14y agoWell, in your case, you could put a definition for javascript. The built-in "ruby hash style" transformation should work for this: " in ftplugin/javascript.vim let b:switch_definitions = \ [ \ g:switch_builtins.ruby_hash_style \ ] With this, in a javascript file, you can turn ":foo => 'bar'" entries into "foo: 'bar'" ones. If you do need global (non-filetype) switches, you could define some by placing them in the g:switch_definitions variable. Read up on the docs if you want more information.