在vim中,启用换行时如何按屏幕行连续滚动? [英] In vim, how to scroll, continuously, by screen lines when wrapping is enabled?

查看:45
本文介绍了在vim中,启用换行时如何按屏幕行连续滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过设置display=lastline让窗口底部显示部分行

是否有类似的选项可以允许在窗口顶部显示部分行?

如果没有这个功能,当显示的最上面的文件行被包装成多个屏幕行时,我的 vim 仍然会滚动(向下)超过 1 个屏幕行.

例如,在下面的场景中,当我按下 C-E 时,我的 vim 将向下滚动 3 行屏幕.有没有办法让它只滚动1个屏幕行,这样只有第1行的前两个词被隐藏,但后面的3个词仍然显示?这对于编辑长文本段落非常有用.

注意:我指的是整个屏幕的滚动,而不是光标的移动.

<前>------------------1 abcdefg abcefgabcasdfsa sdfsf数据中心2 广告3 广告4 广告------------------

解决方案

我认为不可能完全按照您的意愿去做.

这是我输入 时得到的描述:help CTRL-E

 CTRL-ECTRL-E 在缓冲区中向下滚动窗口 [count] 行.助记符:额外的行.

请注意,虽然它说它正在滚动窗口,但它也提到它正在滚动缓冲区中的行.您确实一次只滚动一行(换行).

我认为没有其他办法可以解决这个问题.

<块引用>

我可以通过设置display=lastline让窗口底部显示部分行

我认为 display=lastline 是一个错误的解决方案 - 你仍然滚动相同的数量,你只是有更多的可见性.

解决这个问题的真正方法是禁用包装:

:set nowrap

编辑

一些相关线程表明通过屏幕线滚动"功能正在考虑中,但需要一段时间才能实现:

I can get the bottom of the window to display partial lines by setting display=lastline

Is there a similar option that would allow partial lines to be displayed at the top of a window?

Without this functionality, my vim still scrolls (down) by more than 1 screen line when the topmost file line being displayed is wrapped into multiple screen lines.

For example, in the following scenario, when I press C-E, my vim will scroll down by 3 screen lines. Is there a way to make it scroll by only 1 screen line such that only the first two words in line 1 are hidden, but the following 3 words are still displayed? This will be very useful for editing long paragraphs of text.

Note: I'm referring to the scrolling of the entire screen, not the movement of cursor.

------------------
1 abcdefg abcefg
  abcasdfsa sdfsf
  sdfc
2 adfadf
3 adfadf
4 adfadf
------------------

解决方案

I don't think it is possible to do exactly what you want.

Here's the description I get when I type :help CTRL-E

                                                             CTRL-E
CTRL-E                      Scroll windows [count] lines downwards in the buffer.
                            Mnemonic: Extra lines.

Note that while it says it is scrolling the window, it also mentions that it is scrolling lines in the buffer. You really are scrolling only one (wrapped) line at a time.

I don't think there's another way around this.

I can get the bottom of the window to display partial lines by setting display=lastline

I think display=lastline is a false solution - you still scroll the same amount, you just have more visible.

The real way to solve this is to disable wrapping:

:set nowrap

Edit

Some related threads that show that a "scrolling via screen lines" feature is under consideration, but will take a while to be implemented:

这篇关于在vim中,启用换行时如何按屏幕行连续滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆