Open file when Vim starts

I like it when Vim opens cheat codes at startup. Adding this to _vimrc works great with MacVim:

:e *path-to-cheatsheet*

but on Windows vim displays a message box at startup:

"~\Dropbox\vimfiles\myvim\vimcheat.txt"
"~\Dropbox\vimfiles\myvim\vimcheat.txt" [unix] 52L, 1735C

When the message box is rejected, Vim terminates the launch and opens the cheat sheet. How do I get this to work with Windows Vim?

+4
source share
1 answer

~/.vimrcprocessed at the very beginning :help initialization. You can use the event VimEnterto open the file after the entire launch is completed:

autocmd VimEnter * edit path/to/cheatsheet

If you do not want to see messages, use silent edit. If you do not care about errors (if there is no wallet there), use silent!.

+4
source

Source: https://habr.com/ru/post/1682728/


All Articles