Giter Site home page Giter Site logo

dart-snippets's Introduction

YASnippets for Dart and Flutter

License GPL 3

This is the complete collection of YASnippets for Dart and its popular framework Flutter. It also features snippets from the VSCode plugin (Dart-Code) and YASnippet-snippets!

Installation

Vanilla Emacs

To use these snippets you need to install the YASnippet package. Once you have YASnippet installed, place contents of this repository on your load path, so Emacs can see it and add the following to your configuration file:

(require 'dart-snippets)

Doom Emacs

As of March 26, these snippets are a part of Doom-snippets package. If you are using it, just update your Doom with doom upgrade and you are good to go.

To install the package on Doom Emacs, all you have to do is to append the lines below to your $DOOMDIR/packages.el (Default is: ~/.doom.d/packages.el).

(package! dart-snippets
    :recipe (:host github
                   :repo "MYDavoodeh/dart-snippets"
                   :files ("*.el" ("snippets" "snippets/*"))))

Usage

To insert a snippet, type its name and press ↹ Tab or C-i.

Also, you can move through the fields pressing ↹ Tab and edit or delete them -- in case snippet has a default value.

Contributions

There are some stylistic conventions:

  • Name files without extensions.

  • Start every file with this preamble:

    # -*- mode: snippet -*-
    # contributor: your name
    # name: readable name of the snippet
    # key: what user needs to enter
    # --
    

    The first line is needed to activate mode for snippet editing in Emacs, Yasnippet ships with it.

  • If the snippet works only in Dart or Flutter, declare its group in your preamble by appending such line as below:

    # group: dart | flutter
    
  • Make sure your files don't have an empty line at the end. This is important, because it will be inserted when your snippet is expanded. snippet-mode takes care of this, setting require-final-newline to nil, just make sure you haven't put it there manually.

Notes

MELPA?

The package is intended to be used with Doom Emacs. Therefore, I don't plan to merge it with YASnippet-snippets nor to add it to MELPA.

Honestly, even if I wanted I cannot add it to MELPA, since the idea of Dart-Snippets is not so original. Also, I didn't want to add them to YASnippet-snippets, because Doom uses Doom-snippets.

Other useful packages

You may also find Dart-Mode and Flutter.el/-Mode packages useful.

You can install the packages above just by uncommenting/adding :lang (dart +flutter) in your $DOOMDIR/init.el (Default is: ~/.doom.d/init.el).

License

Copyright © 2020 Mohammad Yasin Davoodeh

Distributed under GNU GPL, version 3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.