diff --git a/README.md b/README.md index 3d9426ea..0ac439f3 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,29 @@ vscode snippets. Like for example: - [LuaSnip](https://github.com/L3MON4D3/LuaSnip) - [coc-snippets](https://github.com/neoclide/coc-snippets) +### Add snippets from a framework to a filetype. + +There's extra snippets included in this repo but they are not added default, +since it would irrelevant for people not using those frameworks. See `[snippets/frameworks]()` + +For example: if you want to add rails snippets to ruby. + +With LuaSnip: + +```lua +require'luasnip'.filetype_extend("ruby", {"rails"}) +``` + +This method is going to work globally on all open buffers with `ruby` filetype. +Alternatively you can do `set filetype=ruby.rails` so it only works on a +specific buffer, but this is going to mess up with syntax highlighting. + +With vim-vsnip: + +```viml +let g:vsnip_filetypes.rails = ['ruby'] +``` + ### Install Use your plugin manager of choice, e.g. diff --git a/package.json b/package.json index 2ad35ac4..571068ef 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,8 @@ "path": "./snippets/gitcommit.json" }, { - "language": "html", - "path": "./snippets/ejs.json" + "language": "ejs", + "path": "./snippets/frameworks/ejs.json" }, { "language": "eruby", @@ -90,8 +90,8 @@ "path": "./snippets/ruby.json" }, { - "language": "ruby", - "path": "./snippets/rails.json" + "language": "rails", + "path": "./snippets/frameworks/rails.json" }, { "language": "rust", @@ -225,16 +225,12 @@ "path": "./snippets/python/unittest.json" }, { - "language": "python", - "path": "./snippets/python/tkinter.json" - }, - { - "language": "dart", - "path": "./snippets/flutter.json" + "language": "flutter", + "path": "./snippets/frameworks/flutter.json" }, { - "language": "markdown", - "path": "./snippets/jekyll/vscode-jekyll-snippets.json" + "language": "jekyll", + "path": "./snippets/frameworks/jekyll.json" }, { "language": "cobol", @@ -276,7 +272,7 @@ }, { "language": "twig", - "path": "./snippets/twig.json" + "path": "./snippets/frameworks/twig.json" }, { "language": [ diff --git a/snippets/ejs.json b/snippets/frameworks/ejs.json similarity index 100% rename from snippets/ejs.json rename to snippets/frameworks/ejs.json diff --git a/snippets/flutter.json b/snippets/frameworks/flutter.json similarity index 100% rename from snippets/flutter.json rename to snippets/frameworks/flutter.json diff --git a/snippets/jekyll/vscode-jekyll-snippets.json b/snippets/frameworks/jekyll.json similarity index 100% rename from snippets/jekyll/vscode-jekyll-snippets.json rename to snippets/frameworks/jekyll.json diff --git a/snippets/rails.json b/snippets/frameworks/rails.json similarity index 100% rename from snippets/rails.json rename to snippets/frameworks/rails.json diff --git a/snippets/twig.json b/snippets/frameworks/twig.json similarity index 100% rename from snippets/twig.json rename to snippets/frameworks/twig.json