Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been sitting on these changes for a couple weeks. They aim to make programmatic usage of Accio easier. My motivation is wanting to call
:Accio
in aBufWritePost
autocommand. It's a little cumbersome to pass a list of tasks to the command in a variable, so it makes more sense to call the function in that case. Furthermore, the user must decide betweenaccio#accio()
andaccio#accio_vim()
if s/he wishes to do so. The first change eliminatesaccio#accio_vim()
in favor of one function that chooses the appropriate handler itself. It is also no longer responsible for parsing the argument to:Accio
.My first approach to defining which tasks to run per file type was to set buffer-local autocommands. This proved to be a slight hassle, so I instead settled on something like:
That way, I need only set a buffer var per file type. (I'm not sure whether or not this will explode if a buffer other than the current buffer is written, e.g.,
:wall
. Haven't tried it.)This still leaves a problem of wanting to call
:Accio
interactively with the current tasks without having to specify them, so I opted to explore #5. I discarded the possibility of supportingb:dispatch
early on. Although it sounded like a good idea to me at first, there are a couple problems in that it can contain things that aren't compilers as well as potentially containing Vim script commands. For example, if you set it via projectionist.vim, you can wind up with something likeProjectDo Dispatch mycompiler
. So my second change is supportingb:accio
as a fallback when no arguments are provided to:Accio
.My third change is introducing the concept of "focusing" a task. Given that you may want to run a task several times without specifying the tasks each time and without disturbing
b:accio
, I added something like:FocusDispatch
but a bit simpler:Note that a task is focused globally rather than per buffer, which seems more intuitive (less to keep track of mentally) and distinguishes it from the
b:accio
use case. (This may step on your plans for #7.) These last couple of changes make:Accio<CR>
a rather attractive normal-mode mapping.I'm not married to these changes in their current form, but they've been useful. What do you think? Totally open to refining any and all of these ideas or even discarding them.
—N