Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 feat: Run :make command using builtin terminal by 64-bitman · Pull Request #18188 · vim/vim · GitHub
Nothing Special   »   [go: up one dir, main page]

Skip to content

Conversation

64-bitman
Copy link
Contributor
@64-bitman 64-bitman commented Sep 2, 2025

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.

@64-bitman 64-bitman force-pushed the make_terminal branch 2 times, most recently from 9bb2ac1 to 1a367f1 Compare September 2, 2025 01:42
@64-bitman 64-bitman force-pushed the make_terminal branch 4 times, most recently from cb1701b to 001178d Compare September 2, 2025 02:03
@habamax
Copy link
Contributor
habamax commented Sep 2, 2025
  1. can we not use g: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 from dispatch plugin.

@64-bitman
Copy link
Contributor Author
  1. can we not use g: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 from dispatch 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 commented Sep 2, 2025

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 for make, e.g. set makeprgbackground=terminal and expect :make to run in background with terminal or set makeprgbackground=job to do the same without terminal.

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

@64-bitman
Copy link
Contributor Author
64-bitman commented Sep 2, 2025

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 for make, e.g. set makeprgbackground=terminal and expect :make to run in background with terminal or set 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-bitman 64-bitman marked this pull request as draft September 2, 2025 02:54
@64-bitman 64-bitman force-pushed the make_terminal branch 5 times, most recently from 2ffd893 to df7283f Compare September 6, 2025 19:55
@64-bitman
Copy link
Contributor Author
64-bitman commented Sep 6, 2025

@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-bitman 64-bitman force-pushed the make_terminal branch 3 times, most recently from d4e7a27 to b8f740d Compare September 7, 2025 00:51
@habamax
Copy link
Contributor
habamax commented Sep 7, 2025

@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 like set make=terminal/set make=job option.

@64-bitman
Copy link
Contributor Author

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 like set 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
habamax commented Sep 7, 2025

PS: It would be nice to not write :make ++term, hopefully you going to have it eventually with smth like set 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 with set make=job.

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

PS
I can 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 commented Sep 7, 2025

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
Contributor Author

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

Basically, with set make=term I would like to see how compilation happens, with set 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 I can 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 integrate makeprg 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
habamax commented Sep 7, 2025

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

I just run make 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
habamax commented Sep 7, 2025

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
Contributor Author

I just run make 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
habamax commented Sep 7, 2025

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 commented Sep 14, 2025

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}"
    endif
enddef
command! -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

< 74EB /span>

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

Successfully merging this pull request may close these issues.

4 participants

0