Hi All,

I wrote a very basic function in the VIM script file called test.vim

*$ cat test.vim*
function Test()
    let x = 0
    let y = 1000

    while x <= 1000
        let y -= 10
        if y <= x
            break
        endif
        let x += 1
    endwhile
    echo "X=" . x . " Y=" . y
endfunction

After sourcing the file in the vim session, I could call the function using
call.

*:call Test()*

It showed the output as *X=90 Y=90* as expected.

But, now I want to call this same function every time I press F2

So I tried mapping F2 to this function call as

*:map <F2> Test()*

But, it is not working. I guess the function is not getting called.


What I want ultimately to do is,
I would select the block of the text in the VISUAL mode and will some key
(may be F2), I want the block of the code to be commented using PERL comment
symbol (#).

Though there could be simple ways of doing it, if there are please let me
know. But I still want to write this function.

Thanks and Regards,
Prasad

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

Reply via email to