Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hkupty/classifier.nvim

Filetype to/from extension mapping
https://github.com/hkupty/classifier.nvim

Last synced: about 2 months ago
JSON representation

Filetype to/from extension mapping

Awesome Lists containing this project

README

        

# classifier.nvim

## Why?

This is a very, *very* simple mapping of `ft` to file extension and the other way around.
Should be used by plugin authors or users to glue together commands/plugins.

## Caveats

Filetype to extensions is faster than extension to filetype. In order to avoid duplication, the extensions list is lazily populated.

## Usage

```lua
local classifier = require("classifier")

-- Sample usage
local icons = require("nvim-web-devicons")

icons.get_icon(filename, classifier.ext(vim.bo.ft)[1])

-- another example
vim.fn.systemlist("rg --vimgrep -g '*.{" .. table.concat(classifier.fts(ft), ",") .. "}' -- " .. some_search)
```