开发者

Appending a message to a buffer from a Vim script

开发者 https://www.devze.com 2023-01-10 20:59 出处:网络
What\'s the best way to append the content of 开发者_如何学JAVAa string variable from a Vim script?If variable contains no newlines, then use

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号