-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathdispatch.txt
226 lines (173 loc) · 9.22 KB
/
dispatch.txt
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
*dispatch.txt* Asynchronous build and test dispatcher
Author: Tim Pope <http://tpo.pe/>
Repo: https://github.com/tpope/vim-dispatch
License: Same terms as Vim itself (see |license|)
INTRODUCTION *dispatch*
Leverage the power of Vim's compiler system without being constrained by
synchronicity.
COMMANDS *dispatch-commands*
*dispatch-:Make*
:Make [arguments] Use the command that |:make| would run to dispatch a
build in the foreground. Adapter strategies vary, but
the goal is visibility without stealing focus. When
the build is complete, load the results into the
|quickfix| list and call |:cwindow|. This command is
preferred for shorter tasks like "build this file."
:Make! [arguments] Use the command that |:make| would run to dispatch a
build in the background. Use |:Copen| to load the
results. This command is preferred for longer tasks
like "run the entire test suite."
*dispatch-:Copen*
:Copen Load the latest build into the quickfix list and open
it with |:copen|. You may call this before the
process is finished.
:Copen! Load the latest build into the quickfix list using a
catch-all parser. This is useful when you can't tell
what went wrong.
*dispatch-:Dispatch*
:Dispatch[!] [options] {program} [arguments]
Find a compiler plugin that sets 'makeprg' to
{program} and use its 'errorformat' to dispatch a
|:Make| for the given {program} and [arguments]. If
no compiler plugin is found, the generic format
%+I%.%# is used.
:Dispatch picks a compiler by looking for either
CompilerSet makeprg={program}\ [arguments] or
CompilerSet makeprg={program} in compiler plugins.
To force a given {program} to use a given {compiler},
create ~/.vim/after/compiler/{compiler}.vim and add to
it a line like the following: >
" CompilerSet makeprg={program}
<
If you need more control, *g:dispatch_compilers* can
be set to a dictionary with commands for keys and
compiler plugins for values. Use an empty value to
skip the matched string and try again with the rest of
the command.
>
let g:dispatch_compilers = {
\ 'latex': 'tex',
\ 'bundle exec': ''}
<
You can optionally give one or more of the following
options before {program}:
-compiler=... force use of a compiler plugin
-dir=... run command in given directory
:Dispatch[!] [options] -- [arguments]
This is equivalent to |:Make| but accepts options.
*b:dispatch*
:Dispatch[!] [options] Invoke |:Dispatch| with the options, program, and
arguments found in b:dispatch. In the quickfix
window, this reruns the shown dispatch. When no other
default is found, equivalent to |:Make|.
*dispatch-:FocusDispatch*
:FocusDispatch [options] {program} [arguments]
Set a global default command for |:Dispatch| with no
arguments. Overrides |b:dispatch|.
:FocusDispatch! [options] {program} [arguments]
Set a window local default command for |:Dispatch|
with no arguments. Overrides |b:dispatch| and the
global default.
:FocusDispatch! Clear the global and window local defaults for
|:Dispatch|.
:FocusDispatch Show the task that would run when calling |:Dispatch|
with no arguments.
:0Dispatch[!] [options] Provide a range to |:Dispatch| skips any focused task
and forces |b:dispatch|.
*dispatch-:AbortDispatch*
:AbortDispatch Abort the most recent build.
:AbortDispatch {command}
Abort the most recent build of {command}.
*dispatch-:Start*
:Start [options] {command}
Start a process in a new, focused window. If
{command} and the directory for execution match a
previous :Start invocation, focus it instead, if
possible. Options:
-dir=... run command in given directory
-title=... short label for supported adapters
-wait=... when to display press enter prompt:
"always", "never", or "error"
:Start! [options] {command}
Start a process in a new, unfocused window. If
{command} and the current working directory match
previous :Start invocation, do nothing.
*b:start*
:Start[!] [options] With no arguments, |:Start| the options and command
given by |b:start|. If not set, falls back to
'shell'.
*dispatch-:Spawn*
:Spawn[!] [options] [command]
Like |:Start|, but always spawn a new process rather
than focusing an existing one. The default is always
to spawn a new 'shell'.
:0Spawn! [options]
Provide a range to |:Spawn| to spawn |b:dispatch|.
Handy for using an interactive debugger.
MAPS *dispatch-maps*
The following convenience maps are provided.
*m<CR>* |:Make|<CR>
*m<Space>* |:Make|<Space>
*m!* |:Make|!
*m?* Show 'makeprg'
*`<CR>* |:Dispatch|<CR>
*`<Space>* |:Dispatch|<Space>
*`!* |:Dispatch|!
*`?* |:FocusDispatch|<CR>
*'<CR>* |:Start|<CR>
*'<Space>* |:Start|<Space>
*'!* |:Start|!
*'?* Show |b:start|
*g'<CR>* |:Spawn|<CR>
*g'<Space>* |:Spawn|<Space>
*g'!* |:Spawn|!
*g'?* Show 'shell'
These can be disabled with
>
let g:dispatch_no_maps = 1
<
STRATEGIES *dispatch-strategies*
Strategies are listed in order of precedence. The first available one is
used. Some strategies only provide for a subset of tasks.
Disable :Make/:Dispatch or :Start/:Spawn using a given strategy by assigning
g:dispatch_no_strategyname_make or g:dispatch_no_strategyname_start,
respectively. For example, to prevent :Dispatch from ever using the Job
handler:
>
let g:dispatch_no_job_make = 1
<
Except for Tmux, which uses |VimResized|, all strategies require either |job|
support plus a file system with FIFOs (basically everything but Windows) or
|clientserver| support to do foreground makes.
Tmux ~
Foreground makes open in a small split at the bottom. The closure of the
pane triggers a |VimResized| event which loads the results into the quickfix
list.
The tmux strategy can be used from the GUI as well. Either start Vim from
inside of tmux or assign g:tmux_session. This will use a new window for
foreground makes rather than a split.
Job ~
Uses the |job| support in Vim 8 and Neovim to update the quickfix list in real
time.
GNU Screen ~
A new window is always used, since splits in GNU Screen are awkward.
Terminal ~
Uses the respective |:terminal| features of Vim and Neovim.
Windows ~
You can use either the standard cmd.exe or a cygwin shell. Both foreground
and background |:Make| invocations are started minimized to prevent focus
stealing.
iTerm ~
This strategy fires if you're in MacVim with at least one iTerm window open,
or if Vim is running in iTerm itself. Used only for |:Start|.
X11 ~
Uses g:dispatch_terminal_exec, "$TERMINAL -e", or "xterm -e". Used only for
|:Start|. Background invocations require wmctrl to be is installed (which is
used to switch the focus back to Vim).
Headless ~
Forks tasks into the background. It's working, you just can't see it. Don't
forget to check |:Copen|. The presence of this strategy means that |:Make!|
and |:Start!| will never block Vim.
Synchronous ~
When all else fails, a vanilla |:make| or |:!| is performed.
vim:tw=78:et:ft=help:norl: