plugins.luasnip.settings

Options provided to the require('luasnip').config.setup function.

Type: attribute set of anything

Default: { }

Example:

{
  enable_autosnippets = true;
  exit_roots = false;
  keep_roots = true;
  link_roots = true;
  update_events = [
    "TextChanged"
    "TextChangedI"
  ];
}

Declared by:

plugins.luasnip.settings.enable_autosnippets

Autosnippets are disabled by default to minimize performance penalty if unused. Set to true to enable.

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by:

plugins.luasnip.settings.cut_selection_keys

Mapping for populating TM_SELECTED_TEXT and related variables (not set by default).

Type: null or string or raw lua code

Default: null

Plugin default: lib.nixvim.mkRaw "nil"

Declared by:

plugins.luasnip.settings.delete_check_events

When to check if the current snippet was deleted, and if so, remove it from the history. Off by default.

Type: null or string or list of string or raw lua code

Default: null

Plugin default: lib.nixvim.mkRaw "nil"

Declared by:

plugins.luasnip.settings.exit_roots

Whether snippet-roots should exit at reaching at their last node, $0. This setting is only valid for root snippets, not child snippets. This setting may avoid unexpected behavior by disallowing to jump earlier (finished) snippets.

Type: null or boolean or raw lua code

Default: null

Plugin default: true

Declared by:

plugins.luasnip.settings.ext_base_prio

Base priority for extmarks.

Type: null or signed integer or floating point number or raw lua code

Default: null

Plugin default: 200

Declared by:

plugins.luasnip.settings.ext_opts

Additional options passed to extmarks. Can be used to add passive/active highlight on a per-node-basis.

Type: null or (attribute set of ((attribute set of attribute set of anything) or raw lua code))

Default: null

Plugin default:

{
  "types.choiceNode" = {
    active = {
      hl_group = "LuasnipChoiceNodeActive";
    };
    passive = {
      hl_group = "LuasnipChoiceNodePassive";
    };
    snippet_passive = {
      hl_group = "LuasnipChoiceNodeSnippetPassive";
    };
    unvisited = {
      hl_group = "LuasnipChoiceNodeUnvisited";
    };
    visited = {
      hl_group = "LuasnipChoiceNodeVisited";
    };
  };
  "types.dynamicNode" = {
    active = {
      hl_group = "LuasnipDynamicNodeActive";
    };
    passive = {
      hl_group = "LuasnipDynamicNodePassive";
    };
    snippet_passive = {
      hl_group = "LuasnipDynamicNodeSnippetPassive";
    };
    unvisited = {
      hl_group = "LuasnipDynamicNodeUnvisited";
    };
    visited = {
      hl_group = "LuasnipDynamicNodeVisited";
    };
  };
  "types.exitNode" = {
    active = {
      hl_group = "LuasnipExitNodeActive";
    };
    passive = {
      hl_group = "LuasnipExitNodePassive";
    };
    snippet_passive = {
      hl_group = "LuasnipExitNodeSnippetPassive";
    };
    unvisited = {
      hl_group = "LuasnipExitNodeUnvisited";
    };
    visited = {
      hl_group = "LuasnipExitNodeVisited";
    };
  };
  "types.functionNode" = {
    active = {
      hl_group = "LuasnipFunctionNodeActive";
    };
    passive = {
      hl_group = "LuasnipFunctionNodePassive";
    };
    snippet_passive = {
      hl_group = "LuasnipFunctionNodeSnippetPassive";
    };
    unvisited = {
      hl_group = "LuasnipFunctionNodeUnvisited";
    };
    visited = {
      hl_group = "LuasnipFunctionNodeVisited";
    };
  };
  "types.insertNode" = {
    active = {
      hl_group = "LuasnipInsertNodeActive";
    };
    passive = {
      hl_group = "LuasnipInsertNodePassive";
    };
    snippet_passive = {
      hl_group = "LuasnipInsertNodeSnippetPassive";
    };
    unvisited = {
      hl_group = "LuasnipInsertNodeUnvisited";
    };
    visited = {
      hl_group = "LuasnipInsertNodeVisited";
    };
  };
  "types.snippetNode" = {
    active = {
      hl_group = "LuasnipSnippetNodeActive";
    };
    passive = {
      hl_group = "LuasnipSnippetNodePassive";
    };
    snippet_passive = {
      hl_group = "LuasnipSnippetNodeSnippetPassive";
    };
    unvisited = {
      hl_group = "LuasnipSnippetNodeUnvisited";
    };
    visited = {
      hl_group = "LuasnipSnippetNodeVisited";
    };
  };
  "types.textNode" = {
    active = {
      hl_group = "LuasnipTextNodeActive";
    };
    passive = {
      hl_group = "LuasnipTextNodePassive";
    };
    snippet_passive = {
      hl_group = "LuasnipTextNodeSnippetPassive";
    };
    unvisited = {
      hl_group = "LuasnipTextNodeUnvisited";
    };
    visited = {
      hl_group = "LuasnipTextNodeVisited";
    };
  };
}

Declared by:

plugins.luasnip.settings.ext_prio_increase

Priority increase for extmarks.

Type: null or signed integer or floating point number or raw lua code

Default: null

Plugin default: 9

Declared by:

plugins.luasnip.settings.ft_func

Source of possible filetypes for snippets. Defaults to a function, which returns vim.split(vim.bo.filetype, “.”, true), but check filetype_functions or the Extras-Filetype-Functions-section for more options.

Type: null or raw lua code

Default: null

Plugin default: lib.nixvim.mkRaw "require(\"luasnip.extras.filetype_functions\").from_filetype\n"

Declared by:

plugins.luasnip.settings.keep_roots

Whether snippet-roots should be linked.

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by:

Whether children should be linked.

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by:

Whether snippet-roots should be linked.

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by:

plugins.luasnip.settings.load_ft_func

Function to determine which filetypes belong to a given buffer (used for lazy_loading). fn(bufnr) -> filetypes (string[]). Again, there are some examples in filetype_functions.

Type: null or raw lua code

Default: null

Plugin default: lib.nixvim.mkRaw "require(\"luasnip.extras.filetype_functions\").from_filetype_load\n"

Declared by:

plugins.luasnip.settings.loaders_store_source

Whether loaders should store the source of the loaded snippets. Enabling this means that the definition of any snippet can be jumped to via Extras-Snippet-Location, but also entails slightly increased memory consumption (and load-time, but it’s not really noticeable).

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by:

plugins.luasnip.settings.parser_nested_assembler

Override the default behavior of inserting a choiceNode containing the nested snippet and an empty insertNode for nested placeholders.

Type: null or raw lua code

Default: null

Plugin default: lib.nixvim.mkRaw "function(pos, snip)\n local iNode = require(\"luasnip.nodes.insertNode\")\n local cNode = require(\"luasnip.nodes.choiceNode\")\n\n modify_nodes(snip)\n snip:init_nodes()\n snip.pos = nil\n\n return cNode.C(pos, { snip, iNode.I(nil, { \"\" }) })\nend\n"

Declared by:

plugins.luasnip.settings.region_check_events

Events on which to leave the current snippet-root if the cursor is outside its’ ‘region’. Disabled by default.

Type: null or string or list of string or raw lua code

Default: null

Plugin default: lib.nixvim.mkRaw "nil"

Declared by:

plugins.luasnip.settings.update_events

Choose which events trigger an update of the active nodes’ dependents.

Type: null or string or list of string or raw lua code

Default: null

Plugin default: "InsertLeave"

Declared by: