Le jeudi 15 janvier 2015 à 01:08, Cesar Romani a écrit: > I'm using vim 7.4.580 on Windows 7. I have the following code to delete > a displaced range of lines on a text: > > ---------- > function! Foobar(num) range > exe (a:firstline+a:num).','.(a:lastline+a:num).'d' > endfunc > com! -range -nargs=1 Foobar call Foobar(<q-args>) > ---------- > > When I select a range of lines and run 'call Foobar(5)' it works, > but when I run 'Foobar 5' it doesn't work. > > Where can be the error?
The range isn’t passed from the command to the function call; the command should be defined as: com! -range -nargs=1 Foobar <line1>,<line2>call Foobar(<args>) Best, Paul -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.