首页 > 其他 > 详细

Inserting text in multiple lines

时间:2016-04-19 13:54:21      阅读:225      评论:0      收藏:0      [点我收藏+]

参考:http://vim.wikia.com/wiki/Inserting_text_in_multiple_lines
In visual block mode, you can press I to insert text at the same position in multiple lines, and you can press A to append text to each line in a block. As well as inserting or appending text that you type, you can insert or append text from registers, for example, the clipboard. The substitute command can also be used to insert or append text.

For example, suppose you have some Vim script:

let a = 2
let b = 3
let c = 4
You may want to make these variables script-wise (by inserting "s:" before each variable name, so "a" becomes "s:a" etc). To do this, move to the a in the first line, then press Ctrl-V (or Ctrl-Q if you use Ctrl-V for paste), then jj to select a visual block over three lines.

Now type I to start a special form of insert mode, then type the wanted text (s:). When you press Esc to exit from insert mode, the text will be inserted in the same position on each of the lines affected by the visual block selection.

Inserting text in multiple lines

原文:http://www.cnblogs.com/qike/p/5407746.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!