blob: 25b0fbd05ec24abb9d8ee410fa773a3ac2a6f73b [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001===============================
2Visual Studio - Vim Integration
3===============================
4
5Copyright (C) 1997 Heiko Erhardt
6
7VisVim is a Visual Studio Add-In that allows Vim to be integrated
8as the default text editor. It will be used instead of the Visual
9Studio built-in editor when you double-click on a file or press F4
10after compiling (it will go to the proper line in the Vim buffer).
11The file can be loaded exclusively by Vim or additionally to the
12builtin Visual Studio editor (this option can be set in the VisVim
13configuration dialog inside Visual Studio).
14Vim does not replace the Visual Studio editor, it still runs in its
15own window.
16
17VisVim is based upon VisEmacs by Christopher Payne
18(Copyright (C) Christopher Payne 1997).
19
Bram Moolenaar61d35bd2012-03-28 20:51:51 +020020Author: Heiko Erhardt <heiko.erhardt@gmx.net>
Bram Moolenaar071d4272004-06-13 20:20:40 +000021Based upon: VisEmacs by Christopher Payne <payneca@sagian.com>
22Version: 1.0
23Created: 23 Oct 1997
24Date: 23 Oct 1997
25
Bram Moolenaar61d35bd2012-03-28 20:51:51 +020026VisVim was originally GNU GPL licensed, as stated below. On March 21 2012
27Heiko Erhardt declared this work to be relicensed under the Vim license, as
28stated in ../../runtime/doc/uganda.txt (or ":help uganda" in Vim).
29
Bram Moolenaar071d4272004-06-13 20:20:40 +000030VisVim is free software; you can redistribute it and/or modify
31it under the terms of the GNU General Public License as published by
32the Free Software Foundation; either version 2, or (at your option)
33any later version.
34
35VisVim is distributed in the hope that it will be useful,
36but WITHOUT ANY WARRANTY; without even the implied warranty of
37MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38GNU General Public License for more details.
39
40
41Requirements
42------------
43
44VisVim works with the *OLE-enabled* version of Vim version 5.0 and higher
45only!!! You must download the extra archive containing the OLE-enabled
46executable from your Vim download site. When building your own Vim
47executable, use the if_ole_vc.mak makefile (Vim 5.1 and higher).
48VisVim needs DevStudio 5.0 or higher. It does not work with DevStudio 4.2.
49
50
51Installation
52------------
53
541) Close running instances of DevStudio.
55
562) Copy VisVim.dll into a convenient directory like \vim,
57 \vim\lib, or \vim\addin
58
593) Register the DLL using regsvr32.exe ... (Skip this on Windows 95/98)
60 Example:
61 > cd \vim\addin
62 > regsvr32 VisVim.dll
63 On NT, you should do this from an administrator account.
64 Before installing a new version of VisVim you should unregister
65 the old one using
66 > regsvr32 -unregister VisVim.dll
67 The batch files register.bat and unregister.bat can do that for you.
68
693a) If you didn't do this yet: Register the OLE gvim:
70 > gvim -register
71
724) Start Visual Studio and go to:
73 Tools
74 Customize...
75 Add-Ins and Macro Files
76
775) Click on Browse, and point Visual Studio to your VisVim.dll file.
78
796) Click the checkbox to indicate that you want to use the Add-In, and
80 Close the Customize dialog box.
81
827) You should notice the VisVim Toolbar with the Vim Icon.
83 Click the first item of the toolbar to get to the options dialog.
84
85
86Compiling VisVim
87----------------
88
89Two Options:
90
911) Load the VisVim.mak file as a Workspace in Visual Studio and compile
92
932) Use the MSVC command line compiler:
94 vcvars32
95 nmake -f VisVim.mak
96
97
98Using VisVim
99------------
100
101The VisVim DLL exposes several functions to the user. These functions are
102accessible using the toolbar or by assigning hotkeys to them (see below).
103The following functions are visible on the toolbar (from left to right):
104
1051. VisVim settings dialog
106 The settings you adjust here will be saved in the registry and
107 will be reloaded on program startup.
108
1092. Enable Vim
110 Enables Vim as Visual Studio editor. Control will be switched to Vim when:
111 - Clicking a file in the file view
112 - Clicking a compiler error message line
113 - Using the 'File-Open' Dialog
114 - Showing the current source line when encountering a debugger breakpoint.
115 - Using File-New
116
1173. Disable Vim
118 The internal Visual Studio editor will be used to edit files.
119
1204. Toggle enable state
121 Toggles the enable state of VisVim. Use this function if you want to have
122 one button only to activate/deactivate Vim.
123
1245. Load current file in Vim
125 Loads the file shown in the internal editor into Vim. Use this function if
126 you want the internal editor to stay active and just edit one file in Vim.
127 This command works always whether Vim is enabled as default editor or not.
128
129You cannot use DevStudio's debugger commands from inside Vim, so you should
130disable Vim before running the debugger.
131
132You can customize the Vim toolbar itself or add the Vim buttons to other
133toolbars.
134To have fast access to the VisVim options dialog I suggest to create keyboard
135shortcuts:
136
1371) Choose
138 Tools
139 Customize...
140 Keyboard
1412) Choose Category:AddIns and Commands:VisVim.
1423) Choose 'Main' as editor, enter each hotkey and press the Assign button.
143 I suggest:
144 VisVimDialogCmd Alt+Shift+V
145 VisVimEnableCmd Alt+Shift+E
146 VisVimDisableCmd Alt+Shift+D
147 VisVimToggleCmd Alt+Shift+T
148 VisVimLoadCmd Alt+Shift+G
1494) Close the dialog
150
151Now a typical debugging example:
152
153Using "Alt+Shift+d" you turn off Vim before starting the debugger.
154After hitting the breakpoint you single step through your application
155using the internal source code editor and examine variables.
156When you stumble across the line with the null pointer
157assignment, just press "Alt+Shift+g", and correct the error in Vim.
158Save the file, press Alt+Tab to return to DevStudio and press F7 to compile.
159That's it.
160
161
162Troubleshooting
163---------------
164
1651. When opening a file in DevStudio the file is opened in the DevStudio
166 editor and immediately vanishes. No Vim shows up.
167 Cause: Probably you don't have the OLE-enabled Vim or you didn't
168 register it.
169 Explanation: VisVim is notified by DevStudio if an 'open document' event
170 occurs. It then closes the document in the internal editor
171 and tries to start Vim. If Vim isn't properly OLE-registered,
172 this won't work.
173 Workaround: Download and install the OLE-enable version of Vim and
174 execute "gvim -register".
175
1762. Sometimes when clicking on a file, the file won't be opened by Vim but
177 instead the Visual Studio editor comes up.
178 Cause: The file was already loaded by the DevStudio editor.
179 Explanation: VisVim works by hooks exposed by Visual Studio.
180 Most of the functionality works from the OpenDocument hook.
181 If a document is already loaded in the Visual Studio editor,
182 no 'open document' event will be generated when clicking the
183 file in the file list.
184 Workaround: Close the document in Visual Studio first.
185
1863. I can't get VisVim to work. Either the Vim toolbar does not appear at all
187 or weird crashes happen.
188 Cause: The Visual Studio installation is messed up.
189 Explanation: I can't give you one. Ask M$.
190 Workaround: Reinstall DevStudio (I know this is brute, but in some cases
191 it helped). There was one case where the service pack 1 had
192 to be installed, too.
193
1944. If an instance of Vim is already running, VisVim will use that instance
195 and not start a new one.
196 Cause: This is proper OLE behaviour
197 Explanation: Some call it a bug, some a feature. That's just the way OLE
198 works.
199
2005. When being in insert mode in Vim and selecting a file in Visual Studio,
201 the Vim command :e ... is inserted as text instead of being executed.
202 Cause: You probably know...
Bram Moolenaar044b68f2007-05-10 17:39:52 +0000203 Explanation: The Vim OLE automation interface interprets the VisVim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000204 commands as if they were typed in by the user.
205 So if you're in insert mode Vim considers it to be text.
206 I decided against sending an ESC before the command because
207 it may cause a beep or at least a screen flash when noeb is
208 set.
209 Workaround: Get used to press ESC before switching to DevStudio.
210
2116. I'm tired of VisVim but I can't get rid of it. I can't delete it in
212 Tools-Customize-Add-Ins.
213 Cause: You can't delete an item you once added to the add-ins
214 list box.
215 Explanation: M$ just didn't put a 'delete' button in the dialog box.
216 Unfortunately there is no DEL key accellerator as well...
217 Workaround: You can't kill it, but you can knock it out:
218 1. Uncheck the check box in front of 'Vim Developer Studio
219 Add-in'.
220 2. Close Visual Studio.
221 3. Delete VisVim.dll or move it somewhere it can't be found.
222 4. Run Visual Studio.
Bram Moolenaar84a05ac2013-05-06 04:24:17 +0200223 5. Tools -> Customize ->Add-ins and Macro-Files.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000224 6. A message appears:
225 ".../VisVim.dll" "This add-in no longer exists. It will
226 no longer be displayed."
227 That's it!
228
229
230Change history
231--------------
232
2331.0a to 1.0
234-----------
235
236- All settings in the VisVim dialog are remembered between DevStudio sessions
237 by keeping them in the registry (HKEY_CURRENT_USER\Software\Vim\VisVim).
238- Added an option to do a :cd before opening the file (having a file opened
239 by clicking it but finding out to be still in C:\Windows\system when trying to
240 open another file by ":e" can be annoying). Change directory can be
241 done to the source file's directory or it's parent directory.
242- Added some explanations to the error message for the CO_E_CLASSSTRING error
243 ("Use OLE Vim and make sure to register...").
244
2451.0 to 1.1a
246-----------
247
248- The VisVim toolbar button now shows the new Vim icon instead of the old one.
249- Made some changes to the documentation, added the troubleshooting chapter
250 and ToDo list.
251- File-New-* now invokes Vim instead of the builtin editor if enabled.
252
2531.1 to 1.1b
254-----------
255
256- Extended the VisVim toolbar to have multiple buttons instead of one.
257- Moved the enable/disable commands from the settings dialog to the toolbar.
258- Added the toggle enable/disable command
259- Added the 'load current file' command.
260
2611.1b to 1.2
262-----------
263
264No new features, just some fine tuning:
265
266- Changed the GUID of the VisVim OLE interface to avoid conflicts with a
267 version of VisEmacs or VisVile on the same computer (Guy Gascoigne)
268- Fixed a bug caused by a bug in the Developer Studio add-in code generator
269 (Clark Morgan)
270- Fixed a memory leak (Clark Morgan)
271- Added an option in the VisVim dialog to prepend ESC before the first command
272 that is sent to Vim. This will avoid inserting the command as text when Vim
273 is still in insert mode.
274- An :update command is sent to Vim before any other command to update the
275 current file if it is modified, or else the following :cd or :e command will fail.
276
2771.2 to 1.3a
278-----------
279
280- Fixed a bug caused by a missing EnableModeless() function call in VimLoad().
281 This seems to reduce VisVim crashing DevStudio on some systems (it
282 occasionally still seems to happen, but it's more stable now).
283 (Vince Negri)
284- Added support for the new CTRL-\ CTRL-N command of Vim 5.4a.
Bram Moolenaar94f76b72013-07-04 22:50:40 +0200285 This prevents Vim from beeping when a VisVim command is executed and Vim is
Bram Moolenaar071d4272004-06-13 20:20:40 +0000286 not in insert mode.
287
288
289ToDo List
290---------
291
292P1 is highest priority, P10 lowest
293
294P9 Switching to DevStudio using ALT-TAB may get annoying. Would be nice to
295 have the option to map ActivateApplication("Visual Studio") in Vim.
296 Vim DLLs would solve that problem.
297
298P8 Execute :tag command in Vim for word under cursor in DevStudio
299
300P7 Controlling the Visual Studio Debugger from inside Vim
Bram Moolenaar84a05ac2013-05-06 04:24:17 +0200301 See message above. Also a 'Debug' highlight group and a
Bram Moolenaar071d4272004-06-13 20:20:40 +0000302 command to highlight a certain line would be necessary.
303
304P6 Provide an option to open the current file in VisVim in
305 Visual Studio editor
306 Same as above message. A kind of two way OLE automation would have to be
307 established between VisVim and Vim. Also a 'Debug' highlight group and a
308 command to highlight a certain line would be necessary.
309
310
311Known Problems
312--------------
313
314- Occasional memory corruptions in DevStudio may appear on some systems.
315 Reinstalling DevStudio helped in some cases.
316 The cause of these crashes is unclear; there is no way to debug this.
317 Recompiling VisVim with DevStudio SP3 didn't help.
318 I assume it's a problem deep inside the DevStudio add-in OLE interfaces.
319 This will hopefully be fixed with DevStudio 6.
320
321
322Have fun!
323
324Heiko Erhardt
Bram Moolenaar61d35bd2012-03-28 20:51:51 +0200325heiko.erhardt@gmx.net
Bram Moolenaar071d4272004-06-13 20:20:40 +0000326