Help understanding "key mappings" as used in perl-support package

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

Help understanding "key mappings" as used in perl-support package

Steven G. Harms
Hello,

I've just decided to add vim to my toolbox and have been trying to
learn how to use it to code Perl (my primary activity in any editor).

I loaded the perlsupport module and was reading the help menus and
came to the section:

2.  USAGE WITHOUT GUI  (Vim)                           *perlsupport-usage-vim*

Now, i like to work within a shell and so that's me.

Now it goes on to describe these "mappings" things (I've included them
at the bottom so that you can reference it in case I don't communicate
my need clearly enough.

Described are a series of many trigraphs "whack - a - w" meaning
insert a "while {}".

That sounds handy.  So if i open up a perl file the perlsupport kicks
in and does this very nice sort of title block at the top.  I then hit
G, and (i)nsert my first characters.  I type "whack - a - w" and then
on that line I have....uh "\aw".

Now, i understand about abbreviations --  shouldn't some similar magic
kick into play to make this transformation happen?

OK, so maybe this isn't an insert mode thing?  I come to that conclusion by...

A co-worker suggested i check out the 'mapleader' page.  I did so.
Per the example I was able to:

        :map <Leader>A  oanother line<Esc>

And then upon entering \A that handy little bit of magic happened.

OK, so with this perlsupport thing in place, by similar magic, i
should be able to enter \aw and have everything work out OK, right?
By process of elimination, maybe doing this in command mode is the way
to go.


So enter \aw

Nothing happens.

I'm at such a new stage that I can't tell if there's something wrong
with how I'm reading the instructions, how I'm passing the command, or
something infinitely more subtle.  Does anyone have a solution for me?

Thanks,

Steven




/ * helpdoc section from help perlsupport */

The frequently used constructs can be inserted with key mappings.  The
mappings are also described in the document perl-hot-keys.pdf (reference
card).

  -- Load / Unload Perl Support ------------      
 
  \lps    Load Perl Support    (The key mappings below are defined)
  \ups    Unload Perl Support  (The key mappings below are undefined.)
 
  -- Comments ------------------------------      
 
  \cl     Line End Comment                        
  \cf     Frame Comment
  \cu     Function Description                    
  \ch     File Header

 ... \aw  while {}
Reply | Threaded
Open this post in threaded view
|

Re: Help understanding "key mappings" as used in perl-support package

James Vega-3
On Sat, Sep 03, 2005 at 10:37:40AM -0700, Steven Harms wrote:
> Hello,
> [snip]
> I'm at such a new stage that I can't tell if there's something wrong
> with how I'm reading the instructions, how I'm passing the command, or
> something infinitely more subtle.  Does anyone have a solution for me?

It seems like you aren't using the mappings in normal mode.  Assuming
you aren't using evim and don't have 'insertmode' set, normal mode is
the mode that Vim starts in.  It is also the mode you end up in when you
press <ESC>.  I downloaded this suite and it worked just fine for me.
In normal mode, typing \aw would insert a new while statement.

:he vim-modes

James
--
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[hidden email]>

attachment0 (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Help understanding "key mappings" as used in perl-support package

Steven G. Harms
James,

This may be a newbies list, but I'm not that newbie having cut my
teeth on the internet on a SCOV box with tin, elm, and vi as my only
ways of getting around - nevertheless, never hurts to cover the basics
;) .

Just to make sure that I was in normal mode I hit <Esc> a couple
times, and then ran ":set insertmode?" and got noinsertmode back.
When i hit "\ - a w" I wind up in insert mode (as if [a]ppend were
hit) and the w character is there on the screen.

When you downloaded the suite did you have to do anything else?  I
thought I followed the README as specified - but no joy.

This is on a MacOSX box, but I also tried this on a linux box with no
success -- this is why I'm thinking that I'm doing something wrong but
am missing it.

Steven



On 9/3/05, James Vega <[hidden email]> wrote:

> On Sat, Sep 03, 2005 at 10:37:40AM -0700, Steven Harms wrote:
> > Hello,
> > [snip]
> > I'm at such a new stage that I can't tell if there's something wrong
> > with how I'm reading the instructions, how I'm passing the command, or
> > something infinitely more subtle.  Does anyone have a solution for me?
>
> It seems like you aren't using the mappings in normal mode.  Assuming
> you aren't using evim and don't have 'insertmode' set, normal mode is
> the mode that Vim starts in.  It is also the mode you end up in when you
> press <ESC>.  I downloaded this suite and it worked just fine for me.
> In normal mode, typing \aw would insert a new while statement.
>
> :he vim-modes
>
> James
> --
> GPG Key: 1024D/61326D40 2003-09-02 James Vega <[hidden email]>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Help understanding "key mappings" as used in perl-support package

Chris Allen
On 04/09/05, Steven Harms <[hidden email]> wrote:
> Just to make sure that I was in normal mode I hit <Esc> a couple
> times, and then ran ":set insertmode?" and got noinsertmode back.
> When i hit "\ - a w" I wind up in insert mode (as if [a]ppend were
> hit) and the w character is there on the screen.

If it is any consolation, I cannot get the mappings to work as
advertised on Vim7 on OS X.

Actually, it crashes gvim on OS X, so I shall have to have a look at
that later on.

HTH,
Chris Allen
Reply | Threaded
Open this post in threaded view
|

Re: Help understanding "key mappings" as used in perl-support package

James Vega-3
In reply to this post by Steven G. Harms
On Sat, Sep 03, 2005 at 11:50:27PM -0700, Steven Harms wrote:
> Just to make sure that I was in normal mode I hit <Esc> a couple
> times, and then ran ":set insertmode?" and got noinsertmode back.
> When i hit "\ - a w" I wind up in insert mode (as if [a]ppend were
> hit) and the w character is there on the screen.

Are you actually typing 4 separate keys: \, -, a, w?  If so, that's your
problem.  The mapping is "\aw" not "\-aw".

> When you downloaded the suite did you have to do anything else?  I
> thought I followed the README as specified - but no joy.

Nope. I just downloaded the suite and unzipped it in ~/.vim

James
--
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[hidden email]>

attachment0 (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Help understanding "key mappings" as used in perl-support package

Steven G. Harms
On 9/5/05, James Vega <[hidden email]> wrote:
> On Sat, Sep 03, 2005 at 11:50:27PM -0700, Steven Harms wrote:
> > Just to make sure that I was in normal mode I hit <Esc> a couple
> > times, and then ran ":set insertmode?" and got noinsertmode back.
> > When i hit "\ - a w" I wind up in insert mode (as if [a]ppend were
> > hit) and the w character is there on the screen.
>
> Are you actually typing 4 separate keys: \, -, a, w?  If so, that's your
> problem.  The mapping is "\aw" not "\-aw".

No no!  Sorry about the confusion there, I was actually using the
trigraph, I meant to hyphenate the whole string but lost my
consistency.

Steven