Giter VIP home page Giter VIP logo

latex.nvim's Introduction

latex.nvim

An neovim plugin for LaTeX, written in Lua. Although it's simple now, I want to make it as powerful as VimTeX one day.

Installation

-- lazy.nvim
{"dirichy/latex.nvim",
    ft="tex",
    config=function()
        require("latex").setup()
    end
}

Requirements

treesitter for conceal and snip. (Not finished)LuaSnip for snip. (Not finished)nvim-cmp for display desc of snip. plenary.nvim for compile. (now only support arara)arara or latexmk for compile.

Configuration

You can config this plugin by

require("latex").setup(opts)

By now, there is only one field opts.conceal.conceal_tbl can be set manmully. You can set it as

opts={
    conceal={
        conceal_tbl={
            --To conceal generic_command in math
            --highlight is the hightgroup, should begin with "@".
            --condition function(Node,source) -> boolean, onlly match afterwards keys when conditon is true. 
            myfirst_conceal_group = {
                {highlight="@mygroup",condition=require("latex.conditions.query").in_math},
                ["\\test"]="T",
                ["\\Alpha"]="A",
                ["\\mathbb{A}"]="A",
            }
            --To conceal other group, you need to provide query by yourself
            --If you don't set highlight, the default highlight is same as group name
            --condition=nil means no condition. 
            --conceal-table and latexconceal are functions defined in latex/conceal/init.lua to do conceal easily. 
            script = {
                {highlight=nil--equal to highlight="@script"
                query='((script) @script (#conceal-table? @script)(#latexconceal! @script "script")',
                condition=nil}
                ["_1"]="",
            }
            --There are some condition in require("latex.conditions.query"), and you can set condition mamully. 
            --you can put query in a file, too. 
            delim = {
                {
                    highlight="@conceal",
                    query_file="delete"--will load runtimepath/queries/latex/conceal_delete.scm
                }
            }
        }
    }
}

Features

Snips

I don't like let my finger leave the main field of keyboard, so I use autosnip construct by pure alphabet. For now I didn't add my LuaSnips in this plugin, but I will add them later.

Conceals

Almost all of the low-hanging fruit is done as far as concealing; hard things like using tree-sitter for \'e to é are not a priority.

Currently the conceals provided are:

  • Greek: things like \sigma to σ
  • Math: things like \amalg to ⨿
  • Script: superscripts and subscripts
  • Delim: things like \left and many instances of curly braces.
  • Font: things like \mathbb{Z} to

We can use different colors for different conceal, which make our tex file more readable. You can add your own concealed commands to the conceal.conceal_tbl table, see Configuration

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.