Skip to content
On this page

代码片段

Luasnip

NvChad 使用 luasnip 插件来处理片段,默认情况下它使用friendly-snippets插件,该插件提供多种语言的代码片段。

全局配置

这些是用于定义代码片段相关的全局变量,你可以把它们放在custom/init.lua文件中。

lua
-- vscode format i.e json files
vim.g.vscode_snippets_path = "your snippets path"

-- snipmate format 
vim.g.snipmate_snippets_path = "your snippets path"

-- lua format 
vim.g.lua_snippets_path = vim.fn.stdpath "config" .. "/lua/custom/lua_snippets"

上面的代码是个示例,其中我们首先获取nvim config 的路径,然后添加我们的自定义代码片段目录。

Powered by VitePress