7
|
1 ===============================
|
|
2 Visual Studio - Vim Integration
|
|
3 ===============================
|
|
4
|
|
5 Copyright (C) 1997 Heiko Erhardt
|
|
6
|
|
7 VisVim is a Visual Studio Add-In that allows Vim to be integrated
|
|
8 as the default text editor. It will be used instead of the Visual
|
|
9 Studio built-in editor when you double-click on a file or press F4
|
|
10 after compiling (it will go to the proper line in the Vim buffer).
|
|
11 The file can be loaded exclusively by Vim or additionally to the
|
|
12 builtin Visual Studio editor (this option can be set in the VisVim
|
|
13 configuration dialog inside Visual Studio).
|
|
14 Vim does not replace the Visual Studio editor, it still runs in its
|
|
15 own window.
|
|
16
|
|
17 VisVim is based upon VisEmacs by Christopher Payne
|
|
18 (Copyright (C) Christopher Payne 1997).
|
|
19
|
3445
|
20 Author: Heiko Erhardt <heiko.erhardt@gmx.net>
|
7
|
21 Based upon: VisEmacs by Christopher Payne <payneca@sagian.com>
|
|
22 Version: 1.0
|
|
23 Created: 23 Oct 1997
|
|
24 Date: 23 Oct 1997
|
|
25
|
3445
|
26 VisVim was originally GNU GPL licensed, as stated below. On March 21 2012
|
|
27 Heiko Erhardt declared this work to be relicensed under the Vim license, as
|
|
28 stated in ../../runtime/doc/uganda.txt (or ":help uganda" in Vim).
|
|
29
|
7
|
30 VisVim is free software; you can redistribute it and/or modify
|
|
31 it under the terms of the GNU General Public License as published by
|
|
32 the Free Software Foundation; either version 2, or (at your option)
|
|
33 any later version.
|
|
34
|
|
35 VisVim is distributed in the hope that it will be useful,
|
|
36 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
37 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
38 GNU General Public License for more details.
|
|
39
|
|
40
|
|
41 Requirements
|
|
42 ------------
|
|
43
|
|
44 VisVim works with the *OLE-enabled* version of Vim version 5.0 and higher
|
|
45 only!!! You must download the extra archive containing the OLE-enabled
|
|
46 executable from your Vim download site. When building your own Vim
|
|
47 executable, use the if_ole_vc.mak makefile (Vim 5.1 and higher).
|
|
48 VisVim needs DevStudio 5.0 or higher. It does not work with DevStudio 4.2.
|
|
49
|
|
50
|
|
51 Installation
|
|
52 ------------
|
|
53
|
|
54 1) Close running instances of DevStudio.
|
|
55
|
|
56 2) Copy VisVim.dll into a convenient directory like \vim,
|
|
57 \vim\lib, or \vim\addin
|
|
58
|
|
59 3) 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
|
|
69 3a) If you didn't do this yet: Register the OLE gvim:
|
|
70 > gvim -register
|
|
71
|
|
72 4) Start Visual Studio and go to:
|
|
73 Tools
|
|
74 Customize...
|
|
75 Add-Ins and Macro Files
|
|
76
|
|
77 5) Click on Browse, and point Visual Studio to your VisVim.dll file.
|
|
78
|
|
79 6) Click the checkbox to indicate that you want to use the Add-In, and
|
|
80 Close the Customize dialog box.
|
|
81
|
|
82 7) 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
|
|
86 Compiling VisVim
|
|
87 ----------------
|
|
88
|
|
89 Two Options:
|
|
90
|
|
91 1) Load the VisVim.mak file as a Workspace in Visual Studio and compile
|
|
92
|
|
93 2) Use the MSVC command line compiler:
|
|
94 vcvars32
|
|
95 nmake -f VisVim.mak
|
|
96
|
|
97
|
|
98 Using VisVim
|
|
99 ------------
|
|
100
|
|
101 The VisVim DLL exposes several functions to the user. These functions are
|
|
102 accessible using the toolbar or by assigning hotkeys to them (see below).
|
|
103 The following functions are visible on the toolbar (from left to right):
|
|
104
|
|
105 1. VisVim settings dialog
|
|
106 The settings you adjust here will be saved in the registry and
|
|
107 will be reloaded on program startup.
|
|
108
|
|
109 2. 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
|
|
117 3. Disable Vim
|
|
118 The internal Visual Studio editor will be used to edit files.
|
|
119
|
|
120 4. 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
|
|
124 5. 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
|
|
129 You cannot use DevStudio's debugger commands from inside Vim, so you should
|
|
130 disable Vim before running the debugger.
|
|
131
|
|
132 You can customize the Vim toolbar itself or add the Vim buttons to other
|
|
133 toolbars.
|
|
134 To have fast access to the VisVim options dialog I suggest to create keyboard
|
|
135 shortcuts:
|
|
136
|
|
137 1) Choose
|
|
138 Tools
|
|
139 Customize...
|
|
140 Keyboard
|
|
141 2) Choose Category:AddIns and Commands:VisVim.
|
|
142 3) 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
|
|
149 4) Close the dialog
|
|
150
|
|
151 Now a typical debugging example:
|
|
152
|
|
153 Using "Alt+Shift+d" you turn off Vim before starting the debugger.
|
|
154 After hitting the breakpoint you single step through your application
|
|
155 using the internal source code editor and examine variables.
|
|
156 When you stumble across the line with the null pointer
|
|
157 assignment, just press "Alt+Shift+g", and correct the error in Vim.
|
|
158 Save the file, press Alt+Tab to return to DevStudio and press F7 to compile.
|
|
159 That's it.
|
|
160
|
|
161
|
|
162 Troubleshooting
|
|
163 ---------------
|
|
164
|
|
165 1. 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
|
|
176 2. 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
|
|
186 3. 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
|
|
194 4. 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
|
|
200 5. 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...
|
1203
|
203 Explanation: The Vim OLE automation interface interprets the VisVim
|
7
|
204 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
|
|
211 6. 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.
|
4352
|
223 5. Tools -> Customize ->Add-ins and Macro-Files.
|
7
|
224 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
|
|
230 Change history
|
|
231 --------------
|
|
232
|
|
233 1.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
|
|
245 1.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
|
|
253 1.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
|
|
261 1.1b to 1.2
|
|
262 -----------
|
|
263
|
|
264 No 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
|
|
277 1.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.
|
|
285 This prevents Vim from beeping when a VisVim command is executed an Vim is
|
|
286 not in insert mode.
|
|
287
|
|
288
|
|
289 ToDo List
|
|
290 ---------
|
|
291
|
|
292 P1 is highest priority, P10 lowest
|
|
293
|
|
294 P9 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
|
|
298 P8 Execute :tag command in Vim for word under cursor in DevStudio
|
|
299
|
|
300 P7 Controlling the Visual Studio Debugger from inside Vim
|
4352
|
301 See message above. Also a 'Debug' highlight group and a
|
7
|
302 command to highlight a certain line would be necessary.
|
|
303
|
|
304 P6 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
|
|
311 Known 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
|
|
322 Have fun!
|
|
323
|
|
324 Heiko Erhardt
|
3445
|
325 heiko.erhardt@gmx.net
|
7
|
326
|