Obsolete tip
This tip has been merged into another tip.
See VimTip934 for the current tip.
Please do not edit this tip, and do not edit the discussion page.
If anything needs to be improved, please fix VimTip934.
created November 1, 2005 · complexity basic · author Jacques · version 5.7
If you are often switching around different projects you may start to find it a pain to load the files you want to currently look at. This tip teaches you how to create Vim session files and then shows you how to create some registry entries that will allow you to launch the Vim session directly from the Windows shell by double clicking on the icon.
1. Load the files you want to pull into a project. This can be as many or as few as you want. I like to organize my Vim sessions along the various modules I'm working on.
2. Save the session by typing :mkession <path> (remember to use the tab key for auto path completion and saving files to your desktop is only a few tabs away)
3. Give the session an extension you will continue to use for all your extensions. I use .vis (Vim Session)
Save the following into a .reg text file. Remember to change the .vis extensions in the file to the one you picked.
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\vim_source_file\shell\edit\command] @="C:\\Program Files\\Vim\\vim64\\gvim.exe -c \":source %1\"" [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.vis\OpenWithList] "a"="NOTEPAD.EXE" "MRUList"="ab" "b"="gvim.exe" [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.vis\OpenWithProgids] "vim_source_file"=hex(0): [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.vis] @="vim_source_file"
Session files make working with many files at a time much more enjoyable. To remove this registry change delete the registry keys that have the new association.
Comments
From :help -S:
-S {file} The {file} will be sourced after the first file has been read.
This is an easy way to do the equivalent of: >
-c "source {file}"