Neural Sketch
Integrations

Snippets

Accelerate diagram creation with Neural Sketch's snippet support.

Introduction

Neural Sketch snippets are carefully curated, reusable code templates that streamline your diagram creation process. By reducing repetitive tasks and standardizing common patterns, snippets enable rapid development of publication-ready diagrams.

This guide covers snippet installation, usage, and upcoming developments.

Snippet Engine

Currently, Neural Sketch snippets are delivered using LuaSnip, an efficient and flexible snippet engine optimized for Vim and NeoVim editors.

Example Snippet Usage

Here's an example snippet for quickly creating an nskFigure environment:

% Trigger: nskfig
\begin{nskFigure}[]
  ...
\end{nskFigure}

Typing the trigger (nskfig) followed by expanding the snippet will insert the entire template, significantly speeding up your workflow.

Installation and Setup

To begin using snippets in your NeoVim/Vim environment:

Step 1: Install LuaSnip

Using lazy.nvim or any other plugin manager:

{
  "L3MON4D3/LuaSnip",
  config = function()
    require("luasnip").setup{}
  end
}

Step 2: Load Neural Sketch Snippets

Load snippets by adding the Neural Sketch snippet directory to your LuaSnip configuration:

require("luasnip.loaders.from_lua").lazy_load({ paths = {"path/to/neural-sketch-snippets"} })

Ensure the path matches your local snippet directory.

Future Development Plans

To enhance compatibility and usability, Neural Sketch snippets will soon transition from the native Lua format to the widely supported VS Code JSON snippet format. This change aims to facilitate seamless integration across various editors such as VS Code, Sublime Text, and others.

Upcoming Features

  • VS Code JSON snippets: Ensuring cross-editor compatibility.
  • Extended snippet collection: Increasing coverage for more complex diagram structures and use cases.

Community Contributions

If you would like to share your custom snippets or suggest improvements through our GitHub repository.

Stay informed about snippet updates by following our GitHub discussions or official communication channels.

On this page