 gulp.task 'watch', ['install'], ->
   $.watch ['./*.vim', './plugin/**/*.vim'], (file) ->
     if file.event is 'unlink' then del(file.path, {force: true})
-    if file.relative is 'plugins.vim' then gulp.src('').pipe installBundle()
+    if file.relative is 'plugins.vim' then gulp.src('').pipe pluginInstall()
   .pipe gulp.dest(pluginPath)

remotePluginPath = 'razor-x/vimrc'
pluginPath = "#{homePath}/.vim/bundle/vimrc"

installBundle = () -> $.shell("sh -c '</dev/tty vim -c PluginUpdate -c quitall'")
cleanBundle = () -> $.shell("sh -c '</dev/tty vim -c PluginClean -c quitall'")

gulp.task 'default', ['watch']


  .pipe gulp.dest(homePath)

  gulp.src('')
  .pipe pluginUpdate()
  .pipe pluginUpdate()
  .pipe pluginClean()

gulp.task 'clean', ->
  del(pluginPath, {force: true})

gulp.task 'install', ['build'], ->
  gulp.src('')
  .pipe pluginInstall()

gulp.task 'build', ['clean'], ->
  gulp.src('plugin/**/*.vim')
