Thursday, January 22, 2015

Re: Open folds in autocmd makes vim start at strange lines

That totally nailed it. So it had nothing to do with folders... Thank
you for your help in clarifying this!

On Wed, Jan 21, 2015 at 08:03:13PM -0800, Ben Fritz wrote:
>On Wednesday, January 21, 2015 at 4:45:29 PM UTC-6, Oscar wrote:
>> normal(zR)
>> endfunction
>>
>> Of course I did *not* want to do this for every file, but before I could
>> move that piece of code out of .vimrc, I noticed something strange: when
>> opening a lot of files, even ones with no folds, vim would *not* start
>> in the file's first line. The most notorious case was mutt: vim would
>> start in the first non-blank line (either the signature line or the
>> "Reply Original in..." line if replying to a previous mail).
>>
>
>"normal" is not a function, it's an ex command. Interactively, you would invoke it like :normal zR
>
>Instead, you did :normal (zR)
>
>That is:
>
>( - jump back a "sentence"
>zR - open all folds
>) - jump forward a "sentence"
>
>Depending on where Vim thinks the first "sentence" ends in your file (which is probably not prose with an actual sentence structure) this could place you pretty far into the document.
>
>--
>--
>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.



--
Óscar Pereira | https://erroneousthoughts.org

Rules of Optimisation:
Rule 1: Don't do it.
Rule 2 (for experts only): Don't do it yet.
-- M.A. Jackson

--
--
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: