If I use * or C-W+] in a Scheme program file, the character ? is not
included
in the selected word.
What am I doing wrong? (vim 7.2.323)
Sven
I don't know. ? should be added to 'iskeyword' in
$VIMRUNTIME/ftplugin/lisp.vim, which is sourced by
$VIMRUNTIME/ftplugin/scheme.vim. Do you have filetype plugins
enabled, e.g., with
filetype plugin on
in your ~/.vimrc? What does
:verbose set ft?
show when you edit a Scheme file?
Regards,
Gary
Sun, 3 Jan 2010 13:01:58 -0800, garyjohn wrote:
>> If I use * or C-W+] in a Scheme program file, the character ? is not
>> included in the selected word.
Sorry, my description was wrong:
* works, but C-W+] (e.g. on "noun?") leads to:
E426: tag not found: noun\?
Note the escape \.
> I don't know. ? should be added to 'iskeyword' in
> $VIMRUNTIME/ftplugin/lisp.vim, which is sourced by
> $VIMRUNTIME/ftplugin/scheme.vim.
Yes, iskeyword is correctly set:
:verbose set isk (in a Scheme buffer)
iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_
Last set from /usr/local/share/vim/vim72/syntax/scheme.vim
Greetings
Sven
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?
Regards,
Gary
> 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*?[";
> 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.
Thanks for the patch. It works perfectly for me and
makes Scheme programmers happy VIM users again :-)