Skip to content

Add usercmd to run after dispatch #345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

Kamilcuk
Copy link
Contributor

This allows users to generically override dispatch with their custom behavior. Some kind of notification is required when the dispatch finishes.

For example, I wanted quickfix window to always open. I have this in my vimrc:

	function KcDispatchComplete() abort
		Copen
	        " let the cursor stay where it is.
		normal G
		wincmd p
	endfunction
	autocmd User DispatchComplete call KcDispatchComplete()

Amazing plugin, thanks.

@tpope
Copy link
Owner

tpope commented Feb 11, 2024

We already call doautocmd QuickFixCmdPost make in this case. I've been reticent to add additional hooks for cases that adherence to the Vim standard already covers.

In terms of the problem you're trying to solve, I'm not sure this is the best approach. :Copen itself kicks off other autocommands, I feel like you're setting yourself up for jankiness. You can also force the window to open by changing the exit status of the command to nonzero or the 'errorformat' to match any line of output (e.g., add %+G%.%# to the end). I could see an argument for making this easier to do.

@tpope tpope closed this Feb 11, 2024
@tpope
Copy link
Owner

tpope commented Feb 11, 2024

See also discussion in #339.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants