Skip to content

Remove deprecated auto-setup and require explicit setup() call #182

@YousefHadder

Description

@YousefHadder

Summary

Remove the deprecated auto-setup mechanism from plugin/markdown-plus.lua and require users to explicitly call setup() via their plugin manager (e.g., opts = {} or config = true in lazy.nvim).

This is a follow-up to #164 and PR #169, which added a deprecation warning for auto-setup in v1.x.

Background

In v1.x, the plugin automatically called setup() when a markdown file was opened, even if the user didn't explicitly configure it. While convenient, this pattern:

  1. Reduces user control - Users should explicitly opt-in to plugin initialization
  2. Causes confusion - The filetypes config option in vim.g.markdown_plus only works if set before plugin load, which is not intuitive
  3. Adds complexity - The plugin loader has to handle edge cases for vim.g.markdown_plus being a table or function

Changes Required

1. Remove auto-setup code from plugin/markdown-plus.lua

Remove the following:

  • get_user_config() function
  • get_filetypes() function
  • The FileType autocmd that triggers auto-setup
  • The deprecation warning

The file should only contain the load guard:

if vim.g.loaded_markdown_plus then
  return
end
vim.g.loaded_markdown_plus = 1

2. Remove vim.g.markdown_plus_setup_called guard

  • Remove the guard variable check from plugin/markdown-plus.lua
  • Remove vim.g.markdown_plus_setup_called = true from lua/markdown-plus/init.lua setup()
  • Remove vim.g.markdown_plus_setup_called = true from spec/minimal_init.lua

3. Update documentation

  • Update README Quick Start to emphasize that opts = {} or config = true is required
  • Update wiki Installation page
  • Update vimdoc (doc/markdown-plus.txt)

4. Update CHANGELOG

Document this as a breaking change in the v2.0 release notes.

Migration Path

Users currently relying on auto-setup will see a deprecation warning in v1.x guiding them to add opts = {} to their plugin spec. By v2.0, they should have already migrated.

Before (v1.x - deprecated):

{
  "yousefhadder/markdown-plus.nvim",
  ft = "markdown",
}

After (v2.0 - required):

{
  "yousefhadder/markdown-plus.nvim",
  ft = "markdown",
  opts = {},
}

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions