-
Notifications
You must be signed in to change notification settings - Fork 460
Home
Nicholas O'Kelley edited this page Sep 30, 2023
·
16 revisions
Welcome to the friendly-snippets wiki!
Snippets collection for a set of different programming languages for faster development. This repository has been forked from a couple of VSCode Snippets extensions in addition to individual developers contributions.
As the snippets get individual pages, we will update this list to redirect to them 😎
- CSS, Sass, Less, Stylus
- Gitcommit
- HTML, Pug, Jade
- Latex
- Markdown
- Norg
- Org
- Plantuml
- RMarkdown
- C
- Cobol
- Cpp
- Csharp
- Dart
- eElixir
- Elixir
- Erb
- Erlang
- Fennel
- Fortran
- Glsl
- Go
- Haskell
- Java
- Javascript, Typescript, Javascriptreact, Typescriptreact
- Julia
- Kotlin
- Liquid
- Lua
- Make
- Mint
- Objc
- Php
- Python
- Quarto
- R
- Rescript
- Ruby
- Rust
- Scala
- Shell
- Solidity
- Sql
- Swift
- Verilog
- Django
- Docker
- Docker Compose
- EJS
- Flutter
- Jekyll
- Kubernetes
- Rails
- Svelte
- Vue
- Godot (gdscript)
- Unreal Engine
Below is an example of extending snippets, in particular making JavaScript React available for JavaScript files:
Note: This example uses nvim-cmp
with Luasnip
require("luasnip").filetype_extend("typescript", { "javascript" })
For more specific implementations, see your snippet engines documentation.
-- Snippet Courtesy of @Zeioth,
{
"L3MON4D3/LuaSnip",
build = vim.fn.has "win32" ~= 0 and "make install_jsregexp" or nil,
dependencies = {
"rafamadriz/friendly-snippets",
"benfowler/telescope-luasnip.nvim",
},
config = function(_, opts)
if opts then require("luasnip").config.setup(opts) end
vim.tbl_map(
function(type) require("luasnip.loaders.from_" .. type).lazy_load() end,
{ "vscode", "snipmate", "lua" }
)
-- friendly-snippets - enable standardized comments snippets
require("luasnip").filetype_extend("typescript", { "tsdoc" })
require("luasnip").filetype_extend("javascript", { "jsdoc" })
require("luasnip").filetype_extend("lua", { "luadoc" })
require("luasnip").filetype_extend("python", { "pydoc" })
require("luasnip").filetype_extend("rust", { "rustdoc" })
require("luasnip").filetype_extend("cs", { "csharpdoc" })
require("luasnip").filetype_extend("java", { "javadoc" })
require("luasnip").filetype_extend("c", { "cdoc" })
require("luasnip").filetype_extend("cpp", { "cppdoc" })
require("luasnip").filetype_extend("php", { "phpdoc" })
require("luasnip").filetype_extend("kotlin", { "kdoc" })
require("luasnip").filetype_extend("ruby", { "rdoc" })
require("luasnip").filetype_extend("sh", { "shelldoc" })
end,
},