The origin of mappings and abbreviations.

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

The origin of mappings and abbreviations.

Eric Leenman
Hi,

How do you recall where certain mappings and/or abbreviations are
born/sourced/created?
I'm trying to recall a certain mapping and abbreviation to change it but
can't find it in my files?

Rgds,
Eric


Disclaimer; The information contained in this communication is confidential
and may be legally privileged. It is intended solely for the use of the individual
or entity to whom it is addressed and others authorized to recieve it.
Use of this information, in whatever way, by others is strictly prohibited
and may be unlawful. GREEFA does not accept legal responsibility
for this e-mail message due to the insecure nature of internet
communications.  
Reply | Threaded
Open this post in threaded view
|

Re: The origin of mappings and abbreviations.

A.J.Mechelynck
Eric Leenman wrote:
> Hi,
>
> How do you recall where certain mappings and/or abbreviations are
> born/sourced/created?
> I'm trying to recall a certain mapping and abbreviation to change it but
> can't find it in my files?
>
> Rgds,
> Eric
[corporate disclaimer snipped]

In Vim 7, just use ":verbose map" ":verbose map!" ":verbose abbrev" etc.

In Vim 6.3 and earlier, you will have to guess based on the order of the
mappings in the output of ":map", the order of scripts in the output of
":scriptnames" and/or the {rhs} of the mapping. For instance, if <SNR>
is present in the {rhs}, the number immediately following it is the
number of the script (as listed by :scriptnames) which defined the
mapping. (The sequence <SNR>nn_ where nn is the script number,
translates what was entered as <SID> in the script source.)

Best regards,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: The origin of mappings and abbreviations.

R Sam
In reply to this post by Eric Leenman
Hi,

I use a script to find where mappings are created and exist. The script is
called "WhereFrom.vim", written by Charles E. Campbell and seems to
work great. It does not work with abbreviations however. (That would be
a nice feature to add).

Regards,
-Sam

On 10/4/05, Eric Leenman <[hidden email]> wrote:

> Hi,
>
> How do you recall where certain mappings and/or abbreviations are
> born/sourced/created?
> I'm trying to recall a certain mapping and abbreviation to change it but
> can't find it in my files?
>
> Rgds,
> Eric
>
>
> Disclaimer; The information contained in this communication is confidential
> and may be legally privileged. It is intended solely for the use of the individual
> or entity to whom it is addressed and others authorized to recieve it.
> Use of this information, in whatever way, by others is strictly prohibited
> and may be unlawful. GREEFA does not accept legal responsibility
> for this e-mail message due to the insecure nature of internet
> communications.
>
Reply | Threaded
Open this post in threaded view
|

Re: The origin of mappings and abbreviations.

A.J.Mechelynck
R Sam wrote:
> Hi,
>
> I use a script to find where mappings are created and exist. The script is
> called "WhereFrom.vim", written by Charles E. Campbell and seems to
> work great. It does not work with abbreviations however. (That would be
> a nice feature to add).
>
> Regards,
> -Sam

As an even nicer feature, in Vim version 7 (and, presumably, later ;-)
), when listing mappings, abbreviations, autocommands, etc., with
'verbose' set to 1 or more, Vim itself will tell you where they were set
without the need for a plugin.


Best regards,
Tony.

Reply | Threaded
Open this post in threaded view
|

RE: The origin of mappings and abbreviations.

Keith W. Roberts
In reply to this post by Eric Leenman
----Original Message----
From: A. J. Mechelynck [mailto:[hidden email]]
Sent: Thursday, October 13, 2005 7:50 AM
To: R Sam
Cc: Eric Leenman; vim
Subject: Re: The origin of mappings and abbreviations.

> R Sam wrote:
>> Hi,
>>
>> I use a script to find where mappings are created and exist. The
>> script is called "WhereFrom.vim", written by Charles E. Campbell and
>> seems to work great. It does not work with abbreviations however.
>> (That would be a nice feature to add).
>>
>> Regards,
>> -Sam
>
> As an even nicer feature, in Vim version 7 (and, presumably, later ;-)
> ), when listing mappings, abbreviations, autocommands, etc., with
> 'verbose' set to 1 or more, Vim itself will tell you where
> they were set
> without the need for a plugin.
>
>
> Best regards,
> Tony.

Actually, IIUC that will tell you the *last* place it was set, which is
*usually* what you want. :)  But I could see wanting to know *all* the
places it's set as well.

-Keith
Reply | Threaded
Open this post in threaded view
|

RE: The origin of mappings and abbreviations.

Edward Ash
In reply to this post by Eric Leenman

You could always grep for the ab command in your vim files.  that would
give you a listing of all your abbreviations, and where they are being
set.  
I realize that this isn't the fancy solution, but it will get the job done.
Eddie

> ----Original Message----
> From: A. J. Mechelynck [mailto:[hidden email]]
> Sent: Thursday, October 13, 2005 7:50 AM
> To: R Sam
> Cc: Eric Leenman; vim
> Subject: Re: The origin of mappings and abbreviations.
>
> > R Sam wrote:
> >> Hi,
> >>
> >> I use a script to find where mappings are created and exist. The
> >> script is called "WhereFrom.vim", written by Charles E. Campbell and
> >> seems to work great. It does not work with abbreviations however.
> >> (That would be a nice feature to add).
> >>
> >> Regards,
> >> -Sam
> >
> > As an even nicer feature, in Vim version 7 (and, presumably, later ;-)
> > ), when listing mappings, abbreviations, autocommands, etc., with
> > 'verbose' set to 1 or more, Vim itself will tell you where
> > they were set
> > without the need for a plugin.
> >
> >
> > Best regards,
> > Tony.
>
> Actually, IIUC that will tell you the *last* place it was set, which is
> *usually* what you want. :)  But I could see wanting to know *all* the
> places it's set as well.
>
> -Keith
>
>

--

Reply | Threaded
Open this post in threaded view
|

RE: The origin of mappings and abbreviations.

Keith W. Roberts
In reply to this post by Eric Leenman
----Original Message----
From: Edward Ash [mailto:[hidden email]]
Sent: Thursday, October 13, 2005 10:43 AM
To: vim
Subject: RE: The origin of mappings and abbreviations.

>> ----Original Message----
>> From: A. J. Mechelynck [mailto:[hidden email]]
>> Sent: Thursday, October 13, 2005 7:50 AM
>> To: R Sam
>> Cc: Eric Leenman; vim
>> Subject: Re: The origin of mappings and abbreviations.
>>
>>> R Sam wrote:
>>>> Hi,
>>>>
>>>> I use a script to find where mappings are created and exist. The
>>>> script is called "WhereFrom.vim", written by Charles E. Campbell
>>>> and seems to work great. It does not work with abbreviations
>>>> however. (That would be a nice feature to add).
>>>>
>>>> Regards,
>>>> -Sam
>>>
>>> As an even nicer feature, in Vim version 7 (and, presumably, later
>>> ;-) ), when listing mappings, abbreviations, autocommands, etc.,
>>> with 'verbose' set to 1 or more, Vim itself will tell you where
>>> they were set
>>> without the need for a plugin.
>>>
>>>
>>> Best regards,
>>> Tony.
>>
>> Actually, IIUC that will tell you the *last* place it was set, which
>> is *usually* what you want. :)  But I could see wanting to know
>> *all* the places it's set as well.
>>
>> -Keith
>
> You could always grep for the ab command in your vim files.
> that would
> give you a listing of all your abbreviations, and where they are
> being set. I realize that this isn't the fancy solution, but it will
> get
> the job done.
> Eddie

More like:  grep ^\s*:\=[nci]\=\(ore\)\=ab\i*\s\+abbrev.to.look.for

- that assumes my particular usage; generalizing would be worse
- and you have to translate that regex according to the flavor of the
grep
- and that doesn't catch unabbrevs

Possibly:  grep ^\s*:\=\i*ab\(b\|brev\)\=\s\+abbrev.to.look.for

-Keith
Reply | Threaded
Open this post in threaded view
|

Re: The origin of mappings and abbreviations.

Charles E Campbell Jr
In reply to this post by Keith W. Roberts
Keith W. Roberts wrote:

>----Original Message----
>From: A. J. Mechelynck [mailto:[hidden email]]
>Sent: Thursday, October 13, 2005 7:50 AM
>To: R Sam
>Cc: Eric Leenman; vim
>Subject: Re: The origin of mappings and abbreviations.
>
>  
>
>>R Sam wrote:
>>    
>>
>>>Hi,
>>>
>>>I use a script to find where mappings are created and exist. The
>>>script is called "WhereFrom.vim", written by Charles E. Campbell and
>>>seems to work great. It does not work with abbreviations however.
>>>(That would be a nice feature to add).
>>>
>>>Regards,
>>>-Sam
>>>      
>>>
>>As an even nicer feature, in Vim version 7 (and, presumably, later ;-)
>>), when listing mappings, abbreviations, autocommands, etc., with
>>'verbose' set to 1 or more, Vim itself will tell you where
>>they were set
>>without the need for a plugin.
>>
>>
>>Best regards,
>>Tony.
>>    
>>
>
>Actually, IIUC that will tell you the *last* place it was set, which is
>*usually* what you want. :)  But I could see wanting to know *all* the
>places it's set as well.
>  
>

The WhereFrom plugin will do that --- it'll search the runtime path...

:WhereFrom! functionname
:WhereFrom! maps
:WhereFrom! commands

(or :WF! for short)

See http://vim.sourceforge.net/scripts/script.php?script_id=1203

Regards,
Chip Campbell