如何在Vim中逐行而不是逐段滚动屏幕?

时间:2012-06-29 06:54:37

标签: vim scroll vi

换行模式,如果一个段落有多行,当它到达顶部的窗口,然后按Ctrl + E,此段落将完全消失。 有没有办法让它只是减少顶线而不是整个段落?

看到屏幕变化太突然,我经常找不到位置。

2 个答案:

答案 0 :(得分:3)

在换行中以伪线方式进行改变:

 noremap j gj
 noremap k gk

并添加

set scrolloff = 3   " so you always have 3 lines on bottom and top or 
set scrolloff = 999 " to have the cursor(line) always in the middle 

并找到位置,将其放入.vimrc

set cursorline
if &term =~ "xterm\\|rxvt"
    " use a green cursor in insert mode
    let &t_SI = "\<Esc>]12;green\x7"
    " use an orange cursor otherwise
    let &t_EI = "\<Esc>]12;orange\x7"
    silent !echo -ne "\033]12;orange\007"
    " reset cursor when vim exits
    autocmd VimLeave * silent !echo -ne "\033]12;white\007"
    " use \003]12;gray\007 for gnome-terminal
endif

它使光标在插入模式下变为绿色,否则变为橙色 - 那些\<esc>]12;green\x7只是告诉终端它应该这样做 - 用南方语言或其他东西的语言,因为这是多久的终端;-)。

这在您的.gvimrc

highlight Cursor guifg=black guibg=DarkOrange
highlight iCursor guifg=black guibg=Green
set guicursor=n-v-c:block-Cursor
set guicursor+=i:ver100-iCursor
set guicursor+=n-v-c:blinkon0
set guicursor+=i:blinkwait0

最后三行不是必要的,但我不喜欢眨眼

答案 1 :(得分:2)

问题经常被问到,答案总是“你不能”

可以使用gjgk将光标“虚拟线”移动到包裹线内的“虚拟线”,但它对滚动问题没有任何帮助:Vim不能仅显示包装的x“虚线”。