Christian, <C-U> won't help my problem. I've tried as your advice. but It won't help me. I am using vim-7-2 patch level 267 on Windows 7 ยทยทยท. <C-U> just does a cursor move upper about 25 lines. Anyway thank you very much.
2009/10/16 Christian Brabandt <[email protected]> > > On Fri, October 16, 2009 9:16 am, Dewr wrote: > > keymapped functions repeat when it called while vim is selecting a text > > block. > > > > I have tested with this code. > > function foobar() > > echo "foobar!" > > endfunction > > map <F5> :call foobar()<CR> > > > > I could avoid this by adding ^[ (=esc) at the head of key-mapping > command. > > Well, if you don't need the mapping in visual/select mode, then don't > define it ;) > > e.g. use nmap <F5> :call foobar()<CR> > > I believe the reason is, that the function is called each time for the > range, defined by the selection (marks '<,'> actually). So if you need > your function in visual mode, to be called only once, define the function > to take care of the range itself by adding the range keyword (see > :h function-range-example). Alternatively use <CTRL-U> to get rid of the > markers, when defining your map. > :map <F5> <C-U>:call foobar()<CR> > This ensures, that your function is only called once, but then it > doesn't know on which range it was called. > > regards, > Christian > -- > :wq > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
