Andrzej Ostruszka wrote:
> On Fri, Jun 28 (2002), Bram Moolenaar wrote:
> > I don't see how Vim can guess that you want the shell command to be
> > converted from iso-8859-2 (what you are typing) to cp852 (what you want
> > to search for). You might be editing a cp852 file, but want search in
> > iso-8859-2 files. I don't see how this can work without manually saying
> > what you want.
> Actually I wanted to write about tags not grep. Indeed in case of grep
> there's no way to do it automatically. Well I can think of vim doing
> expansion of the wildcard passed to grep via glob(), checking if any of
> the files are already opened and if so, checking if there's any need for
> conversion of the pattern passed to grep --- for all other files one can
> use non-translated pattern. That would require several grep invocations
> and concatenation of the output.
This sounds too complicated to be built-in. You could write a script
for it and define a user command.
> In case of tags I would suggest to do check (after opening the file
> pointed by a tag --- in case the file was not already loaded in
> vim) whether there was any conversion. If so then the 'ed' command of
> the tags file (usually "whole line pattern" search) should be converted
> appropriately. This could be a problem if the ed command is
> complicated, but at least in case of the search command it should be
> straightforward. I haven't noticed any other commands but that probably
> depends on the tags generator --- has anyone encountered other commands?
This makes sense. The search pattern in the tags file should always be
byte-by-byte equal to what is in the original file. If Vim converts the
file when loading it, the search pattern needs to be converted in the
same way, otherwise the patter might not match. I'll make a remark in
the todo list for this.
ARTHUR: Be quiet!
DENNIS: Well you can't expect to wield supreme executive power just 'cause
some watery tart threw a sword at you!
ARTHUR: Shut up!
DENNIS: I mean, if I went around sayin' I was an empereror just because some
moistened bint had lobbed a scimitar at me they'd put me away!
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- Bram@...
/// Creator of Vim -- http://vim.sf.net
-- ftp://ftp.vim.org/pub/vim \\\
\\\ Project leader for A-A-P -- http://www.a-a-p.org
\\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org