Vim run command in background, but show output live in vsplit












0














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?










share|improve this question






















  • Have a look at github.com/tpope/vim-dispatch
    – taketwo
    Dec 7 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 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 at 9:12










  • dokes this also work in gvim? cuz it says I need tmux
    – user2741831
    Dec 8 at 14:32
















0














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?










share|improve this question






















  • Have a look at github.com/tpope/vim-dispatch
    – taketwo
    Dec 7 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 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 at 9:12










  • dokes this also work in gvim? cuz it says I need tmux
    – user2741831
    Dec 8 at 14:32














0












0








0







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?










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 7 at 7:38









user2741831

1104




1104












  • Have a look at github.com/tpope/vim-dispatch
    – taketwo
    Dec 7 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 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 at 9:12










  • dokes this also work in gvim? cuz it says I need tmux
    – user2741831
    Dec 8 at 14:32


















  • Have a look at github.com/tpope/vim-dispatch
    – taketwo
    Dec 7 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 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 at 9:12










  • dokes this also work in gvim? cuz it says I need tmux
    – user2741831
    Dec 8 at 14:32
















Have a look at github.com/tpope/vim-dispatch
– taketwo
Dec 7 at 8:14




Have a look at github.com/tpope/vim-dispatch
– taketwo
Dec 7 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 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 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 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 at 9:12












dokes this also work in gvim? cuz it says I need tmux
– user2741831
Dec 8 at 14:32




dokes this also work in gvim? cuz it says I need tmux
– user2741831
Dec 8 at 14:32










1 Answer
1






active

oldest

votes


















0














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





share|improve this answer





















  • 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 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 at 8:35













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
});


}
});














draft saved

draft discarded


















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









0














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





share|improve this answer





















  • 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 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 at 8:35


















0














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





share|improve this answer





















  • 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 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 at 8:35
















0












0








0






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





share|improve this answer












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






share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 8 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 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 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 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 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 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 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 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 at 8:35




















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?