Re: non-posix compliant shells
On Fri, 16 Nov 2007 16:10:40 +0100, Vladimir Marek <[EMAIL PROTECTED]> wrote: > I do have > > :set shell=/bin/sh > > This just says to vim, to use /bin/sh for executing external commands. > It does not say which shell I should use for my interactive work. > > Then I run > > :!fish > > Welcome to fish, the friendly interactive shell > Type help for instructions on how to use fish > [EMAIL PROTECTED] ~> echo $version > 1.22.3 > [EMAIL PROTECTED] ~> > > And I do have fish shell. > > Now the problem is, when I exit > > [EMAIL PROTECTED] ~> exit > > Good bye > > [1]+ Stopped vi > > It somehow stops vim. When I bring it to foreground (using fg), vi > continues normally. I've seen something similar using recent versions of zsh. When I start a zsh subshell from Vim and then exit the shell, Vim bombs out with a message about being unable to read its input. I tried to work out what was happening but had trouble understanding how a child process could influence its parent in that way. In the end I gave up and "fixed" the problem by using an older version of zsh (3.1.9). -- Matthew Winn --~--~-~--~~~---~--~~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: non-posix compliant shells
> > Maybe I misunderstood here. If you want to tell vim to use /bin/sh all > > the time, just put "set shell=" unconditionally into your vimrc. > > That's clear, but I'd like to use fish and not /bin/sh as shell. > > You can always run > > > > :!fish > > That's the problem - it does not work - and you can try for yourself. Id does work for me, through there is really some problem. I do have :set shell=/bin/sh This just says to vim, to use /bin/sh for executing external commands. It does not say which shell I should use for my interactive work. Then I run :!fish Welcome to fish, the friendly interactive shell Type help for instructions on how to use fish [EMAIL PROTECTED] ~> echo $version 1.22.3 [EMAIL PROTECTED] ~> And I do have fish shell. Now the problem is, when I exit [EMAIL PROTECTED] ~> exit Good bye [1]+ Stopped vi It somehow stops vim. When I bring it to foreground (using fg), vi continues normally. > > > After switching to xmonad WM, i (mostly) replaced gvim with vim > > > running it in fullscreen session and I'd be more than happy being > > > able to jump into my default (fish) shell to perform e.g. > > > darcs-related tasks and not having to switch to another fish term. > > > > Let's try to state the question differently. What's wrong if you > > :set shell=/bin/sh ? Some part of vim behaves differently than what > > would you want ? > > I'd like to be able to do :set shell=/usr/bin/fish and use it. I still don't see the reason. If you ":set shell=/usr/bin/fish", it does not change vim behavior, only if you run external commands like ":%!sort" it will try to use fish instead of sh. Can you be here more specific and give example of what behaves differently ? -- Vlad pgpYiynhDiAki.pgp Description: PGP signature
Re: non-posix compliant shells
On Fri, 16 Nov 2007 16:10:40 +0100 Vladimir Marek <[EMAIL PROTECTED]> wrote: > This just says to vim, to use /bin/sh for executing external commands. > It does not say which shell I should use for my interactive work. Hmm, then I must wrongly understood the vim's help: :sh[ell]This command starts a shell. When the shell exits (after the "exit" command) you return to Vim. The name for the shell command comes from 'shell' option. afaiu, the 'shell' option decided which shell will vim use with :sh command, or am I wrong? > It somehow stops vim. When I bring it to foreground (using fg), vi > continues normally. I've problem bringing vim back. Can you try to make experiment by using fish as default shell? > I still don't see the reason. If you ":set shell=/usr/bin/fish", it > does not change vim behavior, only if you run external commands like > ":%!sort" it will try to use fish instead of sh. > > Can you be here more specific and give example of what behaves > differently ? Well, as said above - I just want to be able to be put in fish shell when I execute :sh in vim. Maybe I'm missing something... Sincerely, Gour signature.asc Description: PGP signature
Re: non-posix compliant shells
James Vega wrote: >On Fri, Nov 16, 2007 at 10:01:03AM -0500, Charles E Campbell Jr wrote: > > >>gour wrote: >> >> >>>I hit the problem in vim yesterday when I wanted to run fish shell >>>(http://fishshell.org) within vim and soon got informed that the >>>problem is >>> >>> >>Exactly what is the problem? Are you trying to use system(), or filters >>(:!), or what? >> >> > >It's easily observable using system() but anything else that tries to >invoke commands in a subshell and capture the output will run into the >same problem. Vim is running this command > > /usr/bin/fish -c "(ls /tmp) >/tmp/v244859/1" > >fish doesn't allow you to use a subshell command as the actual command >being run. That is, the above command-line errors out (in an >interactive shell) with "Illegal command name (ls /tmp)". Vim should >simply be running it as > > /usr/bin/fish -c "ls /tmp >/tmp/v244859/1" > >From what I've seen in Vim's shell-related options, there isn't anything >to affect this. > > I wrote a small C program: /* myecho.c: this program simply echos its arguments to * Author: Charles E. Campbell, Jr. * Date: Nov 16, 2007 */ #include #include /* - */ /* main: {{{2 */ int main( intargc, char **argv) { char buf[256]; char *b; int i; FILE *fp; for(i= 0, b= buf; i < argc; ++i) { sprintf(b,"%s%s", argv[i], (i == argc-1)? "" : " "); b+= strlen(b); } fp= fopen("myecho.out","w"); fprintf(fp,"%s\n",buf); fclose(fp); return 0; } compiled it (to myecho), brought up Vim, then :set shell=/home/cec/myecho . I then tried :!ls and myecho.out was: /home/cec/myecho -c ls /tmp No subshells there! I then tried :call system("ls /tmp") and got: (an error message about not being able to open E484: Can't open file /tmp/v238233/2, because myecho doesn't do such things) /home/cec/myecho -c (ls /tmp) >/tmp/v238167/2 Finally I tried filtering (one line, ls /tmp, used V!ls). Got the now expected E484, and myecho.out shows: /home/cec/myecho -c (ls) < /tmp/v238333/2 >/tmp/v238333/3 So: two out of three methods of using the shell do seem to use subshells. Regards, Chip Campbell --~--~-~--~~~---~--~~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: non-posix compliant shells
On Fri, 16 Nov 2007 17:36:52 +0100 Vladimir Marek <[EMAIL PROTECTED]> wrote: > Sure, what are your exact steps ? chsh and then /usr/bin/fish Sincerely, Gour signature.asc Description: PGP signature
Re: non-posix compliant shells
On Fri, Nov 16, 2007 at 10:31:20AM -0500, James Vega wrote: > Vim is running this command > > /usr/bin/fish -c "(ls /tmp) >/tmp/v244859/1" > > fish doesn't allow you to use a subshell command as the actual command > being run. That is, the above command-line errors out (in an > interactive shell) with "Illegal command name (ls /tmp)". Vim should > simply be running it as > > /usr/bin/fish -c "ls /tmp >/tmp/v244859/1" Actually, this doesn't stick to the original intent of the command Vim is actually running. The following is probably a better implementation /usr/bin/fish -c "begin; ls /tmp; end >/tmp/v244859/1" since that allows multiple commands to be run and the output of all of them will be redirected to the file. James -- GPG Key: 1024D/61326D40 2003-09-02 James Vega <[EMAIL PROTECTED]> signature.asc Description: Digital signature
Re: non-posix compliant shells
On Fri, Nov 16, 2007 at 10:01:03AM -0500, Charles E Campbell Jr wrote: > > gour wrote: > > >I hit the problem in vim yesterday when I wanted to run fish shell > >(http://fishshell.org) within vim and soon got informed that the > >problem is > > > > > Exactly what is the problem? Are you trying to use system(), or filters > (:!), or what? It's easily observable using system() but anything else that tries to invoke commands in a subshell and capture the output will run into the same problem. Vim is running this command /usr/bin/fish -c "(ls /tmp) >/tmp/v244859/1" fish doesn't allow you to use a subshell command as the actual command being run. That is, the above command-line errors out (in an interactive shell) with "Illegal command name (ls /tmp)". Vim should simply be running it as /usr/bin/fish -c "ls /tmp >/tmp/v244859/1" From what I've seen in Vim's shell-related options, there isn't anything to affect this. James -- GPG Key: 1024D/61326D40 2003-09-02 James Vega <[EMAIL PROTECTED]> signature.asc Description: Digital signature
Re: non-posix compliant shells
> Hmm, then I must wrongly understood the vim's help: > > :sh[ell] This command starts a shell. When the shell > exits (after the "exit" command) you return to Vim. The name for the > shell command comes from 'shell' option. No, you understand correctly. I just don't use for fish invocation :set shell=/usr/bin/fish :shell but rather :!fish :! executes any program, so why not fish > afaiu, the 'shell' option decided which shell will vim use with :sh > command, or am I wrong? Yes, that's correct, and now I understand where your problem is. :!fish is workaround. Another workaround might be :command Sh :!fish and use (capital S) :Sh > > It somehow stops vim. When I bring it to foreground (using fg), vi > > continues normally. > > I've problem bringing vim back. Can you try to make experiment by using > fish as default shell? Sure, what are your exact steps ? -- Vlad pgptP9LhGdnk1.pgp Description: PGP signature
Re: non-posix compliant shells
Hi, > Googling a bit brought me to this thread http://tinyurl.com/3cgns7 > which provides 'workaround', i.e. putting something like: Snip from the thread: = cut == i still think that the best way would be to teach app developers that they must not expect that shells are posix compatible but should rather explicitly call a posix shell if they need one. And you are doing exactly that by having this setting. > if $SHELL =~ 'fish' >set shell=/bin/sh > endif > However, the 'workaround' means only to be able to use shell with vim > when one has fish as default shell, but not using fish. Maybe I misunderstood here. If you want to tell vim to use /bin/sh all the time, just put "set shell=" unconditionally into your vimrc. > Short discussion on #vim confirmed that, somehow, vim has posix- > compliancy hardwired, so the question is if there is some prospect in > the future that vim can execute posx non-compliant shells like fish? And what interface exactly should vim use ? Every non-posix shell will probably have different one, so you would have to support them one by one. > After switching to xmonad WM, i (mostly) replaced gvim with vim > running it in fullscreen session and I'd be more than happy being able > to jump into my default (fish) shell to perform e.g. darcs-related > tasks and not having to switch to another fish term. You can always run :!fish Let's try to state the question differently. What's wrong if you :set shell=/bin/sh ? Some part of vim behaves differently than what would you want ? > Moreover, after 'discovering' the shell-problem, I was quickly > ridiculed by some emxxx users :-( I don't think that emacs supports fish (but I might be wrong). The advantage which emacs has here, is that it can run commandline in a window, so you may start fish (or perl, python, etc.) in window and still edit text in other window. Hope this helps -- Vlad pgphCluLy1L0Y.pgp Description: PGP signature
Re: non-posix compliant shells
gour wrote: >I hit the problem in vim yesterday when I wanted to run fish shell >(http://fishshell.org) within vim and soon got informed that the >problem is > > Exactly what is the problem? Are you trying to use system(), or filters (:!), or what? Please give an example of something you're trying to do that the choice of shell impacts. Vim has a number of options that are shell related, perhaps you need to find the right set for fish: " set shell : name of shell to use for ! and :! commands " set shq : shellquote -- how to quote characters about the cmd passed to shell " set sxq : shellxquote -- includes redirection (shellquote excludes that) " set ssl : shellslash -- when set, forward slash used to expand file names " set shcf : shellcmdflag -- flag passed to shell to execute ! and :! commands " set sp: shellpipe-- string used to put output of :make into errorfile " set srr : shellredir -- string used to put output of filter cmd into temporary file As an example of a shell that's certainly not Posix compliant -- note that vim works under VMS. Its paths aren't '/' separated (ex. [abc.def.ghi]file.c ) Regards, Chip Campbell --~--~-~--~~~---~--~~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: non-posix compliant shells
On Fri, 16 Nov 2007 12:13:37 +0100 Vladimir Marek <[EMAIL PROTECTED]> wrote: > Maybe I misunderstood here. If you want to tell vim to use /bin/sh all > the time, just put "set shell=" unconditionally into your vimrc. That's clear, but I'd like to use fish and not /bin/sh as shell. > And what interface exactly should vim use ? No idea. > Every non-posix shell will probably have different one, so you would > have to support them one by one. Recently I hit the similar problem with darcs where one command was chaining shell commands with '&&' which was not understood by fish, but devs found elegant solution. > > After switching to xmonad WM, i (mostly) replaced gvim with vim > > running it in fullscreen session and I'd be more than happy being > > able to jump into my default (fish) shell to perform e.g. > > darcs-related tasks and not having to switch to another fish term. > > You can always run > > :!fish That's the problem - it does not work - and you can try for yourself. > Let's try to state the question differently. What's wrong if you > :set shell=/bin/sh ? Some part of vim behaves differently than what > would you want ? I'd like to be able to do :set shell=/usr/bin/fish and use it. > I don't think that emacs supports fish (but I might be wrong). The > advantage which emacs has here, is that it can run commandline in a > window, so you may start fish (or perl, python, etc.) in window and > still edit text in other window. I dunno, never really tried to use emacs, but I'm told it does not have problem with fish. > Hope this helps Thank you for your input. Sincerely, Gour signature.asc Description: PGP signature