Skip to content

zknx/cmp-danbooru-tags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmp-danbooru-tags

A completion source for nvim-cmp that provides autocompletion for Danbooru tags. Inspired by ComfyUI-Custom-Scripts#Autocomplete.

Installation and Configuration

lazy.nvim

{
    "hrsh7th/nvim-cmp",
    dependencies = {
        -- ... other dependencies
        {
            "zknx/cmp-danbooru-tags",
            config = true,
        },
    }
}

Then, enable the source in your nvim-cmp setup and configure the options as needed.

require("cmp").setup({
    sources = {
        -- ... other sources
        {
            name = "danbooru-tags",
            --- @type CmpDanbooruTags.Option
            option = {             -- These values are default so re-define them only if you wanna change it.
                max_tags = -1,     -- Max number of tags to read from the CSV file, it sorted by usage count (-1 for all).
                max_results = 100, -- Max number of completion results to show at once, recommended lower number cz there are 170k+ tags.
            }
        },
    },
})

Usage

1. Download the Tag Database

Run the following command in Neovim to download the tag CSV file.

:CmpDanbooruTags install

You can also provide a different URL: :CmpDanbooruTags install <url>

Note: This plugin is designed to parse the specific CSV format provided by the default URL. It relies on a tag,category,count,aliases structure. If the format of the source file changes in the future, or if you use a custom URL with a different structure, the plugin may not work correctly.

2. Enable Completion

Completion is disabled by default. Use the following commands to enable it for the current buffer.

  • :CmpDanbooruTags enable: Enables completion.
  • :CmpDanbooruTags disable: Disables completion.
  • :CmpDanbooruTags toggle: Toggles the enable/disable state.

Once enabled, simply start typing in insert mode, and Danbooru tag suggestions will appear.


Acknowledgements

The tag data used by this plugin is sourced from the dbr-e621-lists-archive project by DraconicDragon.

The default download URL is: https://raw.githubusercontent.com/DraconicDragon/dbr-e621-lists-archive/main/tag-lists/danbooru/danbooru_2025-07-05_pt20-ia-dd.csv

About

nvim-cmp source for Danbooru tags. Inspired by ComfyUI-Custom-Scripts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages