Re: Terminal close behavior

2018-03-15 Fir de Conversatie Prabir Shrestha
I like how neovim does it. When you exit by default is doesn't close the 
terminal but shows [Process exited 0] and I can press any buttons to close it. 
(Attached image)


On Wednesday, March 14, 2018 at 3:25:41 PM UTC-7, Dominique Pelle wrote:
> Bram Moolenaar  wrote:
> 
> > I currently think that the behavior to close-by-default only when no
> > command argument is passed is the best solution.  This assumes that the
> > user intentionally ends the shell, which seems like a safe assumption.
> 
> Right now, if I do  ":terminal ++close" then exit the terminal,
> its output is gone and I get no chance to see it anymore.
> It seems that it's a bit dangerous, especially if it becomes the
> default i.e without the ++close flag.  But I understand that
> when user close the shell, he often meant to also close the
> terminal window.
> 
> How about closing the terminal window but keep the buffer
> in memory?  (i.e. as if we did  CTRL-N  in the terminal, followed by :q)
> So we'd still get a chance to reopen but buffer, using :ls to find
> the buffer name or number. I think that this would be my preference,
> but I have not used the terminal enough to be sure what works best.
> 
> Regards
> Dominique

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Terminal close behavior

2018-03-14 Fir de Conversatie Dominique Pellé
Bram Moolenaar  wrote:

> I currently think that the behavior to close-by-default only when no
> command argument is passed is the best solution.  This assumes that the
> user intentionally ends the shell, which seems like a safe assumption.

Right now, if I do  ":terminal ++close" then exit the terminal,
its output is gone and I get no chance to see it anymore.
It seems that it's a bit dangerous, especially if it becomes the
default i.e without the ++close flag.  But I understand that
when user close the shell, he often meant to also close the
terminal window.

How about closing the terminal window but keep the buffer
in memory?  (i.e. as if we did  CTRL-N  in the terminal, followed by :q)
So we'd still get a chance to reopen but buffer, using :ls to find
the buffer name or number. I think that this would be my preference,
but I have not used the terminal enough to be sure what works best.

Regards
Dominique

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Terminal close behavior

2018-03-14 Fir de Conversatie Bram Moolenaar

Marius Gedminas wrote:

> On Tue, Mar 13, 2018 at 01:56:03PM +0100, Bram Moolenaar wrote:
> > Currently the :terminal command keeps the window open after the job
> > exists.  The idea is that you have a chance to see the job output, you
> > might want to yank it.  Closing the window automatically might mean you
> > loose that text, there is no way to get it back.
> > 
> > However, in practice I find that I mostly want the window to close as
> > soon as the job finishes.  So how about changing the default behavior?
> > 
> > Currently:
> > :terminal   requires "exit:q" to close
> > :terminal ++close   requires "exit" to close
> > 
> > With different default:
> > :terminal   requires "exit" to close
> > :terminal ++noclose requires "exit:q" to close
> > 
> > Good idea or bad idea?
> 
> Personally I like the current behavior.
> 
> I use vim's :terminal to run a couple of web servers (a Python one for a
> web app backend, and a Node.js one for the app's frontend).  These
> autorestart when the source code on disk changes, but sometimes (e.g. when I
> save a file during an unfinished refactoring) one of the servers
> crashes.  I like being able to see the error and to restart the command
> in the same terminal window, for which I use a little user-defined
> command:
> 
>   command! TermRestart exec 'term ++curwin' expand("%")[1:]
> 
> 
> Maybe an option would be better?  Then people to select which one they
> prefer in their vimrc, and they wouldn't have to repeat their preference
> on every :terminal command?

An option is not nice for people who write plugins, they have to make
sure it works both with and without the option set.

I currently think that the behavior to close-by-default only when no
command argument is passed is the best solution.  This assumes that the
user intentionally ends the shell, which seems like a safe assumption.

If I understand it correctly this will also work for your use case.

-- 
hundred-and-one symptoms of being an internet addict:
18. Your wife drapes a blond wig over your monitor to remind you of what she
looks like.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Terminal close behavior

2018-03-14 Fir de Conversatie Marius Gedminas
On Tue, Mar 13, 2018 at 01:56:03PM +0100, Bram Moolenaar wrote:
> Currently the :terminal command keeps the window open after the job
> exists.  The idea is that you have a chance to see the job output, you
> might want to yank it.  Closing the window automatically might mean you
> loose that text, there is no way to get it back.
> 
> However, in practice I find that I mostly want the window to close as
> soon as the job finishes.  So how about changing the default behavior?
> 
> Currently:
>   :terminal   requires "exit:q" to close
>   :terminal ++close   requires "exit" to close
> 
> With different default:
>   :terminal   requires "exit" to close
>   :terminal ++noclose requires "exit:q" to close
> 
> Good idea or bad idea?

Personally I like the current behavior.

I use vim's :terminal to run a couple of web servers (a Python one for a
web app backend, and a Node.js one for the app's frontend).  These
autorestart when the source code on disk changes, but sometimes (e.g. when I
save a file during an unfinished refactoring) one of the servers
crashes.  I like being able to see the error and to restart the command
in the same terminal window, for which I use a little user-defined
command:

  command! TermRestart exec 'term ++curwin' expand("%")[1:]


Maybe an option would be better?  Then people to select which one they
prefer in their vimrc, and they wouldn't have to repeat their preference
on every :terminal command?

Marius Gedminas
-- 
/*
 * This function is about (re)setting the class of a held lock,
 * yet we're not actually holding any locks. Naughty user!
 */

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Terminal close behavior

2018-03-13 Fir de Conversatie Bram Moolenaar

Christian wrote:

> On Di, 13 Mär 2018, Kazunobu Kuriyama wrote:
> 
> > 2018-03-13 21:56 GMT+09:00 Bram Moolenaar :
> > 
> > 
> > Currently the :terminal command keeps the window open after the job
> > exists.  The idea is that you have a chance to see the job output, you
> > might want to yank it.  Closing the window automatically might mean you
> > loose that text, there is no way to get it back.
> > 
> > However, in practice I find that I mostly want the window to close as
> > soon as the job finishes.  So how about changing the default behavior?
> > 
> > Currently:
> >         :terminal               requires "exit:q" to close
> >         :terminal ++close       requires "exit" to close
> > 
> > With different default:
> >         :terminal               requires "exit" to close
> >         :terminal ++noclose     requires "exit:q" to close
> > 
> > Good idea or bad idea?
> > 
> > 
> > In case the job finished in a way different from one's expectation,
> > he might feel sad seeing the window closed mercilessly and regret
> > not giving the noclose option when he opened the terminal. But if
> > the proposed change comes with a way to restore (part of) the
> > contents of the closed window, just like g<, that
> > would remind him that :smile is always with Vim.
> 
> Perhaps keep the last  in a register somewhere available. Also, 
> perhaps it makes sense to only autoclose the terminal, if the command 
> finished with a zero exit status.

The question then is when the clean it up.  Perhaps the next terminal
that exits overwrites it, like the delete register?

There are actually cases where you would want to see the output only
when the exit status is zero, e.g. something like ":term find . pattern".
Or when you always want to see the output, e.g. ":term make".  That
would actually be very common.

Perhaps we should only change it for when there is no argument, when
starting the shell.  A shell exiting accidentally when there is
something you want to see is rare (same thing would happen in a real
terminal).  While quitting the shell would nearly always be followed by
closing the window.

-- 
hundred-and-one symptoms of being an internet addict:
6. You refuse to go to a vacation spot with no electricity and no phone lines.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Terminal close behavior

2018-03-13 Fir de Conversatie Christian Brabandt

On Di, 13 Mär 2018, Kazunobu Kuriyama wrote:

> 2018-03-13 21:56 GMT+09:00 Bram Moolenaar :
> 
> 
> Currently the :terminal command keeps the window open after the job
> exists.  The idea is that you have a chance to see the job output, you
> might want to yank it.  Closing the window automatically might mean you
> loose that text, there is no way to get it back.
> 
> However, in practice I find that I mostly want the window to close as
> soon as the job finishes.  So how about changing the default behavior?
> 
> Currently:
>         :terminal               requires "exit:q" to close
>         :terminal ++close       requires "exit" to close
> 
> With different default:
>         :terminal               requires "exit" to close
>         :terminal ++noclose     requires "exit:q" to close
> 
> Good idea or bad idea?
> 
> 
> In case the job finished in a way different from one's expectation, he might
> feel sad seeing the window closed mercilessly and regret not giving the 
> noclose
> option when he opened the terminal. But if the proposed change comes with a 
> way
> to restore (part of) the contents of the closed window, just like g<, that
> would remind him that :smile is always with Vim.

Perhaps keep the last  in a register somewhere available. Also, 
perhaps it makes sense to only autoclose the terminal, if the command 
finished with a zero exit status.

Best,
Christian
-- 
Ich hätte für Frankreich sterben können, aber französische Verse
machen - nimmermehr! 
-- Heinrich Heine

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Terminal close behavior

2018-03-13 Fir de Conversatie Kazunobu Kuriyama
2018-03-13 21:56 GMT+09:00 Bram Moolenaar :

>
> Currently the :terminal command keeps the window open after the job
> exists.  The idea is that you have a chance to see the job output, you
> might want to yank it.  Closing the window automatically might mean you
> loose that text, there is no way to get it back.
>
> However, in practice I find that I mostly want the window to close as
> soon as the job finishes.  So how about changing the default behavior?
>
> Currently:
> :terminal   requires "exit:q" to close
> :terminal ++close   requires "exit" to close
>
> With different default:
> :terminal   requires "exit" to close
> :terminal ++noclose requires "exit:q" to close
>
> Good idea or bad idea?
>

In case the job finished in a way different from one's expectation, he
might feel sad seeing the window closed mercilessly and regret not giving
the noclose option when he opened the terminal. But if the proposed change
comes with a way to restore (part of) the contents of the closed window,
just like g<, that would remind him that :smile is always with Vim.


>
> --
> hundred-and-one symptoms of being an internet addict:
> 2. You kiss your girlfriend's home page.
>
>  /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net
>  \\\
> ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/
> \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org
> ///
>  \\\help me help AIDS victims -- http://ICCF-Holland.org
> ///
>
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups
> "vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vim_dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Terminal close behavior

2018-03-13 Fir de Conversatie Jason Felice
I'd prefer the change, personally.

On Tue, Mar 13, 2018 at 8:56 AM, Bram Moolenaar  wrote:

>
> Currently the :terminal command keeps the window open after the job
> exists.  The idea is that you have a chance to see the job output, you
> might want to yank it.  Closing the window automatically might mean you
> loose that text, there is no way to get it back.
>
> However, in practice I find that I mostly want the window to close as
> soon as the job finishes.  So how about changing the default behavior?
>
> Currently:
> :terminal   requires "exit:q" to close
> :terminal ++close   requires "exit" to close
>
> With different default:
> :terminal   requires "exit" to close
> :terminal ++noclose requires "exit:q" to close
>
> Good idea or bad idea?
>
>
> --
> hundred-and-one symptoms of being an internet addict:
> 2. You kiss your girlfriend's home page.
>
>  /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net
>  \\\
> ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/
> \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org
> ///
>  \\\help me help AIDS victims -- http://ICCF-Holland.org
> ///
>
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups
> "vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vim_dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Terminal close behavior

2018-03-13 Fir de Conversatie Bram Moolenaar

Currently the :terminal command keeps the window open after the job
exists.  The idea is that you have a chance to see the job output, you
might want to yank it.  Closing the window automatically might mean you
loose that text, there is no way to get it back.

However, in practice I find that I mostly want the window to close as
soon as the job finishes.  So how about changing the default behavior?

Currently:
:terminal   requires "exit:q" to close
:terminal ++close   requires "exit" to close

With different default:
:terminal   requires "exit" to close
:terminal ++noclose requires "exit:q" to close

Good idea or bad idea?


-- 
hundred-and-one symptoms of being an internet addict:
2. You kiss your girlfriend's home page.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.