Hello Tony,

Thanks for your Answer and sorry for the delay!

Well it seemed I am to stupid for this realy simple task:,(

I striped the "plugin" as simple as possible only to see if the <F1> mapping
works but  It don´t work
<br>
code cha.vim

function! AddMyHeader()
        echomsg ("Was called")
endfunction
noremap  <unique>  <script>   <Plug>HeaderAdd :call AddMyHeader()<CR>


map in .vimrc

map <F1> <Plug>HeaderAdd


If I call :map I get following maps:

   <Plug>HeaderAdd & :call AddMyHeader()<CR>
   <F9>          :!make<CR>
   <F4>          :call Fxxd()<CR>
   <F3>          :r~/CHA/template/function.txt<CR>
   <F2>          :r~/CHA/template/class.txt<CR>
   <F1>          <Plug>HeaderAdd
n  <SNR>7_Paste & :call <SNR>7_Paste()<CR>
   <xHome>       <Home>
   <xEnd>        <End>
   <S-xF4>       <S-F4>
   <S-xF3>       <S-F3>
   <S-xF2>       <S-F2>
   <S-xF1>       <S-F1>
   <xF4>         <F4>
   <xF3>         <F3>
   <xF2>         <F2>
   <xF1>         <F1>

For that I assume if I press <F1> I get the message "Was called" but all
what i get is a beep %-O

I assume that the solution is very simple, but I can´t find it at the Doku
user_41 chapter 11 and followed. Please be so kind and give me a hint how to
map the function inside the plugin and inside the .vimrc file

Thanks a lot for your patience!!!


Karsten


////-------- Never forget your towel ----------------\\\\


Tony Mechelynck-2 wrote:
> 
> 
> On 21/01/09 11:58, Maxim Kim wrote:
>>> if !hasmapto('<Plug>HeaderAdd')
>>>          map<unique>  <Leader>a<Plug>HeaderAdd
>>> endif
>>> noremap<unique>  <script>  <Plug>HeaderAdd<SID>addMyHeader
>>
>> I wonder if<Leader>a works for you.
>> What about
>> noremap<unique>  <script>  <Plug>HeaderAdd  :call<SID>addMyHeader<CR>
>> ?
>>
>>> function! addMyHeader()
> 
> 1. this function is defined without s: before its name, so you should 
> call it without <SID>
> 2. A user function defined without s: must have a name starting in a 
> capital letter
> 3. Calling a function always requires parentheses after the name
> 
>       function! AddMyHeader()
>               ...
>       endfunction
>       noremap  <unique>  <script>   <Plug>HeaderAdd
>               \ :call AddMyHeader()<CR>
> 
> or (probably better)
> 
>       function! s:addMyHeader()
>               ...
>       endfunction
>       noremap  <unique>  <script>  <Plug>HeaderAdd
>               \ :call <SID>addMyHeader()<CR>
> 
>>> ....
>>> endfunction
>>>
>>> Snipe of my .vimrc
>>>
>>> map<F1>  <Plug>HeaderAdd
>>> ...
>>>
>>> This don´t work! How to map the functions defined within a plugin to
>>> single
>>> keys???
>>>
>>> Thanks a lot and 42^42 times say: Zaphod is the president of the
>>> universe (
>>> which at least don´t help :-/)
>>>
>>> Schnullux
> 
> 
> Best regards,
> Tony.
> -- 
> Klein bottle for sale ... inquire within.
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/HowTo-map-%3CF1%3E-to-function-of-plugin--tp21561215p21599792.html
Sent from the Vim - General mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to