" 4 displaying text
set display=lastline,uhex " Show the last line instead of '@'; show non-printable chars as <hex>
-set lazyredraw " Do not update screen while executing macros
+
+" Do not set it here, it breaks initial screen drawing and cursor positioning.
+" See SetLazyRedraw at the end of the script.
+" set lazyredraw " Do not update screen while executing macros
+
set list " listchars only works with 'list'
" Show tabs, non-breaking/trailing spaces, long lines
set listchars=tab:>_,nbsp:_,trail:_,extends:+,precedes:+
endif
" ----------
+if v:version >= 800
+ function! SetLazyRedraw(timer_id)
+ call timer_stop(a:timer_id) " One-time event
+ set lazyredraw
+ endfunction
+ call timer_start(500, 'SetLazyRedraw')
+endif
+
" This has to go to the very end of ~/.vimrc to allow reading the .vimrc
set secure " safer working with script files in the current directory