Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lampy.nvim

logo

Neovim remote plugin (Python3) wrapping latex2sympy2 for symbolic LaTeX calculation. Select LaTeX expressions and evaluate or run sympy code — all inline.

lampy.demo.mp4

Inspired by OrangeX4/Latex-Sympy-Calculator.

Installation (lazy.nvim)

{
  "SPLYASHKA/lampy.nvim",
  build = ":UpdateRemotePlugins",
  keys = {
    -- example keymaps, change to your preference
    { "<leader>le", ":LampyEval<CR>",        mode = "x",                 ft = { "markdown", "tex" },    desc = "Lampy eval visual selection" },
    { "<leader>lE", ":LampyEvalReplace<CR>", mode = "x",                 ft = { "markdown", "tex" },    desc = "Lampy eval replace" },
    { "<leader>lf", ":LampyFactor<CR>",      mode = "x",                 ft = { "markdown", "tex" },    desc = "Lampy factor" },
    { "<leader>lx", ":LampyExpand<CR>",      mode = "x",                 ft = { "markdown", "tex" },    desc = "Lampy expand" },
    { "<leader>ld", ":LampyDefineVar<CR>",   mode = "x",                 ft = { "markdown", "tex" },    desc = "Lampy define variable" },
    { "<leader>ln", ":LampyNumerical<CR>",   mode = "x",                 ft = { "markdown", "tex" },    desc = "Lampy numerical" },
    { "<leader>lp", ":LampyPython<CR>",      mode = "x",                 ft = { "markdown", "tex" },    desc = "Lampy python" },
    -- same keys in normal mode for Line variants
    { "<leader>le", ":LampyEvalLine<CR>",        ft = { "markdown", "tex" }, desc = "Lampy eval line" },
    { "<leader>lE", ":LampyEvalReplaceLine<CR>", ft = { "markdown", "tex" }, desc = "Lampy eval replace line" },
    { "<leader>lf", ":LampyFactorLine<CR>",      ft = { "markdown", "tex" }, desc = "Lampy factor line" },
    { "<leader>lx", ":LampyExpandLine<CR>",      ft = { "markdown", "tex" }, desc = "Lampy expand line" },
    { "<leader>ld", ":LampyDefineVarLine<CR>",   ft = { "markdown", "tex" }, desc = "Lampy define variable line" },
    { "<leader>ln", ":LampyNumericalLine<CR>",   ft = { "markdown", "tex" }, desc = "Lampy numerical line" },
    { "<leader>lp", ":LampyPythonLine<CR>",      ft = { "markdown", "tex" }, desc = "Lampy python line" },
    -- variable commands
    { "<leader>ls", ":LampyShowVars<CR>",    ft = { "markdown", "tex" }, desc = "Lampy show variables" },
    { "<leader>lR", ":LampyResetVars<CR>",   ft = { "markdown", "tex" }, desc = "Lampy reset variables" },
  },
}

Commands

Command Action
LampyEval selection ⟶ selection = result
LampyEvalReplace selection ⟶ result
LampyFactor factor selection
LampyExpand expand selection
LampyDefineVar define x = 5 for subsequent evals
LampyNumerical numerical evaluation
LampyPython evaluate Python/sympy code

All visual commands also have a Line variant (e.g. LampyEvalLine) that operates on the current line.

Command Action
LampyShowVars show stored variables
LampyResetVars clear stored variables

Requirements

pip install latex2sympy2 pynvim

After installing, run :UpdateRemotePlugins and restart Neovim. Run :checkhealth lampy to verify.

License

MIT

About

Neovim remote plugin for symbolic LaTeX computation. Select LaTeX expressions and evaluate or run sympy code — all inline. Powered by latex2sympy2.

Resources

Stars

18 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages