I was playing around with map and nested autocommands for splitting on buffers, and noticed that when I actually do a split via a map, ie:
map ,, :split <cfile><CR>
it actually goes through the whole setup process via starting the shell, loading the associated rc file, etc etc.
However, for me this process is exceedingly long because I have an involved rc file that takes an order of seconds to execute and the commands were hanging as a result. So when I tried to set it to:
export SHELL='/bin/tcsh -f'
to save on startup cost, I got a message from vim saying "Cannot execute shell '/bin/tcsh -f'"
I ended up setting it to /bin/bash just to avoid the hassle.
So a couple of things:
1. why does vim need to spawn a shell just to open up a new buffer? The command I used was "map ,, :split <cfile><CR>".
2. is it possible for vim to accept a SHELL with arguments, like the above, to avoid startup cost?
3. is there a variable, say VIMSHELL that could be used to specify the shell to use in the case that #2 is not possible?
Thanks much for any info,
Ed
Gary,
I basically did the same thing ie: used strace to get the output and it shows the opens for the shell. It also shows this in an error on the console.
I think the reason a shell opened was because of the filetype I split on - namely a perl module file, which opened up ftplugin.vim, which opens the shell.
Note that this only happens to me if I have 'ftplugin on' set in my vimrc. So you are basically at the mercy of any of your plugins as to whether or not they are going to do this.
The issue with 'set shell' for me is that it has an unpleasant side effect. At least in my setup, when you do 'vi file' it interrupts the load of the file with a 'press <enter> to continue'. I'm setting it as follows:
set shell '/bin/tcsh -f'
which is the equivalent of what you did with bash. Remove the set shell, and this goes away.
Ed