Wednesday, October 8, 2014

Re: "vim +n" trigger

On Wednesday, 08 October, 2014 at 17:30:07 BST, Tim Chase wrote:
>Well, it could be done with an auto-command when the buffer is read
>which you could put in your vimrc:
>
> augroup AutoCenter
> au AutoCenter BuffEnter * norm zz
> augroup END
>
>This would center on whatever the focused line is upon opening a
>buffer (if possible). If you haven't specified a +{number} offset,
>it's on the first line, so it won't lower that to the middle of the
>screen because there's nothing above it. But if there is a +{number}
>offset, it should center it on the screen.

Great, that works, Tim, thanks.

I am curious why you created an augroup for it, instead of one "au BufEnter" command. Is there an advantage to having it in a group?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: