title: Auto format and indent code based on the file extension with different formaters in nvim
body: <p>I have a plugin that autosaves the file. This plugin has hooks like .hook_before_saving etc.
  Here is an example:</p>
  <pre><code>local autosave = require(&quot;autosave&quot;)
  
  autosave.hook_before_saving = function ()
      if &lt;condition&gt; then
          vim.g.auto_save_abort = true -- Save will be aborted
      end
  end
  </code></pre>
  <p>I would like to use different formaters like prettier for javascript or cargo fmt for rust every time the file is autosaved.</p>
  <p>Is it possible?</p>