How to get the contents of the current buffer in vim command line mode?

There is a vim function Send_to_Screen(text)that sends some text to a console screen session. I have a mapping

vmap <F4> "ry :call Send_to_Screen(@r)<CR>

which calls the function with the current selection. Now I want to define another mapping that calls the function with the contents of the entire buffer, but I do not make it work. I tried

nmap <F5> maggVG"ry`a :call Send_to_Screen(@r)<CR> 

but that will not work. So, how to determine the matching with the text of the current buffer?

+5
source share
1 answer

What about:

nmap <F5> :call Send_to_Screen(join(getline(1,'$'), "\n"))<CR>

getline() (1 - , "$" - ), join() ( "\n" ). :

:help getline()
:help join()
+13

All Articles