Vim run command in background, but show output live in vsplit
How can I run a terminal command (for instance build) in vim while working on a file, while simultaneously showing the output live in a vsplit?
vim script gvim
add a comment |
How can I run a terminal command (for instance build) in vim while working on a file, while simultaneously showing the output live in a vsplit?
vim script gvim
Have a look at github.com/tpope/vim-dispatch
– taketwo
Dec 7 '18 at 8:14
thanks, ill have a look at it, I just thought I heard vim now supports asynchronous tasks by default
– user2741831
Dec 7 '18 at 8:17
Yes it does, @philosopher.stoned gave an example. The plugin just wraps around this functionality (and provides fallback for old Vim versions). In my opinion it has a nice interface and is easier to use than raw Vim commands.
– taketwo
Dec 8 '18 at 9:12
dokes this also work in gvim? cuz it says I need tmux
– user2741831
Dec 8 '18 at 14:32
add a comment |
How can I run a terminal command (for instance build) in vim while working on a file, while simultaneously showing the output live in a vsplit?
vim script gvim
How can I run a terminal command (for instance build) in vim while working on a file, while simultaneously showing the output live in a vsplit?
vim script gvim
vim script gvim
asked Dec 7 '18 at 7:38
user2741831
1124
1124
Have a look at github.com/tpope/vim-dispatch
– taketwo
Dec 7 '18 at 8:14
thanks, ill have a look at it, I just thought I heard vim now supports asynchronous tasks by default
– user2741831
Dec 7 '18 at 8:17
Yes it does, @philosopher.stoned gave an example. The plugin just wraps around this functionality (and provides fallback for old Vim versions). In my opinion it has a nice interface and is easier to use than raw Vim commands.
– taketwo
Dec 8 '18 at 9:12
dokes this also work in gvim? cuz it says I need tmux
– user2741831
Dec 8 '18 at 14:32
add a comment |
Have a look at github.com/tpope/vim-dispatch
– taketwo
Dec 7 '18 at 8:14
thanks, ill have a look at it, I just thought I heard vim now supports asynchronous tasks by default
– user2741831
Dec 7 '18 at 8:17
Yes it does, @philosopher.stoned gave an example. The plugin just wraps around this functionality (and provides fallback for old Vim versions). In my opinion it has a nice interface and is easier to use than raw Vim commands.
– taketwo
Dec 8 '18 at 9:12
dokes this also work in gvim? cuz it says I need tmux
– user2741831
Dec 8 '18 at 14:32
Have a look at github.com/tpope/vim-dispatch
– taketwo
Dec 7 '18 at 8:14
Have a look at github.com/tpope/vim-dispatch
– taketwo
Dec 7 '18 at 8:14
thanks, ill have a look at it, I just thought I heard vim now supports asynchronous tasks by default
– user2741831
Dec 7 '18 at 8:17
thanks, ill have a look at it, I just thought I heard vim now supports asynchronous tasks by default
– user2741831
Dec 7 '18 at 8:17
Yes it does, @philosopher.stoned gave an example. The plugin just wraps around this functionality (and provides fallback for old Vim versions). In my opinion it has a nice interface and is easier to use than raw Vim commands.
– taketwo
Dec 8 '18 at 9:12
Yes it does, @philosopher.stoned gave an example. The plugin just wraps around this functionality (and provides fallback for old Vim versions). In my opinion it has a nice interface and is easier to use than raw Vim commands.
– taketwo
Dec 8 '18 at 9:12
dokes this also work in gvim? cuz it says I need tmux
– user2741831
Dec 8 '18 at 14:32
dokes this also work in gvim? cuz it says I need tmux
– user2741831
Dec 8 '18 at 14:32
add a comment |
1 Answer
1
active
oldest
votes
You need to use job_start function for this. It'll invoke your command in a separate process instance. You can pass buffer names to this call and vim will link STDOUT and STDERR pipes of job's process to these buffers.
A host of additional actions are also possible, like registering callbacks when data is posted to these buffers, type of job being run, etc.
Example:
let logjob = job_start("tail -f /tmp/log",
{'out_io': 'buffer', 'out_name': 'dummy'})
vsplit | buffer dummy
this works really well, thanks. Is there a way to always keep the buffer at the very end to always see the output
– user2741831
Dec 8 '18 at 21:15
Use vim movement command 'G' to go to end of buffer. Once at end, it'll always track new data being added and scroll automatically.
– philosopher.stoned
Dec 14 '18 at 8:35
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1381565%2fvim-run-command-in-background-but-show-output-live-in-vsplit%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need to use job_start function for this. It'll invoke your command in a separate process instance. You can pass buffer names to this call and vim will link STDOUT and STDERR pipes of job's process to these buffers.
A host of additional actions are also possible, like registering callbacks when data is posted to these buffers, type of job being run, etc.
Example:
let logjob = job_start("tail -f /tmp/log",
{'out_io': 'buffer', 'out_name': 'dummy'})
vsplit | buffer dummy
this works really well, thanks. Is there a way to always keep the buffer at the very end to always see the output
– user2741831
Dec 8 '18 at 21:15
Use vim movement command 'G' to go to end of buffer. Once at end, it'll always track new data being added and scroll automatically.
– philosopher.stoned
Dec 14 '18 at 8:35
add a comment |
You need to use job_start function for this. It'll invoke your command in a separate process instance. You can pass buffer names to this call and vim will link STDOUT and STDERR pipes of job's process to these buffers.
A host of additional actions are also possible, like registering callbacks when data is posted to these buffers, type of job being run, etc.
Example:
let logjob = job_start("tail -f /tmp/log",
{'out_io': 'buffer', 'out_name': 'dummy'})
vsplit | buffer dummy
this works really well, thanks. Is there a way to always keep the buffer at the very end to always see the output
– user2741831
Dec 8 '18 at 21:15
Use vim movement command 'G' to go to end of buffer. Once at end, it'll always track new data being added and scroll automatically.
– philosopher.stoned
Dec 14 '18 at 8:35
add a comment |
You need to use job_start function for this. It'll invoke your command in a separate process instance. You can pass buffer names to this call and vim will link STDOUT and STDERR pipes of job's process to these buffers.
A host of additional actions are also possible, like registering callbacks when data is posted to these buffers, type of job being run, etc.
Example:
let logjob = job_start("tail -f /tmp/log",
{'out_io': 'buffer', 'out_name': 'dummy'})
vsplit | buffer dummy
You need to use job_start function for this. It'll invoke your command in a separate process instance. You can pass buffer names to this call and vim will link STDOUT and STDERR pipes of job's process to these buffers.
A host of additional actions are also possible, like registering callbacks when data is posted to these buffers, type of job being run, etc.
Example:
let logjob = job_start("tail -f /tmp/log",
{'out_io': 'buffer', 'out_name': 'dummy'})
vsplit | buffer dummy
answered Dec 8 '18 at 2:02
philosopher.stoned
311
311
this works really well, thanks. Is there a way to always keep the buffer at the very end to always see the output
– user2741831
Dec 8 '18 at 21:15
Use vim movement command 'G' to go to end of buffer. Once at end, it'll always track new data being added and scroll automatically.
– philosopher.stoned
Dec 14 '18 at 8:35
add a comment |
this works really well, thanks. Is there a way to always keep the buffer at the very end to always see the output
– user2741831
Dec 8 '18 at 21:15
Use vim movement command 'G' to go to end of buffer. Once at end, it'll always track new data being added and scroll automatically.
– philosopher.stoned
Dec 14 '18 at 8:35
this works really well, thanks. Is there a way to always keep the buffer at the very end to always see the output
– user2741831
Dec 8 '18 at 21:15
this works really well, thanks. Is there a way to always keep the buffer at the very end to always see the output
– user2741831
Dec 8 '18 at 21:15
Use vim movement command 'G' to go to end of buffer. Once at end, it'll always track new data being added and scroll automatically.
– philosopher.stoned
Dec 14 '18 at 8:35
Use vim movement command 'G' to go to end of buffer. Once at end, it'll always track new data being added and scroll automatically.
– philosopher.stoned
Dec 14 '18 at 8:35
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1381565%2fvim-run-command-in-background-but-show-output-live-in-vsplit%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have a look at github.com/tpope/vim-dispatch
– taketwo
Dec 7 '18 at 8:14
thanks, ill have a look at it, I just thought I heard vim now supports asynchronous tasks by default
– user2741831
Dec 7 '18 at 8:17
Yes it does, @philosopher.stoned gave an example. The plugin just wraps around this functionality (and provides fallback for old Vim versions). In my opinion it has a nice interface and is easier to use than raw Vim commands.
– taketwo
Dec 8 '18 at 9:12
dokes this also work in gvim? cuz it says I need tmux
– user2741831
Dec 8 '18 at 14:32