On 2012-03-04, howardb21 wrote: > On Mar 4, 1:49 am, Paul Isambert wrote: > > > You should use ":exe[cute]": > > au BufRead * for i in range(1,9) | exe "let @" . i . " = ''" | endfor > > Does not seem to work. When I enter a new buffer, the numbered > registers still contain older text.
What do mean by "enter a new buffer"? The BufRead event occurs when a file is read into a buffer. If you really want those registers cleared each time you enter a buffer, you should use the BufEnter event, but that event doesn't distinguish between new and existing buffers. > Have you tried this autocommand? Yes. It worked as advertised. I started vim without any arguments and used the :registers command to observe the contents of all the registers. The numbered registers contained stuff left over from previous editing sessions. Then I edited an existing file with the :edit command and used the :registers command again to observer the register contents. The numbered registers 1 through 9 were cleared. > I did try a version of execute, but I read in the docs that you > could not use exe on part of a command. You had to execute the > whole line, even if it contained multiple commands. Where did you read that? Your conclusion is incorrect, so perhaps the documentation needs to be more clear. Regards, Gary -- 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
