dartlang-snippets


Ⅰ. 插件描述

UltiSnips snippets for Dart

Ⅱ. 基本信息

创建日期:  2016-01-26
使用用户:  3
Github星:  2
插件作者:  Nate Bosch

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'natebosch/dartlang-snippets'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'natebosch/dartlang-snippets'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'natebosch/dartlang-snippets'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/natebosch/dartlang-snippets

Ⅳ. 文档说明

# UltiSnips snippets for Dart

A collection of snippets for writing Dart. Start by reading about [UltiSnips][]
if you haven't used if before.

Highlights

Some of the snippets that save the most typing.

Dart code

im

Import line. im<tab>some_package becomes
import 'package:some_package/some_package.dart';

for

For-in loop. for<tab>element becomes

for(var element in elements) {
  |
}

try

Try-catch. Most useful from visual mode with a block selected, fills the
selection in the try, then tab to fill out the catch.

asciicast

Methods

Each of these triggers has 2 modes. At the beginning of the line they generate a
top-level/instance method. After other characters they generate a closure.

  • m

    • m<tab>ReturnType<tab>methodName<tab>ArgType argument becomes

      ReturnType methodName(ArgType argument) {
        |
      }
    • After other characters: m<tab>argument becomes

      (argument) {
        |
      }
  • r

    • r<tab>ReturnType<tab>methodName<tab>ArgType argument becomes

    ReturnType methodName(ArgType argument) => |

    • After other characters: r<tab>argument becomes

    (argument) => |

Prepending either trigger with a makes it use 'async mode'. For example, at
the beginning of a line:

ar<tab>ReturnType<tab>methodName<tab>ArgType argument becomes

Future<ReturnType> methodName(ArgType argument) async => |

Angular Snippets

co

A @Component annotation and class. Saves the most time if you follow a naming
convention: a class name SomeName has a selector like some-name, a template
at some_name.html, and styles at some_name.css or some_name.scss.css.
Fills out a default name which works well if this component lives in a file
named some_name.dart.

asciicast

Installation

Install this repository and UltiSnips using your favorite method. If you used
[vim-plug][]:

Plug 'SirVer/Ultisnips'
Plug 'natebosch/dartlang-snippets'

添加新评论