I would like to execute 'zz' to center the current line to the center of the screen when opening a new file. I have tried the following, but it does not seem to be working for some reason:
autocmd BufEnter * :normal zz
Any ideas?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this community
augroup
,BufReadPost
andnormal!
, it actually does work. Butzz
is no-op if the current line number is too small.zz
will not do anything if centering the current line would result in a margin (empty space) at the top of the buffer.