Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/vimPublic

feat: Run :make command using builtin terminal#18188

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
64-bitman wants to merge1 commit intovim:master
base:master
Choose a base branch
Loading
from64-bitman:make_terminal

Conversation

64-bitman
Copy link
Contributor

@64-bitman64-bitman commentedSep 2, 2025
edited
Loading

Pass ++term to:make or:lmake to run it in a terminal in a new tab. The quickfix/location list will be populated when the command is finished, autocmds triggered, and first error jumped to if specified. It is partially implemented in C and the rest in Vimscript.

Konfekt, mike325, and ddad431 reacted with rocket emoji
@64-bitman64-bitmanforce-pushed themake_terminal branch 2 times, most recently from9bb2ac1 to1a367f1CompareSeptember 2, 2025 01:42
@64-bitman64-bitmanforce-pushed themake_terminal branch 4 times, most recently fromcb1701b to001178dCompareSeptember 2, 2025 02:03
@habamax
Copy link
Contributor

habamax commentedSep 2, 2025
edited
Loading

  1. can we not useg:vim_terminal_make_command? Maybe internal variable would be a better fit?v:terminal_make_command?
  2. Is there a particular reason to do it in the new tab? I would prefer to have it in the regular:term wherever it would be opened. Or:botright term ...
  3. Provided that results still go to quickfix/location list, wouldn't it better not to create terminal at all, but just use job instead?@tpope's:Make command fromdispatch plugin.

@64-bitman
Copy link
ContributorAuthor

  1. can we not useg:vim_terminal_make_command? Maybe internal variable would be a better fit?v:terminal_make_command?

Yeah that sounds better

  1. Is there a particular reason to do it in the new tab? I would prefer to have it in the regular:term wherever it would be opened. Or:botright term ...

Any ideas how the user would configure that?

  1. Provided that results still go to quickfix/location list, wouldn't it better not to create terminal at all, but just use job instead?@tpope's:Make command fromdispatch plugin.

Maybe users wanting more advanced stuff could use that plugin. I think this should just be a simple way to run:make in the background. Maybe the user can configure if the terminal should automatically be opened or not?

@habamax
Copy link
Contributor

habamax commentedSep 2, 2025
edited
Loading

Any ideas how the user would configure that?

What if:make would be able to accept:tab make ++term,:botright make ++term, etc?
Thus by default:make ++term opens terminal where:term would have opened it.

Maybe users wanting more advanced stuff could use that plugin. I think this should just be a simple way to run:make in the background. Maybe the user can configure if the terminal should automatically be opened or not?

I would just create the setting formake, e.g.set makeprgbackground=terminal and expect:make to run in background with terminal orset makeprgbackground=job to do the same without terminal.

  1. :make withset makeprgbackground=terminal opens terminal in default location
  2. :tab make withset makeprgbackground=terminal opens terminal in a new tab
  3. :botright make withset makeprgbackground=terminal opens terminal in bottom location
  4. ...
  5. :make withset makeprgbackground=job runs make in background, no terminal
  6. :tab make withset makeprgbackground=job runs make in background, no terminal
  7. etc

@64-bitman
Copy link
ContributorAuthor

64-bitman commentedSep 2, 2025
edited
Loading

Any ideas how the user would configure that?

What if:make would be able to accept:tab make ++term,:botright make ++term, etc? Thus by default:make ++term opens terminal where:term would have opened it.

Oh thats actually really nice, I will try implementating that

Maybe users wanting more advanced stuff could use that plugin. I think this should just be a simple way to run:make in the background. Maybe the user can configure if the terminal should automatically be opened or not?

I would just create the setting formake, e.g.set makeprgbackground=terminal and expect:make to run in background with terminal orset makeprgbackground=job to do the same without terminal.

Sounds good

Thanks for the tips, I'll make this a draft for now until I'm done everything

EDIT: I'll actually move everything into C, no vimscript, should be simpler

@64-bitman64-bitman marked this pull request as draftSeptember 2, 2025 02:54
@64-bitman64-bitmanforce-pushed themake_terminal branch 5 times, most recently from2ffd893 todf7283fCompareSeptember 6, 2025 19:55
@64-bitman
Copy link
ContributorAuthor

64-bitman commentedSep 6, 2025
edited
Loading

@habamax Can you check if it looks good?:botright, :tab, ... should work, and the :make command supports++hidden, ++rows, ++cols just like the :terminal command.

Quickfix/location list is only generated when the make command is done, I tried having it appended to as the make command runs. Though I found that using the channel callback gives raw messages, meaning colour codes/any escape codes would appear in the quickfix window, not sure how to handle that.

Thanks,

@64-bitman64-bitmanforce-pushed themake_terminal branch 3 times, most recently fromd4e7a27 tob8f740dCompareSeptember 7, 2025 00:51
@habamax
Copy link
Contributor

@habamax Can you check if it looks good?:botright, :tab, ... should work, and the :make command supports++hidden, ++rows, ++cols just like the :terminal command.

When you do:tab make ++term a new tab appears and if there is an error it jumps to the first error replacing terminal tab. Not sure if this is intended? Same for a regular split.

https://asciinema.org/a/4heU2snrwnlDjlq2cwRrGkdhu

Otherwise, looks good to me.

PS: It would be nice to not write:make ++term, hopefully you going to have it eventually with smth likeset make=terminal/set make=job option.

@64-bitman
Copy link
ContributorAuthor

When you do:tab make ++term a new tab appears and if there is an error it jumps to the first error replacing terminal tab. Not sure if this is intended? Same for a regular split.

That also applies to the regular :make, you just have to pass a shebang [!]]. In the docs:

7. If [!] is not given the first error is jumped to.

Maybe jumping to the first error should not be the default when adding ++term to the command?

PS: It would be nice to not write:make ++term, hopefully you going to have it eventually with smth likeset make=terminal/set make=job option.

I think it would be better to just create a custom user command instead. Adding a separate option seems kinda out of place? I mean you can't configure default behaviour with ++ arguments with other ex commands.

@habamax
Copy link
Contributor

PS: It would be nice to not write:make ++term, hopefully you going to have it eventually with smth likeset make=terminal/set make=job option.

I think it would be better to just create a custom user command instead. Adding a separate option seems kinda out of place? I mean you can't configure default behaviour with ++ arguments with other ex commands.

With the custom command I can't say "do not use terminal, but job instead" which I was referring to withset make=job.

Basically, withset make=term I would like to see how compilation happens, withset make=job I just want to make in background without any visuals.

PS
Ican do it now without using:make at all, but I can do make in a built in terminal too without this patch :).

@habamax
Copy link
Contributor

habamax commentedSep 7, 2025
edited
Loading

That also applies to the regular :make, you just have to pass a shebang [!]]. In the docs:

Yes, I know, but I would expect it to jump in another window/split instead of replacing make results. That would be one of the reasons for me to use++term here to see context of the errors.

With regular:make it is fine as:make results are kind of hidden.

@64-bitman
Copy link
ContributorAuthor

With the custom command I can't say "do not use terminal, but job instead" which I was referring to withset make=job.

Basically, withset make=term I would like to see how compilation happens, withset make=job I just want to make in background without any visuals.

Wouldn't ++hidden be the same as a job? It just creates a terminal buffer but doesn't actually open it.

PS Ican do it now without using:make at all, but I can do make in a built in terminal too without this patch :).

I tried creating a plugin for that, problem was that trying to integratemakeprg was not possible because the args can be anywhere in that option using$*

Yes, I know, but I would expect it to jump in another window/split instead of replacing make results. That would be one of the reasons for me to use++term here to see context of the errors.

With regular:make it is fine as:make results are kind of hidden.

That makes sense

@habamax
Copy link
Contributor

I tried creating a plugin for that, problem was that trying to integratemakeprg was not possible because the args can be anywhere in that option using$*

I just runmake in the job and capture output to the special buffer (not specific to make, any shell command):

https://asciinema.org/a/A99clJGwpf7PRlduC2p125JZY

@habamax
Copy link
Contributor

Wouldn't ++hidden be the same as a job? It just creates a terminal buffer but doesn't actually open it.

Somewhat, but the difference is in buffer creation. Job doesn't create one by default.

So if you ran your make with hidden buffer 100 times you'll have your next buffer created with 100 something bufnr. And then you would need to clean up those hidden terminal buffers too.

@64-bitman
Copy link
ContributorAuthor

I just runmake in the job and capture output to the special buffer (not specific to make, any shell command):

https://asciinema.org/a/A99clJGwpf7PRlduC2p125JZY

That looks cool, Adding the exit code as the exit message is something I didn't think of

Somewhat, but the difference is in buffer creation. Job doesn't create one by default.

So if you ran your make with hidden buffer 100 times you'll have your next buffer created with 100 something bufnr. And then you would need to clean up those hidden terminal buffers too.

So with a ++job option, it would create a job, that you cannot view the progress of (in terms of output) and then updates the quickfix/location list when its done?

@habamax
Copy link
Contributor

So with a ++job option, it would create a job, that you cannot view the progress of (in terms of output) and then updates the quickfix/location list when its done?

yes!

@habamax
Copy link
Contributor

habamax commentedSep 14, 2025
edited
Loading

FWIW, here is the:Make command that runs using a job, populating quickfix along the way:

def Make(...args: list<string>)    if exists("g:make_jobid") && job_status(g:make_jobid) == 'run'        echo "There is a make job running."        return    endif    var makeprg = &l:makeprg ?? &makeprg    var qf_opened = false    setqflist([], ' ', {title: $"{makeprg} {args->join()}"})    g:make_jobid = job_start($"{makeprg} {args->join()}", {        cwd: getcwd(),        out_cb: (_, msg) => {            if !qf_opened                qf_opened = true                belowright copen            endif            setqflist([], 'a', {lines: [msg]})        },        err_cb: (_, msg) => {            if !qf_opened                qf_opened = true                belowright copen            endif            setqflist([], 'a', {lines: [msg]})        },        close_cb: (_) => {            echo "Make is finished!"        }    })    if job_status(g:make_jobid) != "run"        echom $"FAILED: {makeprg} {args}"    endifenddefcommand! -nargs=* Make Make(<f-args>)

If would be great if this could be simplified to almost no config, but if not I can live with it :).

https://asciinema.org/a/XWwYA2wLYlvGmbNcMS5eUpGam

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@yegappanyegappanyegappan left review comments

@zeertzjqzeertzjqzeertzjq left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@64-bitman@habamax@yegappan@zeertzjq

[8]ページ先頭

©2009-2025 Movatter.jp