# Add Custom Snippets in Vim ## Metadata **Status**:: #x **Zettel**:: #zettel/permanent **Created**:: [[2023-07-29]] **Topic**:: [[♯ Vim]] ## Synopsis Create a folder `SNIPPETS_ROOT`: ``` SNIPPETS_ROOT ┠── package.json ┖── snippets ┠── global.code-snippets ┖── rust.json ``` [LuaSnip DOC ➤ VS-Code](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md#vs-code) ### LazyVim ```lua { "L3MON4D3/LuaSnip", dependencies = { { -- load SNIPPETS_ROOT as a package "doitian/x-snippets", name = "x-snippets", dir = "SNIPPETS_ROOT", }, }, } ``` ### Vim with hrsh7th/vim-vsnip ```vimscript let g:vsnip_snippet_dir = "SNIPPETS_ROOT/snippets" exec 'set rtp+='..fnamemodify(g:vsnip_snippet_dir, ':h') ``` ### VS Code Link `SNIPPETS_ROOT/snippets` to the snippets directory in Code config directory.