Skip to content

LeoSchae/nvim-texlab-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nvim-texlab-tools

Some tooling around the texlab language server and LaTeX.

Requirements

Recommended

Configuration

To use the example keybindings:

require("texlab-tools").setup.with_example_config({
  snippet = "vsnip",
  viewer = "zathura",
  builder = "latexmk"
})

An example config might look like:

  local tex = require("texlab-tools")

  tex.setup({
    -- To use snippets, set either `snippet` or `snippet.expand`.
    snippet = "vsnip", -- "snippy", "luasnip", "vsnip", "ultisnips"

    -- zathura and okular should have working forward and inverse search out of the box!
    viewer = "zathura", -- "zathura", "okular"

    -- builder = "latexmk",
    builder = {
      "latexmk",
      on_save = true,
      forward_search_after = false,
    },

    -- For some possible functions see |TexLab.action| and |TexLab.snippet|.
    mappings = tex.Keymap:new({
      -- table with: ["(input keys)"] = (action)
      ["<F5>"] = tex.action.build(),
      ["<F6>"] = tex.action.forward_search(),
      ["<A-t>"] = tex.action.open_toc({ of = "workspace" }),
      ["<A-a>"] = tex.action.map_environment_names({
        map = {
          ["equation"] = "align",
          ["equation*"] = "align*",
          ["align*"] = "equation*",
          ["align"] = "equation",
        },
        strategy = "first-match",
      }),
      ["<A-s>"] = tex.action.toggle_environment_star({
        only = { "equation", "align" },
        strategy = "first-match",
      }),
    }, {
      { mode = { "i", "n" } }, -- Set mode to apply to all mappings in this table. Default is {"n"}
      -- ["<opts>"] the 4th parameter to |vim.keymap.set()|, default: {}
      ["<A-e>"] = tex.snippet.equation(),
      ["<A-b>"] = tex.snippet.begin_end(),
    }, {
      { mode = "v" },
      -- For now, the following snippets only work with vsnip
      ["<A-e>"] = tex.snippet.surround_selection("equation"),
      ["<A-b>"] = tex.snippet.surround_selection(), -- Same as passing "$1"
    }),
  })

To get more info about the config and features, use:

:h TexLab
:h TexLab.configuration
:h TexLab.action
:h TexLab.snippet
:h TexLab.Keymap

Documentation

To generate the documentation you can use nix with the command nix run .#doc.

TODO

  • Documentation
  • Cleaning up the code
  • Get other viewers working

About

Some tooling around TexLab and LaTeX

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published