I like to have Vim open a cheatsheet at startup. Adding this to _vimrc works nicely 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 dismissed, Vim completes startup and opens the cheatsheet. How do I get this to work cleanly with Windows Vim?
Opening a new file for editing If you're already in vim, then there's no need to exit it just to open a new file. That will open the file for editing. You can also use the tab-key for autocompletion of the path. Please note that the current file must be saved, or you've to use :e! to discard the unsaved changes.
Open a new or existing file with vim filename . Type i to switch into insert mode so that you can start editing the file. Enter or modify the text with your file. Once you're done, press the escape key Esc to get out of insert mode and back to command mode.
Launching Vim In order to launch Vim, open a terminal, and type the command vim . You can also open a file by specifying a name: vim foo. txt .
The system vimrc file can be created by an administrator to customize Vim for all users. In addition, each user can have his or her own user vimrc . Show activity on this post. It may be under [Your Installation Directory]/Vim/ .
The ~/.vimrc
is processed at the very beginning of :help initialization
. You can use the VimEnter
event to open the file after all the startup stuff is done:
autocmd VimEnter * edit path/to/cheatsheet
If you don't want to see the messages, use silent edit
. If you don't care about errors (if the cheatsheet isn't there), use silent!
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With