code: def autocmd(name, pattern='*', sync=False, allow_nested=False, eval=None):
      
      def dec(f):
          f._nvim_rpc_method_name = 'autocmd:{}:{}'.format(name, pattern)
          f._nvim_rpc_sync = sync
          f._nvim_bind = True
          f._nvim_prefix_plugin_path = True
  
          opts = {
              'pattern': pattern
          }
  
          if eval:
              opts['eval'] = eval
  
          if not sync and allow_nested:
              rpc_sync = "urgent"
          else:
              rpc_sync = sync
  
          f._nvim_rpc_spec = {
              'type': 'autocmd',
              'name': name,
              'sync': rpc_sync,
              'opts': opts
          }
          return f
      return dec
docs: Tag a function or plugin method as a Nvim autocommand handler.