What's the best way to append the content of 开发者_如何学JAVAa string variable from a Vim script?
If variable contains no newlines, then use
call append(line('$'), [variable])
, you can also do
call append(line('$'), split(variable, "\n"))
,
execute "normal! Go".variable
, or
execute "normal! Go\<C-r>\<C-r>=variable\<CR>"
You could also put the variable into a register like this:
let @a = variable
normal! G
execute "put a"
This works with or without carriage returns.
精彩评论