在 Vim 或 gVim 中移动到大文件的中间

Moving to middle of huge file in Vim or gVim

有没有不用计算(total lines/2)和使用j就可以移动到大文件中间的Vim命令?像 zzztzb 这样的东西,它只在当前屏幕上移动?

您可以使用 vim 从 elvis 借来的功能之一:它直接接受一定比例的文件。例如,键入

50%

跳到文件中间。

在vim中,如果输入

:h up-down-motions

导致 section 描述功能:

{count}%    Go to {count} percentage in the file, on the first
            non-blank in the line |linewise|.  To compute the new
            line number this formula is used:
                ({count} * number-of-lines + 99) / 100
            See also 'startofline' option.  {not in Vi}