Vim
如何在vim中將目前行放在螢幕的頂部/中心/底部?
任何更快的導航技巧,將游標目前所在的行放置到
- 螢幕頂部?
- 螢幕中央?
- 螢幕底部?
z<CR>
或zt
將目前行放在螢幕頂部(<CR>
==Enter
)
z.
或zz
將目前行放在螢幕中心
z-
或zb
將目前行放在螢幕底部(
z<CR>
,z.
,z-
並將游標放在第一個非空白列中。zt
,zz
, 並將zb
游標留在目前列中)有關在http://vimdoc.sourceforge.net/htmldoc/scroll.html 或
vim 類型中滾動的更多資訊
:help scroll-cursor
:help scroll-cursor
@mtk 提及的輸出。zz
請注意,和之間存在差異z.
。相對於游標滾動(scroll-cursor)
以下命令重新定位編輯視窗(您看到的緩衝區的一部分),同時將游標保持在同一行:
z<CR> Redraw, line [count] at top of window (default cursor line). Put cursor at first non-blank in the line. zt Like "z<CR>", but leave the cursor in the same column. {not in Vi} z{height}<CR> Redraw, make window {height} lines tall. This is useful to make the number of lines small when screen updating is very slow. Cannot make the height more than the physical screen height. z. Redraw, line [count] at center of window (default cursor line). Put cursor at first non-blank in the line. zz Like "z.", but leave the cursor in the same column. Careful: If caps-lock is on, this command becomes "ZZ": write buffer and exit! {not in Vi} z- Redraw, line [count] at bottom of window (default cursor line). Put cursor at first non-blank in the line. zb Like "z-", but leave the cursor in the same column. {not in Vi}
水平滾動(水平滾動)
對於以下四個命令,游標跟隨螢幕。如果游標所在的字元移出螢幕,則游標將移至螢幕上最近的字元。不使用“sidescroll”的值。
z<Right> or zl Move the view on the text [count] characters to the right, thus scroll the text [count] characters to the left. This only works when 'wrap' is off. {not in Vi} z<Left> or zh Move the view on the text [count] characters to the left, thus scroll the text [count] characters to the right. This only works when 'wrap' is off. {not in Vi} zL Move the view on the text half a screenwidth to the right, thus scroll the text half a screenwidth to the left. This only works when 'wrap' is off. {not in Vi} zH Move the view on the text half a screenwidth to the left, thus scroll the text half a screenwidth to the right. This only works when 'wrap' is off. {not in Vi}
對於以下兩個命令,游標不會在文本中移動,只有文本在螢幕上滾動。
zs Scroll the text horizontally to position the cursor at the start (left side) of the screen. This only works when 'wrap' is off. {not in Vi} ze Scroll the text horizontally to position the cursor at the end (right side) of the screen. This only works when 'wrap' is off. {not in Vi}