My vimrc sets the shell option:
let &shell='/bin/bash -i'
which I confirm using
echo &shell
The -i makes the shell interactive. I want to do this so that it runs ~/.bashrc, which contains the setting
shopt -s extglob
However, extglob was not being set because ~/.bashrc was not being run, which in turn seems to be because the shell is not interactive. I determined this by putting the vim cursor on each the following lines
echo $-
echo $PS1
and issuing the normal mode command !!bash. According to the Bash manual, the string returned by the first command should include the letter i if the shell is interactive, while the string returned by the second command should include the text and control characters for the prompt that is shown at the bash command line (as opposed to nothing). Both tests show the shell to be not interactive.
Why would the -i flag in the shell option be ignored? What further troubleshooting steps can I take?
!!bashwhen the vim cursor was onshopt extglob. I got conflicting extglob statuses, one on the vim command line, and another replacing the cursor line. So the shelling out was interactive, but the invocation of bash in!!bashwas not. Would you be able to complete your answer with an indication of how one might replace a bunch of contiguous lines in the vim buffer with the result of the execution of those lines by an interactive bash shell? – user2153235 Apr 04 '16 at 01:38:. w !bashdoesn't do it (as an example of applying this to the single-line range.,.. P.S. At this point, I only want the interactiveness to apply when shelling out from vim. I don't want to figure out the rat's nest of possible side-effects if I always have bash start interactively. – user2153235 Apr 04 '16 at 01:41!!bash -i? – muru Apr 04 '16 at 01:42$Use "exit" to leave the shell.. If this is the only way, I have some troubleshooting ahead of me. – user2153235 Apr 04 '16 at 01:45shopt -s nullglobfor some commands in your current file, why not addshopt -s nullglobas the first command? – muru Apr 04 '16 at 01:47~/.bashrcto determine if the 11 repeated messages was due to recursive invocation of~/.bashrc, but it wasn't. If I bang out on a lineecho dog, the 11 repetitions occur after thedogmessage. – user2153235 Apr 04 '16 at 01:49:!commands. – user2153235 Apr 04 '16 at 02:12