Thursday, January 3, 2019

Problem with function

I'm using vim 8.1.682 on Windows.
I'd like to know what is wrong with following function?:

function! Finalize()
:'<,'>join
:s/ /,/g
endfunction
vmap ,f :call Finalize()<cr>

If I visually select the following text:

2.233 2.204
2.077 2.066 1.987
6.381 6.372 6.427 6.437
6.152 6.115

It correctly executes, but I get the error:
E16: Invalid range

But if I execute separately each line inside the function, i.e.
:'<,'>join
:s/ /,/g

I don't get any error

Thanks in advance,

--
Cesar

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: