Reputation: 24535
I have this function which get all text of current tab and does an echo on it.
function! Copy2new ()
let alltext = getline(1,'$')
for s in alltext
echo s
endfor
endfunction
I know that :tabnew
can create a new tab. How can I use above function to put entire text of one buffer to a new tab?
Upvotes: 2
Views: 65
Reputation: 3366
Copies current buffer into a new buffer in a new tab
function! Copy2new()
let alltext = getline(1,'$')
tabnew
call setline('.', alltext)
endfunction
Upvotes: 2