Skip to content

Set of preconfigured snippets for different languages.

License

Notifications You must be signed in to change notification settings

PenaflorPhi/friendly-snippets

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Friendly Snippets

Snippets collection for a set of different programming languages for faster development.

The only goal is to have one community driven repository for all kinds of snippets in all programming languages, this way you can have it all in one place.

Usage

This collection of snippets should work with any plugin that supports loading vscode snippets. Like for example:

Add snippets from a framework to a filetype.

There's extra snippets included in this repo but they are not added by default, since it would be irrelevant for people not using those frameworks. See snippets/frameworks

For example: if you want to add rails snippets to ruby.

With LuaSnip:

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:

let g:vsnip_filetypes.ruby = ['rails']

For more info related to this change see #88

Install

Use your plugin manager of choice, e.g.

With Packer

use "rafamadriz/friendly-snippets"

With vim-plug

Plug 'rafamadriz/friendly-snippets'

With coc.nvim

CocInstall https://github.com/rafamadriz/friendly-snippets@main

With Lazy.nvim

PLEASE NOTE: If you're using Lazy, you must add friendly-snippets as an nvim-cmp dependency, otherwise it may be loaded after other plugins. See this issue and this issue for more information. As an example:

return {
  'hrsh7th/cmp-nvim-lsp',
  dependencies = {
	  'rafamadriz/friendly-snippets',
	  'L3MON4D3/LuaSnip',
  },
  config = function()
    -- the rest of your configuration
  end
}

HTML

HTML gif

JS

JS gif

NOTE: Using nvim-compe with vim-vsnip on the videos.

TODO

  • Add all included snippets to the Wiki.

Thanks to all contributors

Credits

A good portion of the snippets have been forked from the following repositories:

About

Set of preconfigured snippets for different languages.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published