Code Monkey home page Code Monkey logo

luasnip-latex-snippets.nvim's Introduction

luasnip-latex-snippets

A port of Gilles Castel's snippets for the LuaSnip Engine.

Why?

UltiSnips felt unbearably slow. See neovim/neovim#7063 and https://github.com/SirVer/ultisnips/issues?q=label%3A%22neovim+only%22+is%3Aclosed.

Installation

Depends on vimtex to determine if the cursor is within math mode. Alternatively, you can use nvim-treesitter (experimental) by passing { use_treesitter = true } to the setup call.

Can be installed like any neovim plugin. If using wbthomason/packer.nvim:

use {
  "iurimateus/luasnip-latex-snippets.nvim",
  -- replace "lervag/vimtex" with "nvim-treesitter/nvim-treesitter" if you're
  -- using treesitter.
  requires = { "L3MON4D3/LuaSnip", "lervag/vimtex" },
  config = function()
    require'luasnip-latex-snippets'.setup()
    -- or setup({ use_treesitter = true })
  end,
  -- treesitter is required for markdown
  ft = { "tex", "markdown" },
}

Misc

The following convention, from SirVer/ultisnips, is used for naming lua tables and respective files:

A: Automatic snippet expansion - snippets will activate as soon as their trigger
matches.

w: Word boundary - With this option the snippet trigger will match when the
trigger is a word boundary character. This is the default behavior.

b: Beginning of line expansion - A snippet with this option is expanded only if
the trigger is the first word on the line (i.e., only whitespace precedes the
trigger).

Note that the regex term used in LuaSnip is misleading: it is not a POSIX regexp. What's actually being used is Lua pattern matching, which has some limitations. In particular, it lacks positive lookbehind and alternation |. The first which is used in postfix completions (e.g. match delta, but not \delta) and can be handled with simple functions. The second was solved by splitting and/or partially rewriting the expressions.

Adding your own snippets / overrides

See discussion iurimateus#3

Roadmap

  • Tests

luasnip-latex-snippets.nvim's People

Contributors

iurimateus avatar sycx2 avatar

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.