vim 中 zz 的水平等效项

iso*_*les 3 vim keyboard-shortcuts

如果我zz在 vim 中按下,我的屏幕/视图将垂直居中于光标位置。

我怎么能做同样的事情,但水平呢?有 vim 命令吗?

Ing*_*kat 5

没有单一的 Vim 命令,但您可以结合zs使用zH: 滚动以将光标定位在屏幕左侧,然后向右滚动半个屏幕宽度。

我有这个映射在我的~/.vimrc

" Horizontally center cursor position.
" Does not move the cursor itself (except for 'sidescrolloff' at the window
" border).
nnoremap <silent> z. :<C-u>normal! zszH<CR>
Run Code Online (Sandbox Code Playgroud)