On Sat 7-Oct-06 7:06pm -0600, A.J.Mechelynck wrote: > Bill McCarthy wrote: >> On Sat 7-Oct-06 5:17pm -0600, Yakov Lerner wrote:
>>> Every time I look at the {autocmd BufReadPost * \ if >>> line("'\"") > 0 && line("'\"") <= line("$") | exe "normal >>> g`\"" |endif} sequence , I get a feeling like the switch >>> which would need to be acessible and reachable inside the >>> car near the driver seat, was palced under the hood near >>> the engine, and when one needs to access it, you need to >>> get out of the car and open the hood. >> It's probably that extraneous '\' escaping a space between >> '*' and 'if' :-) >> >> But if you don't mind the losing the out-of-range checking: >> >> autocmd BufReadPost * '" > 1. Apparently your mailer un-beautified the text a little > too zealously. That backslash was supposed to be the first > character on a continuation line. No, on the original post by Yakov, that first '\' is physically on the same line as 'autocmd'. > 2. "normal" would still be required in the autocommand, > because an autocommand is always an ex-command. No, '" is a ex-command (or certainly behaves like one). Try it out. Open a file, move the cursor somewhere and note where. Now close it and reopen. If you have the above ':autocmd' you will be in the same position as when you closed (if not issue a normal mode '"). Now move the cursor up a few lines and type the following: :'" It is not, AFAIK, documented as an ex-command, but is works as part of an ex-command command range and behaves like it is translated to the line number of the '" position. The usage as a range is documented. :h :' Unfortunately, it does change the jumplist. > 3. To replace the cursor on the exact character where it > used to be, the mark must be called with a backtick: `" > not an apostrophe: '" -- the latter would put the cursor > on the first non-blank on the line. Yes, you're right. But `" doesn't work as an ex-command. For just skipping the range checking but preserving the jumplist, the command is: autocmd BufReadPost * exe "norm g`\"" -- Best regards, Bill