Wednesday, July 8, 2015

Re: what does & mean in the vim command?

On Wed, Jul 08, 2015, Nikolay Pavlov wrote:
> 2015-07-08 9:06 GMT+03:00 Eric Christopherson <echristopherson@gmail.com>:
> > On Tue, Jul 07, 2015, elearn2014@gmail.com wrote:
> >> Here is a viim command
> >>
> >> nnoremap <silent> <F6>f :!firefox 'http://127.0.0.1/%:t' &<CR>
> >>
> >> What does &<CR> in the end of the command mean?
> >
> > The <CR> means a carriage return is sent at the end. The & is a Unix
> > shell directive (I'm not sure if that's the right word) to make it
> > execute the command (i.e., the firefox command) in the background and
> > immediately return control.
>
> It is not a directive, it is officially an operator:
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_03.
> And it does not need to return control at all; the only thing that
> standard says on the matter is that "the shell shall not wait for the
> command to finish before executing the next command". I have not found
> anything regarding what shall be done with backgrounded commands when
> shell exits, but all shell implementations I know simply exit without
> sending backgrounded processes anything, thus letting init take the
> parentship and background process continue to run.
>
> Shell does not return control intentionally, it simply exits when
> there are no more commands to run.

Weird. I just tried it (in the shell, not Vim) and it seems you're
right. I always thought it would send the subprocess HUP.

--
Eric Christopherson

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: