History Report a problem
Article Edit this page Discussion

Create Vim sessions that you can open with double-click in Windows

From Vim Tips Wiki

(Redirected from VimTip1037)
Jump to: navigation, search

Tip 1037 Previous TipNext Tip

Created: November 1, 2005 Complexity: basic Author: Jacques Minimum version: 5.7 Karma: 16/9 Imported from: Tip#1037


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.

[edit] 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}"

Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Pushing Daisies
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Astronomy Wiki
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions


Vote for featured Wikia!

Send this article to a friend
"Create Vim sessions that you can open with double-click in Windows"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation