新規 .as ファイルを作成時にテンプレートを読み込むようにした

March 19, 2009category: Flash Vim 

空の .as ファイルを開いたときにテンプレートを読み込むようにした。

:he skeleton
:he au

を参考。

Vim スクリプト

au BufRead,BufNewFile *.as call LoadASTemplate()
function! LoadASTemplate()
  if (line("$") == 1) && (match(getline(1), "^$") == 0)
    "Windows
    0r $HOME/vimfiles/templates/template.as
  endif
endfun

テンプレート

package {

  import flash.events.Event;
  import flash.display.MovieClip;

  /**
   *
   *  @author
   */
  public class Hoge extends MovieClip {

    /**
     *  コンストラクタ
     */
    public function Hoge() {
    }
  }
}

comments (0)

comments