我如何从中得到:
String[] strings = new String[combined2d.size()];
for (int i = 0; i < combined2d.get(0).size(); i++){
for (int j = 0; j < combined2d.size(); j++){
strings[j] = combined2d.get(j).get(i);
}
FuncA(strings[0] strings[1], strings[2]);
}
到此:
hello world
hello world
hello world
hello world
使用vim-surround或vim-emmet。
当我突出显示文字时,按ctrl + y然后按&#39;,&#39;我可以键入p标签,但它在一个p标签中包围所有4个段落。
答案 0 :(得分:6)
vjjj " select the block (or whatever works for your actual use case)
:norm yss<p><CR> " execute the normal mode yss command provided by Surround
" on each line of the selection
" note that Vim automatically inserts the range corresponding
" to your visual selection: :'<,'>norm ...
或者如果您对范围有信心:
:,+3norm yss<p><CR>
C<p><C-r><C-o>"</p><Esc>
j0.
j0.
j0.
或变体:
C<p><C-r><C-o>"</p><Esc>
jvjj
:'<,'>norm .
如果您对范围有信心,可以使用上述变体的变体:
C<p><C-r><C-o>"</p><Esc>
:+,+2norm .
或上述三种变体的单步变体:
:,+3norm C<p><C-v><C-r><C-v><C-o>"</p><CR>
或者使用超级简单替换的完全不同的方法:
:,+3s@.*@<p>&</p><CR>
:help C
:help ctrl-r_ctrl-o
:help registers
:help .
:help :normal
:help :range
:help :s