1
1
Fork
You've already forked yasp.nvim
0
a simple completion agnostic snippet managment neovim plugin
  • Lua 100%
2026年04月06日 18:58:52 +03:00
doc feat: make sortText a user option 2026年04月06日 18:55:18 +03:00
lua/yasp feat: make sortText a user option 2026年04月06日 18:55:18 +03:00
.editorconfig feat: initial commit 2025年02月08日 23:34:18 +02:00
.gitignore feat: initial commit 2025年02月08日 23:34:18 +02:00
.luacheckrc feat: initial commit 2025年02月08日 23:34:18 +02:00
.stylua.toml feat: initial commit 2025年02月08日 23:34:18 +02:00
LICENSE feat: initial commit 2025年02月08日 23:34:18 +02:00
README.md feat(readme): add vim.pack installation instructions 2026年04月06日 18:58:52 +03:00

yasp.nvim

yasp is a simple way to manage your snippets in a completion engine agnostic way. Thus it enables you to use jump around completion frameworks and snippet engines like mini.snippets with ease, even native autocompletion for the 0.11 users.

The plugin is designed to manage multiple snippet sources such as friendly-snippets and user defined. It shall be noted that yasp manages only LSP/vscode/json snippets, therefore fancy lua snippets are not supported. At last, you must configure some basic functionality for yourself, mainly the package.json paths.

2025年02月13日T23-42-14

⚒️ Configuration

Here is some example configuration, for lazy.nvim, please note that the user has to specify some options in order to use it:

 {
 'DimitrisDimitropoulos/yasp.nvim',
 -- lazy loading is not required, since it is handled internally
 lazy = false,
 -- if you persist on lazy loading you must call the setup function on InsertEnter
 -- event = 'InsertEnter',
 opts = {
 -- default, change to false for special completion frameworks
 -- long_desc = true,
 -- default, change to true mainly for debugging
 -- prose = false,
 -- default, the time to wait before starting a new server in milliseconds, highly suggested to keep it
 -- debounce = 750,
 -- default, global triggerChars to fire lsp completion
 -- trigger_chars = {
 -- ['*'] = { '{', '(', '[', ' ', '.', ':', ',' },
 -- -- for native autocompletion you can use this setting for better experience:
 -- ['*'] = { '' },
 -- -- append them per filetype in such style
 -- -- ['lua'] = { '.', ':' },
 -- },
 -- default, sortText for completion items
 -- For native autocompletion, prefer "0.1" for better sorting experience
 -- sort_text = "1.02",
 -- 💀 WARNING: the following must be provided by the user
 -- the paths to the package.json files, no default given, must be provided
 paths = {
 -- for friendly-snippets installed via lazy.nvim
 vim.fn.stdpath 'data' .. '/lazy/friendly-snippets/package.json',
 -- for vim.pack users
 vim.fn.stdpath 'data' .. '/site/pack/core/opt/friendly-snippets/package.json',
 -- for snippets in the users config directory
 vim.fn.expand('$MYVIMRC'):match '(.*[/\\])' .. 'snippets/path/to/package.json',
 },
 -- the accompanying descriptions for the paths, no default given, must be provided
 descs = { 'FR', 'USR' },
 },
 },

For vim.pack users you can setup the plugin like this:

vim.pack.add { 'https://github.com/DimitrisDimitropoulos/yasp.nvim' }
require('yasp').setup {
 -- default, change to false for special completion frameworks
 -- long_desc = true,
 -- default, change to true mainly for debugging
 -- prose = false,
 -- default, the time to wait before starting a new server in milliseconds, highly suggested to keep it
 -- debounce = 750,
 -- default, global triggerChars to fire lsp completion
 -- trigger_chars = {
 -- ['*'] = { '{', '(', '[', ' ', '.', ':', ',' },
 -- -- for native autocompletion you can use this setting for better experience:
 -- ['*'] = { '' },
 -- -- append them per filetype in such style
 -- -- ['lua'] = { '.', ':' },
 -- },
 -- default, sortText for completion items
 -- For native autocompletion, prefer "0.1" for better sorting experience
 -- sort_text = "1.02",
 -- 💀 WARNING: the following must be provided by the user
 -- the paths to the package.json files, no default given, must be provided
 paths = {
 -- for friendly-snippets installed via lazy.nvim
 vim.fn.stdpath 'data' .. '/lazy/friendly-snippets/package.json',
 -- for vim.pack users
 vim.fn.stdpath 'data' .. '/site/pack/core/opt/friendly-snippets/package.json',
 -- for snippets in the users config directory
 vim.fn.expand('$MYVIMRC'):match '(.*[/\\])' .. 'snippets/path/to/package.json',
 },
 -- the accompanying descriptions for the paths, no default given, must be provided
 descs = { 'FR', 'USR' },
}

For other plugin managers you can setup and initiate the plugin via a call to:

require('yasp').setup {
 -- same options as above
}

🧰 Fixing Problems

In case you encounter any issues there are two integrated mechanisms to help you tackle them. Firstly, if you have problem locating your package.json running :checkhealth yasp can you help you. Moreover, if you have something else you can turn on prose, which will give you notifications to dial down server initialization and termination and on checkhealth will breakdown for you the snippets for the active buffers filetype, in order to tackle snippet specific problems.

🗺 Architecture

For anyone interested the plugin is based upon neovim's in-process language servers. The main inspiration was this article and the tests for this completion plugin.