1

Java 有封装整个类定义的花括号。因此,当在 vim 中使用圆括号({ 或 })键时,它会转到类的末尾,而不是转到下一个空行或函数定义的末尾。那么我怎样才能拉出整个函数和评论呢?换句话说,无论位置如何,我都可以跳到下一个空白行吗?

4

3 回答 3

1

I don't fully understand the problem, vim should match curly brackets, you can use shift-% to toggle your cursor position on matched brackets. With that said, if I understand you correctly(and trying it out myself) you are getting everything under the function header when you yank with ya{. Try this: on the end { of the function header, use ma to mark the position to register a, then % to move down to the end of the method, then y'a to yank it all. This will grab the entire function.

于 2012-12-01T10:02:49.880 回答
0

This is answer I came up with and I am not happy with it. In my vimrc, I set tab to be 4 whitespaces. So if I know that my function is separated by line that has 4 white spaces, I can do

y/^\s\s\s\s$
于 2012-12-01T10:05:24.970 回答
0

当光标在方法中时,您可以拉出方法的内容,换句话说yi{y ank inner {

于 2012-12-01T09:38:12.707 回答