Tuesday, January 5, 2010

Re: Scheme language: why is ? not in word definition

Hi,

> It does that for C-], too, but as you say, it seems to do the right
> thing for *.  I don't know why.  Maybe a bug?

Yes, for some reason Vim always escapes some special characters even
if we are not going to pass them to a shell or regexp-using command.
So ":tag ident?" will work but ^] on "ident?" won't.

Below is a patch to fix that.

*** ../vim72.323/src/normal.c Thu Dec 24 19:20:14 2009
--- src/normal.c Tue Jan 5 16:19:38 2010
***************
*** 5409,5414 ****
--- 5409,5415 ----
char_u *aux_ptr;
int isman;
int isman_s;
+ int tag_cmd = FALSE;

if (cap->cmdchar == 'g') /* "g*", "g#", "g]" and "gCTRL-]" */
{
***************
*** 5515,5520 ****
--- 5516,5522 ----
break;

case ']':
+ tag_cmd = TRUE;
#ifdef FEAT_CSCOPE
if (p_cst)
STRCPY(buf, "cstag ");
***************
*** 5526,5535 ****
default:
if (curbuf->b_help)
STRCPY(buf, "he! ");
- else if (g_cmd)
- STRCPY(buf, "tj ");
else
! sprintf((char *)buf, "%ldta ", cap->count0);
}

/*
--- 5528,5541 ----
default:
if (curbuf->b_help)
STRCPY(buf, "he! ");
else
! {
! tag_cmd = TRUE;
! if (g_cmd)
! STRCPY(buf, "tj ");
! else
! sprintf((char *)buf, "%ldta ", cap->count0);
! }
}

/*
***************
*** 5562,5567 ****
--- 5568,5575 ----
aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
else if (cmdchar == '#')
aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
+ else if (tag_cmd)
+ aux_ptr = (char_u *)"\\|\"\n[";
else
/* Don't escape spaces and Tabs in a tag with a backslash */
aux_ptr = (char_u *)"\\|\"\n*?[";

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment