Skip to content
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

Expand :Focus :.Spawn into what will actually be called #270

Open
teoljungberg opened this issue May 17, 2019 · 4 comments
Open

Expand :Focus :.Spawn into what will actually be called #270

teoljungberg opened this issue May 17, 2019 · 4 comments

Comments

@teoljungberg
Copy link
Contributor

teoljungberg commented May 17, 2019

I use :.Spawn to run the current test in a new window and automatically focus it. :Focus :.Dispatch expands :.Dispatch before setting the global focus to it, I'd expect :Focus :.Spawn to do the same.

If we collectively want this, I'd happily submit a PR if I can be put into the right direction.

@tpope
Copy link
Owner

tpope commented May 18, 2019

I think that would be fine, although it's starting to get convoluted.

@teoljungberg
Copy link
Contributor Author

This diff got :Focus :.Spawn to expand :.Spawn to essentially run :.Dispatch - but it takes away the functionality of running :.Spawn in a new window.

Ideas?

diff --git a/autoload/dispatch.vim b/autoload/dispatch.vim
index 90cbfe2..efb528e 100644
--- a/autoload/dispatch.vim
+++ b/autoload/dispatch.vim
@@ -949,6 +949,10 @@ function! dispatch#focus_command(bang, args, count, ...) abort
     let args = dispatch#focus(line(a:args[1]))[0]
   elseif args =~# '^:\d\+Dispatch$'
     let args = dispatch#focus(+matchstr(a:args, '\d\+'))[0]
+  elseif args =~# '^:[.$]Spawn$'
+    let args = dispatch#focus(line(a:args[1]))[0]
+  elseif args =~# '^:\d\+Spawn`$'
+    let args = dispatch#focus(+matchstr(a:args, '\d\+'))[0]
   elseif args =~# '^--\S\@!' && !has_key(opts, 'compiler')
     let args = matchstr(args, '\s\+\zs.*')
     if empty(args)

@tpope
Copy link
Owner

tpope commented Jun 9, 2019

I think what you want to do, effectively, is prepend :Spawn to the string. But make sure you end up with :Spawn -dir=... and not -dir=... :Spawn, and never add -compiler=....

Note that I retooled the existing :Focus :Dispatch support recently to fix some bugs.

@tpope
Copy link
Owner

tpope commented Jun 9, 2019

Oh, you'll actually need :Spawn -wait=always to match how :.Spawn works.

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

No branches or pull requests

2 participants