neocomplcache-snippets-ruby

neocomplcache-snippets-complete のデフォルトのスニペットがものたりなかったので色々と付け加えて書いてみた。
需要があるようであれば github にでも上げたほうがいいかしら?

[ruby.snip]

snippet     if
abbr        if end
    if ${1:condition}
        ${2}
    end

snippet     ifthen
abbr        if then end
    if ${1:condition} then
        ${2}
    end

snippet     ifelse
abbr        if else end
    if ${1:condition}
        ${2}
    else
        ${3}
    end

snippet     _if
abbr        expr if expr
    ${1} if ${2:condition}

snippet     unless
abbr        unless end
    unless ${1:condition}
        ${2}
    end

snippet     unlessthen
abbr        unless then end
    unless ${1:condition} then
        ${2}
    end

snippet     unlesselse
abbr        unless else end
    unless ${1:condition}
        ${2}
    else
        ${3}
    end

snippet     _unless
abbr        expr unless expr
    ${1} unless ${2}

snippet     case 
abbr        case when
    case ${1}
    when ${2:case}
        ${3}
    end

snippet     caseelse
abbr        case when else
    case ${1}
    when ${2:case}
        ${3}
    else
        ${4}
    end

snippet     when
abbr        when
    when ${1:case}
        ${2}

snippet     else
abbr        else
    else
        ${1}

snippet     while
abbr        while end
    while ${1}
        ${2}
    end

snippet     begin
abbr        begin end
    begin
        ${1}
    end

snippet     until
abbr        until end
    until ${1}
        ${2}
    end

snippet     _until
abbr        until end
    ${1} until ${2}

snippet     rescue
abbr        rescue
    ${1} rescue ${2}

snippet     for
abbr        for in end
    for ${1} in ${2}
        ${3}
    end

snippet     class
abbr        class end
    class ${1:name}
        ${2}
    end

snippet     def
abbr        def end
    def ${1:name}
        ${2}
    end

snippet     func
abbr        def end
    def ${1:name}(${2})
        ${3}
    end

snippet     do
abbr        do end
    do
        ${1}
    end

snippet     dovar
abbr        do |var| end
    do |${1:var}|
        ${2}
    end

snippet     doblockvar
abbr        do { |var| }
    do {|${1:var}|
        ${2}
    }

snippet     block
abbr        { |var| }
    {
        ${1}
    }

snippet     blockvar
abbr        { |var| }
    { |${1:var}|
        ${2}
    }

snippet     BEGIN
abbr        BEGIN { }
    BEGIN {
        ${1}
    }

snippet     END
abbr        END { }
    END {
        ${1}
    }

snippet     lambda
abbr        lambda { }
    lambda { ${1} }

snippet     lambdavar
abbr        lambda { | |  }
    lambda { |${1}| ${2} }

snippet     urlencode
    # coding: utf-8
    require 'erb'
    puts ERB::Util.url_encode '${1}'

snippet     req
abbr        require ""
    require "${1}"


1.9 のドキュメントを参照しながら書いたので、もしかしたら 1.8 で使用できないスニペットがあるかも。
(1.9 と 1.8 の具体的な違いはよく知らない。


新しい言語をはじめる時に neocomplcacheスニペットを書くのが習慣になっているのはいい感じですね。
そろそろ Haskell 辺りのスニペットも書きたいなぁー。