On 2014-10-08 17:19, Paul wrote:
> On Wednesday, 08 October, 2014 at 13:07:12 BST, Jürgen Krämer wrote:
> >>> What about "set scrolloff=999" ? That keeps the cursor at M
> >>> permanently, and can be used as a '-c "set scrolloff=999"'
> >>> commandline option, because it is an ex commend, I figure. A
> >>> look at ":h -c" suggests that it should take effect at a
> >>> suitable time. (Not tried)
> >>
> >> or, for a one-off, pass in a -c 'normal zz' after your +n
> >
> >or combine those two arguments into one:
>
> Thanks, guys, but I'm really looking for something automatic I can
> put into .vimrc (again, only when +n is used), so I don't have to
> type extra stuff on the command line.
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.
-tim
--
--
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.
Wednesday, October 8, 2014
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment