From: "A.J.Mechelynck" <[EMAIL PROTECTED]>
Subject: Re: Mapping of keysequences...
Date: Sun, 01 Oct 2006 18:40:47 +0200

> Meino Christian Cramer wrote:
> > From: Mikolaj Machowski <[EMAIL PROTECTED]>
> > Subject: Re: Mapping of keysequences...
> > Date: Sun, 1 Oct 2006 15:09:56 +0200
> > 
> >> Dnia niedziela, 1 października 2006 14:54, Meino Christian Cramer napisał:
> >>> Hi,
> >>>
> >>>  is it possible to map the sequence of
> >>>
> >>>  <C-C><C-F>b
> >>>
> >>>  to anything (and how?)?
> >>>
> >>>  I tried as a first brute-force experiment
> >>>
> >>>  noremap  <C-C><C-F>b echo "works"
> >> If you want to print it in the buffer it should be::
> >>
> >>     noremap  <C-C><C-F>b iecho "works"
> >>
> >> If you want to echo it in command line::
> >>    
> >>     noremap  <C-C><C-F>b :echo "works"
> >>
> >> Normal mode mappings begin in Normal mode, not Insert or Command-Line.
> >>
> >> m.
> >>
> > 
> > Hmmmppff....I got a problem here...
> > 
> > What I want is to insert the string "{\bf }" (TeX!) in a buffer. It
> > should work in insert mode. I want to press <C-C><C-F>b in insert mode
> > and it should print "{\bf }" at the place where currently the cursor
> > is.
> > 
> > I did 
> > 
> >   inoremap <C-C><C-F>b iecho "{\bf }"
> > 
> > . And guess what happens? It prints "iecho {\bf }" into the buffer!
> > When using 'noremap' instead of 'inoremap' nothing happens. 
> > 
> >      :he iecho 
> > 
> > gives me simply nothing. Is there any needle in the haystack I can
> > search for?
> > 
> > Keep hacking!
> > mcc
> > 
> > 
> 
> If you are already in Insert mode, the right-hand side of the mapping is used 
> as if you had typed it. To insert left-brace backslash bee eff space 
> right-brace, use
> 
>       :inoremap       <C-C><C-F>b     {\bf }
> 
> To do the same from Normal mode, use
> 
>       :noremap        <C-D><C-F>b     i{\bf }<Esc>
> 
> with i to enter Insert mode and <Esc> to leave it.
> 
> 
> Best regards,
> Tony.
> 

Hi Tony !

 nice to read you again! And thank you very much for your
 help,help,help... :)  <- BIG smiley!

 Slowly and surely I get my TeX macro working...

 What I have now is the following:

   inoremap <C-C><C-F>b {\bf #}<ESC>?#<CR>c/}<CR>
   inoremap <C-C><C-F>i {\it #}<ESC>?#<CR>c/}<CR>
   inoremap <C-C><C-F>s {\sl #}<ESC>?#<CR>c/}<CR> 

 which "works". A last wish I would have is: After 'c'hanging the '#'
 to what I really want to typeset I will press <ESC> to leave
 'c'hanging and insert mode. But my cursor still is inside of the {}....

 Is it possible to let the macros recognize the pressing of '<ESC>'
 and then jump behind the '}' and may be entering 'i'nsert mode again?

 Or may be I need a completly different implementation of those macros
 for that?

 I often feel, that I am not thinking vim-y enough. ;o)

 Thanks a lot for all your help!

 Keep hacking!
 mcc

Reply via email to