Skip to content

nexion-one/plugin-snippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snippets

Global code snippets manager with language tagging, fuzzy search, usage tracking and clipboard copy.

Features

  • Language tags — snippets organised by language, auto-detected from the active file extension
  • Fuzzy search — query across title, language, tags and code body
  • Usage tracking — most-used snippets bubble to the top, with a dedicated section in the sidebar
  • Copy to clipboard — uses pbcopy via process.spawn, then paste with ⌘V
  • Grouped sidebar — snippets rendered as markdown, one section per language, with tag chips and first-line preview
  • Global storage — snippets are shared across all projects (stored as JSON in the plugin data dir)

Commands

Command Shortcut Description
Snippets: Show Panel Focus the sidebar
Snippets: New Snippet ⌘⇧N Guided 4-step flow (title → language → tags → code)
Snippets: Insert Snippet ⌘⇧S Pick a snippet and copy it (auto-filters by current file language)
Snippets: Search ⌘⇧F Type a query, pick from filtered matches
Snippets: Edit Snippet Edit an existing snippet's code
Snippets: Delete Snippet Remove a single snippet
Snippets: Clear All Nuke every snippet (confirmation required)

Storage

~/.nexion/Plugins-Data/com.nexion.official.snippets/snippets.json

Schema:

{
  "version": 1,
  "snippets": [
    {
      "id": "lw3k2b_xa9f1c",
      "title": "Debounce",
      "language": "javascript",
      "tags": ["utility", "performance"],
      "code": "function debounce(fn, ms) { ... }",
      "createdAt": "2026-04-11T10:00:00.000Z",
      "updatedAt": "2026-04-11T10:00:00.000Z",
      "usageCount": 3,
      "lastUsedAt": "2026-04-11T12:30:00.000Z"
    }
  ]
}

Notes on "Insert"

Nexion's editor API is currently read-only (nexion.editor.activeFile and mode), so the plugin cannot insert text directly at the cursor. Instead, Insert Snippet copies the code to the system clipboard via pbcopy — you then press ⌘V.

Once Nexion exposes an insertText / getSelection API, this plugin can be upgraded to true cursor insertion and "save selection as snippet".

Permissions

  • process.spawn — required for clipboard copy via pbcopy

About

Nexion Plugin: snippets

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors