Execute an autocommand only once

Posted by Andrej M. on Stack Overflow See other posts from Stack Overflow or by Andrej M.
Published on 2011-01-01T03:41:01Z Indexed on 2011/01/01 3:54 UTC
Read the original article Hit count: 324

Filed under:

I have an issue with using GVim on Windows. I have set up the following in my .vimrc:

if has("gui_running")
  autocmd VIMEnter * :source C:/session.vim
endif

Unfortunately this creates a problem. If I'm a the top of the file and try to move up a line (k), the screen flashes. If I hold the key for just a second it will flash a few dozen times, it is really nasty too look at.

I've tried using GUIEnter instead but I got the same results. The docs mention that I can fire an autocommand only once, but I couldn't figure out the exact syntax. Care to help?

© Stack Overflow or respective owner

Related posts about vim