Vim 设置 scrolloff=one-paragraph

Vim 设置 scrolloff=one-paragraph

我习惯于scrolloff查看我正在处理的行周围的一些上下文。我真正关心的是上下文是否可见,而不是任意数量的行。

在 vim 中这样的事可行吗(可以编写脚本)?

为了说明这一点,假设我跳到以下段落:

                    *:pta* *:ptag*
:pta[g][!] [tagname]
        Does ":tag[!] [tagname]" and shows the found tag in a
        "Preview" window without changing the current buffer or cursor
        position.  If a "Preview" window already exists, it is re-used
        (like a help window is).  If a new one is opened,
        'previewheight' is used for the height of the window.   See
        also |:tag|.
        See below for an example. |CursorHold-example|
        Small difference from |:tag|: When [tagname] is equal to the
        already displayed tag, the position in the matching tag list
        is not reset.  This makes the CursorHold example work after a
        |:ptnext|.

理想的滚动方式是显示整个段落(假设它适合屏幕)。为了确保这一点,我至少需要scrolloff=15在这种情况下。

相关内容