nvim-cmp-lua-latex-symbols icon indicating copy to clipboard operation
nvim-cmp-lua-latex-symbols copied to clipboard

nvim-cmp source for LaTeX symbols (100% Lua)

nvim-cmp Lua LaTeX Symbols

Contents

  • Preview
  • Introduction
  • Installation
    • packer.nvim
  • Setup
    • Only for certain file types
  • Issues

Preview

Introduction

nvim-cmp Lua LaTeX Symbols is a completion source for nvim-cmp that provides sources for LaTeX symbols. This is especially useful for editing TeX file types. It gets them from this URL: https://milde.users.sourceforge.net/LUCR/Math/data/unimathsymbols.txt. The purpose of this plugin is to provide a 100% Lua alternative to cmp-latex-symbols. cmp-latex-symbols uses Julia code to generate the symbols list, whereas this plugin sticks to Lua instead.

Installation

packer.nvim

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

Setup

The following code block shows the default options.

require "cmp".setup {
    sources = {
        -- The `cache` option is used to determine whether to generate the list
        -- of symbols every time you start Neovim, or if it should be stored in
        -- a cache file to save time. I strongly do not advise changing this
        -- option because the data used for this plugin has not been updated
        -- since 2011.
        { name = "lua-latex-symbols", option = { cache = true } }
    }
}

Only for certain file types

-- Only enable `lua-latex-symbols` for `tex` and `plaintex` file types
require "cmp".setup.filetype({ "tex", "plaintex" }, {
    sources = {
        { name = "lua-latex-symbols"}
    }
})

Issues

  • There are certain instances where you will see two different symbols with the same name. Most of the time, only the first symbol is useful. I plan to remove duplicates in the future.