(Vim 8.0, Windows 7)
I wanted to make an autocmd for loading a certain file, that scrolls down five lines from the beginning of the file. It does other things too, so the autocmd itself (inside of an augroup filetype
, incidentally) is
au BufRead,BufNewFile foo.txt so $VIM/foo.vim
where foo.vim
contains various other commands, plus:
norm! 5^E
If I run the above norm
command manually, it does exactly what I want. However, when I use the autocmd, the buffer ends up with the cursor on line 5, but with line 1 still visible. I get the same behavior if I replace ^E
with ^D
. Nothing also seems to happen if I follow either one with z^M
.
I could find nothing in the documentation for au
, so
, ^E
, or norm
that addresses this. Is it a bug? Or am I missing something obvious?
Ctrl-V + Ctrl-E
in the file withau
? – B Layer Nov 21 '17 at 1:06^E
is clearly a different color. Also, the cursor is going down that many spaces, so I know it's doing something with that command. – Paul Brinkley Nov 21 '17 at 9:02