-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vixrc
179 lines (156 loc) · 8.69 KB
/
.vixrc
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
" ;-----------------------------------------------------------------------------
" ; Local VIM Project Configuration File
" ;-----------------------------------------------------------------------------
" ;-----------------------------------------------------------------------------
" ; Project Settings
" ;-----------------------------------------------------------------------------
let g:vix_current_project.root = g:localvimrc_script_dir
let g:vix_current_project.name = 'price-table-data'
let g:vix_current_project.exec = 'index.js'
" ;-----------------------------------------------------------------------------
" ; Make (tmux/shell).
" ;-----------------------------------------------------------------------------
let g:vix_current_project.command.make.prefix =
\ 'echo "{prefix} No <make> rules defined." &&'
let g:vix_current_project.command.make.body =
\ 'echo "{prefix} No <make> rules defined." &&'
let g:vix_current_project.command.make.postfix =
\ 'echo "{prefix} No <make> rules defined."'
" ;-----------------------------------------------------------------------------
" ; Build (tmux/shell).
" ;-----------------------------------------------------------------------------
let g:vix_current_project.command.build.prefix =
\ 'echo "{prefix} No <build> rules defined." &&'
let g:vix_current_project.command.build.body =
\ 'echo "{body} No <build> rules defined." &&'
let g:vix_current_project.command.build.postfix =
\ 'echo "{postfix} No <build> rules defined."'
" ;-----------------------------------------------------------------------------
" ; Clean (tmux/shell).
" ;-----------------------------------------------------------------------------
let g:vix_current_project.command.clean.prefix =
\ 'echo "{prefix} No <clean> rules defined." &&'
let g:vix_current_project.command.clean.body =
\ 'echo "{body} No <clean> rules defined." &&'
let g:vix_current_project.command.clean.postfix =
\ 'echo "{postfix} No <clean> rules defined."'
" ;-----------------------------------------------------------------------------
" ; Test (tmux/shell).
" ;-----------------------------------------------------------------------------
let g:vix_current_project.command.test.prefix =
\ 'echo "{prefix} No <test> rules defined." &&'
let g:vix_current_project.command.test.body =
\ 'echo "{body} No <test> rules defined." &&'
let g:vix_current_project.command.test.postfix =
\ 'echo "{postfix} No <test> rules defined."'
" ;-----------------------------------------------------------------------------
" ; Run (tmux/shell).
" ;-----------------------------------------------------------------------------
let g:vix_current_project.command.run.prefix =
\ ''
let g:vix_current_project.command.run.body =
\ 'npx babel-node % && printf "done\n"'
let g:vix_current_project.command.run.postfix =
\ ''
" //////////////////////////////////////////////////////////////////////////////
" ;-----------------------------------------------------------------------------
" ; Make (vim-dispatch), F9
" ;-----------------------------------------------------------------------------
" First check for a "make.sh" script.
if filereadable(g:vix_current_project.root . '/make.sh')
let g:vix_current_project.dispatch.make.args = 'cd ' .
\ g:vix_current_project.root . '; ' . './make.sh'
" If the "make.sh" is not present, continue with the internal call.
else
let g:vix_current_project.dispatch.make.args =
\ '-dir='. g:vix_current_project.root . ' echo "{make.args} No <make> rules defined."; sleep 2'
endif
" ;-----------------------------------------------------------------------------
" ; Build (vim-dispatch), F5
" ;-----------------------------------------------------------------------------
" First check for a "build.sh" script.
if filereadable(g:vix_current_project.root . '/build.sh')
let g:vix_current_project.dispatch.build.args = 'cd ' .
\ g:vix_current_project.root . '; ' . './build.sh'
" If the "build.sh" is not present, continue with the internal call.
else
let g:vix_current_project.dispatch.build.args =
\ '-dir='. g:vix_current_project.root . ' npm run build'
endif
" ;-----------------------------------------------------------------------------
" ; Clean (vim-dispatch), F11
" ;-----------------------------------------------------------------------------
" First check for a "clean.sh" script.
if filereadable(g:vix_current_project.root . '/clean.sh')
let g:vix_current_project.dispatch.clean.args = 'cd ' .
\ g:vix_current_project.root . '; ' . './clean.sh'
" If the "clean.sh" is not present, continue with the internal call.
else
let g:vix_current_project.dispatch.clean.args =
\ '-dir='. g:vix_current_project.root . ' npm run clean'
endif
" ;-----------------------------------------------------------------------------
" ; Test (vim-dispatch), F8
" ;-----------------------------------------------------------------------------
" First check for a "test.sh" script.
if filereadable(g:vix_current_project.root . '/test.sh')
let g:vix_current_project.dispatch.test.args = 'cd ' .
\ g:vix_current_project.root . '; ' . './test.sh'
" If the "test.sh" is not present, continue with the internal call.
else
let g:vix_current_project.dispatch.test.args =
\ '-dir='. g:vix_current_project.root . ' npm run test'
endif
" ;-----------------------------------------------------------------------------
" ; Run (vim-dispatch), F10
" ;-----------------------------------------------------------------------------
" First check for a "run.sh" script.
if filereadable(g:vix_current_project.root . '/run.sh')
let g:vix_current_project.dispatch.run.args = 'cd ' .
\ g:vix_current_project.root . '; ' . './run.sh'
" If the "run.sh" is not present, continue with the internal call.
else
let g:vix_current_project.dispatch.run.args =
\ '-dir='. g:vix_current_project.root . ' -cwd npm run start:development'
endif
" Custom Commands
" Custom Deploy (F6)
" nnoremap <F6> :execute 'Start -title=deploy -dir=' . g:vix_current_project.root . ' ' . 'npm run start:production'<CR>
" Spawn an independent runner with a custom command.
let g:vix_current_project.custom_deploy_command = 'Start -title=deploy -dir=' . g:vix_current_project.root . ' ' .
\ 'npm run start:production'
\ . ' '. 'sleep 1'
nnoremap <F6> :execute g:vix_current_project.custom_deploy_command<CR>
vnoremap <F6> <Esc>:execute g:vix_current_project.custom_deploy_command<CR>
inoremap <F6> <Esc>:execute g:vix_current_project.custom_deploy_command<CR>
" Custom Make (F4)
" Spawn an independent runner with a custom command.
" nnoremap <F4> :execute 'Start -title=_make_' . g:vix_current_project.dispatch.make.args<CR>
let g:vix_current_project.custom_make_command = 'Start -title=make -dir=' . g:vix_current_project.root . ' ' .
\ g:vix_current_project.dispatch.make.args
nnoremap <F4> :execute g:vix_current_project.custom_make_command<CR>
vnoremap <F4> <Esc>:execute g:vix_current_project.custom_make_command<CR>
inoremap <F4> <Esc>:execute g:vix_current_project.custom_make_command<CR>
" Custom Execute (F3)
" This section sets up the single file runner. This is useful for cases where
" we would like to test and run a single node.js file. This is an alternative
" to the tmux based runner and relies on nodemon for continous execution. The
" tmux based runner will just fire-up a run call without relying on nodemon.
" Please note that the tmux runner will still need to go through babel-node as
" we are using the new ES6 syntax.
" nnoremap <F3> :execute 'Start -title=run -dir=' . g:vix_current_project.root . ' ' . 'npx nodemon --exec babel-node %'<CR>
let g:vix_current_project.custom_run_command = 'Spawn -title=run -dir=' . g:vix_current_project.root . ' ' .
\ 'npx nodemon --exec babel-node %'
nnoremap <F3> :execute g:vix_current_project.custom_run_command<CR>
vnoremap <F3> <Esc>:execute g:vix_current_project.custom_run_command<CR>
inoremap <F3> <Esc>:execute g:vix_current_project.custom_run_command<CR>
" Custom Utility (F2)
" Spawn an independent utility with a custom command.
let g:vix_current_project.custom_utility_command = 'Start -title=utility -dir=' . g:vix_current_project.root . ' ' .
\ 'python ./src/plotter/app-plotter.py'
\ . ' && '. 'sleep 2'
nnoremap <F2> :execute g:vix_current_project.custom_utility_command<CR>
vnoremap <F2> <Esc>:execute g:vix_current_project.custom_utility_command<CR>
inoremap <F2> <Esc>:execute g:vix_current_project.custom_utility_command<CR>
let g:tmux_session = 'runner'
" vim: ft=vim