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

Feature request: start swank by dispatch #12

Open
antonvesnin opened this issue Sep 6, 2014 · 7 comments
Open

Feature request: start swank by dispatch #12

antonvesnin opened this issue Sep 6, 2014 · 7 comments

Comments

@antonvesnin
Copy link

Hi. Thanks for the great plugin. Is it possible to add start swank server through dispatch.vim - https://github.com/tpope/vim-dispatch if it is available? Or can I add it just by editing vimrc?

@kovisoft
Copy link
Owner

kovisoft commented Sep 6, 2014

I have never used vim-dispatch (TBH I have never heard about it until now).
As I see it has a :Dispatch! command which just runs anything in the background. So I guess it should be possible to run the swank server this way:
:Dispatch! command_that_runs_the_swank_server_from_command_line

If it works then this may be assigned to g:slimv_swank_cmd in the .vimrc:
let g:slimv_swank_cmd = ':Dispatch! command_that_runs_the_swank_server_from_command_line'

E.g. if you can run the swank server via lein swank (clojure example), then (in theory) this should go into .vimrc:
let g:slimv_swank_cmd = ':Dispatch! lein swank'

@ELLIOTTCABLE
Copy link

👍!

vim-dispatch is pretty popular; it wouldn't be a bad idea to add support for this natively. (i.e. :Dispatch swank, and information in the README to that effect.)

@kovisoft
Copy link
Owner

Is it really that simple, just enter :Dispatch swank and it starts the swank server? Did you try it?

@ELLIOTTCABLE
Copy link

Sorry, it wouldn't be :Dispatch, I made the mistake of repeating what I read above. It'd be :Start!; and I suppose all that'd be useful is adding a note to the README. :P

@kovisoft
Copy link
Owner

It's no problem to add support for it if I know

(1) how to detect the presence of vim-dispatch;
(2) what exact command should I build which starts the swank server.

(1) may be easy, e.g. by checking if command :Dispatch is defined
But I don't know (2) what command to build.
Is using vim-dispatch like starting a command in a new screen/tmux/xterm session?
I mean I have a command that would start the swank server when typed in the shell.
When I want to run this from within vim, then I can execute one of these (or similar):

:! screen -X eval "command"
:! tmux new-window -d 'command'
:! xterm -e command &

What would be the vim-dispatch equivalent?

@ELLIOTTCABLE
Copy link

The entire point of vim-dispatch is basically to make all the things you're doing in your readme, unnecessary. It handles any forking, or opening of new windows, or whatever, that may be necessary (for almost all vim-dispatch users, this means “open a new tmux split,” because it has special first-class tmux integration). So, basically, to start a background task in a new ‘window’ (or tmux pane), you'd use:

:Start! command

I'm sure @tpope might be able to better explain than I, if he's listening to his notifications. (=

@tpope
Copy link

tpope commented Feb 20, 2015

Yes, depending on the environment, :Start command or :Start! command could invoke something similar to any of those 3 (the former being foregrounded and the latter backgrounded). Check with exists(':Start') == 2.

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

4 participants