friendly-snippets

repository·main·Indexed 25 days ago

https://github.com/rafamadriz/friendly-snippets

A community-driven collection of VSCode-style snippets for various programming languages, designed for use with Neovim snippet engines such as LuaSnip, vim-vsnip, and coc-snippets.

Tokens
511
Snippets
3
Records
4
Agent score
33%

What's inside friendly-snippets

  1. Configure LuaSnip for friendly-snippets

    main

    If you are using LuaSnip, you must ensure snippets are detected and loaded efficiently. Add friendly-snippets as a dependency and use require("luasnip.loaders.from_vscode").lazy_load() to prevent slow startup times.

    {
      "L3MON4D3/LuaSnip",
      dependencies = { "rafamadriz/friendly-snippets" },
    }
  2. Exclude specific snippets in LuaSnip

    main

    If you want to prevent certain language snippets from loading in LuaSnip, use the exclude option within the VSCode loader.

    -- Exclude all javascript snippets
    require("luasnip.loaders.from_vscode").load {
        exclude = { "javascript" },
    }
  3. Add framework snippets to a filetype

    main

    The repository contains extra snippets for specific frameworks (located in snippets/frameworks) that are not enabled by default. You must use your snippet engine to map these framework snippets to a specific filetype.

    For LuaSnip: Use filetype_extend to add framework snippets to a base filetype.

    For vim-vsnip: Set the g:vsnip_filetypes variable.

  4. Install friendly-snippets

    main

    Install the friendly-snippets collection using your preferred Neovim plugin manager. This collection provides community-driven snippets for various programming languages and is compatible with any snippet engine that supports loading VSCode-style snippets (e.g., vim-vsnip, LuaSnip, coc-snippets).

    ### With Lazy.nvim
    ```lua
    { "rafamadriz/friendly-snippets" }

    With Packer

    use "rafamadriz/friendly-snippets"

    With vim-plug

    Plug "rafamadriz/friendly-snippets"

    With coc.nvim

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