This repository was archived by the owner on Sep 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.coffee
More file actions
51 lines (43 loc) · 1.49 KB
/
gulpfile.coffee
File metadata and controls
51 lines (43 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use strict'
gulp = require('gulp')
homePath = require('home-path')()
path = require('path')
$ = require('gulp-load-plugins')()
remotePluginPath = 'rxrc/vimrc'
pluginInit = 'vim -c qall! &>/dev/null'
pluginInstall = 'VIMRC_INSTALL=true vim -c PlugClean! -c qall! &>/dev/null'
pluginUpdate = 'vim -c PlugUpdate -c qall! &>/dev/null'
pluginClean = 'vim -c PlugClean! -c qall! &>/dev/null'
devStrings = [
"call plug#begin($HOME . '/.vim/plugged.dev')"
"Plug '#{path.resolve()}'"
"'' . '#{path.resolve()}/plugins.vim'"
"#{path.resolve()}/plugins.vim"
]
noDevStrings = [
"call plug#begin($HOME . '/.vim/plugged')"
"Plug '#{remotePluginPath}'"
"$HOME . '/.vim/plugged/vimrc/plugins.vim'"
'$HOME/.vim/plugged/vimrc/plugins.vim'
]
gulp.task 'default', ['dev']
gulp.task 'dev', ->
gulp.src("#{homePath}/.vimrc")
.pipe $.replace(noDevStrings[0], devStrings[0])
.pipe $.replace(noDevStrings[1], devStrings[1])
.pipe $.replace(noDevStrings[2], devStrings[2])
.pipe $.replace(noDevStrings[3], devStrings[3])
.pipe gulp.dest(homePath)
.pipe $.shell([
[pluginInstall, pluginClean, pluginUpdate].join('; ')
])
gulp.task 'nodev', ->
gulp.src("#{homePath}/.vimrc")
.pipe $.replace(devStrings[0], noDevStrings[0])
.pipe $.replace(devStrings[1], noDevStrings[1])
.pipe $.replace(devStrings[2], noDevStrings[2])
.pipe $.replace(devStrings[3], noDevStrings[3])
.pipe gulp.dest(homePath)
.pipe $.shell([
[pluginInit, pluginInstall, pluginInit, pluginClean, pluginUpdate].join('; ')
])