Bug#542430: [vim] vim try to expand files or directories that contain ~ (when using tcsh shell)

James Vega jamessan at debian.org
Tue Nov 3 20:52:44 UTC 2009

On Thu, Aug 20, 2009 at 9:28 AM, James Vega <jamessan at debian.org> wrote:
> On Wed, Aug 19, 2009 at 05:55:54PM +0200, gregory hainaut wrote:
>> Please find attached a patch that seems solve the problem not sure it
>> is the good solution (and works in all situations). Maybe a solution
>> will be to escaped ~ like '\~' before sending to the tcsh shell.
> This looks good to me.  I'll forward it upstream and see what he thinks.
> Thanks for the patch. :)

Looking into this further, this isn't actually a problem with using tcsh
or the expansion of '~'.  The problem is what that Vim isn't properly
detecting which shell you're using because you've set 'shell' to
"/bin/tcsh -f" instead of simply "/bin/tcsh".

In src/os_unix.c

5354     else if ((len = STRLEN(p_sh)) >= 3)
5355     {
5356         if (STRCMP(p_sh + len - 3, "csh") == 0)
5357             shell_style = STYLE_GLOB;

Vim checks whether the last 3 characters of 'shell' are "csh".  Since
that fails with your setting, Vim then uses an sh-compatible method for
expansion.  This obviously fails with tcsh.

So, the simple workaround for now is to simply "set shell=/bin/tcsh".
I'll send this information to Bram so he knows about it.

GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan at debian.org>

More information about the pkg-vim-maintainers mailing list