Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/amarz45/nvim-cmp-fonts

Neovim completion for fonts installed on the system
https://github.com/amarz45/nvim-cmp-fonts

fontconfig fonts lua neovim neovim-plugin nvim-cmp nvim-plugin

Last synced: 1 day ago
JSON representation

Neovim completion for fonts installed on the system

Awesome Lists containing this project

README

        

---
title: nvim-cmp-fonts
output: amaryaml::github
---

# Preview

![](preview.gif)

# Introduction

nvim-cmp-fonts is a completion source for
[nvim-cmp](https://github.com/hrsh7th/nvim-cmp) that provides sources for fonts.
This is especially useful for editing
[configuration](#only-for-certain-file-types) file types. It gets them from the
fonts installed on your computer, which you can see by using the `fc-list`
command. Every time you open Neovim, the list of fonts is updated.

# Dependencies

* fontconfig

# Installation

## [packer.nvim](https://github.com/wbthomason/packer.nvim)

```lua
require "packer".startup(function(use)
use "amarakon/nvim-cmp-fonts"
end)
```

# Setup

The following code block shows the default options.

```lua
require "cmp".setup {
sources = {
-- Most font names have spaces in them. However, nvim-cmp restarts the
-- completion after a space, disallowing you to complete a font name
-- with spaces. The `space_filter` option is a way to get around this by
-- using a different character to represent spaces. If you wish, you can
-- set this option to a space character, but you know the downside of
-- that.
{ name = "fonts", option = { space_filter = "-" } }
}
}
```

## Only for certain file types

```lua
-- Only enable `fonts` for `conf` and `config` file types
require "cmp".setup.filetype({ "conf", "config" },
{ sources = { { name = "fonts"} } })
```