Well, 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.
Comments
This looks cool but I'd like filetype-independent definitions. For example, to convert a ruby dictionary pasted into a .js file.
Well, in your case, you could put a definition for javascript. The built-in "ruby hash style" transformation should work for this:
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.