blob: 8447d5ffee6cb7f6cfc56d87514838fb1434c034 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001# NSIS file to create a self-installing exe for Vim.
2# It requires NSIS version 2.0 or later.
Bram Moolenaar04344822014-11-05 18:18:17 +01003# Last Change: 2014 Nov 5
Bram Moolenaar071d4272004-06-13 20:20:40 +00004
5# WARNING: if you make changes to this script, look out for $0 to be valid,
6# because uninstall deletes most files in $0.
7
Bram Moolenaarba460752013-07-04 22:35:01 +02008# Location of gvim_ole.exe, vimw32.exe, GvimExt/*, etc.
Bram Moolenaar286eacd2016-01-16 18:05:50 +01009!ifndef VIMSRC
10 !define VIMSRC "..\src"
11!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000012
13# Location of runtime files
Bram Moolenaar286eacd2016-01-16 18:05:50 +010014!ifndef VIMRT
15 !define VIMRT ".."
16!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000017
18# Location of extra tools: diff.exe
Bram Moolenaar286eacd2016-01-16 18:05:50 +010019!ifndef VIMTOOLS
20 !define VIMTOOLS ..\..
21!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000022
Bram Moolenaar6199d432017-10-14 19:05:44 +020023# Location of gettext.
24# It must contain two directories: gettext32 and gettext64.
25# See README.txt for detail.
26!ifndef GETTEXT
27 !define GETTEXT ${VIMRT}
28!endif
29
Bram Moolenaar071d4272004-06-13 20:20:40 +000030# Comment the next line if you don't have UPX.
Bram Moolenaar6199d432017-10-14 19:05:44 +020031# Get it at https://upx.github.io/
Bram Moolenaar071d4272004-06-13 20:20:40 +000032!define HAVE_UPX
33
34# comment the next line if you do not want to add Native Language Support
35!define HAVE_NLS
36
Bram Moolenaar6c7b4442016-01-02 15:44:32 +010037!include gvim_version.nsh # for version number
Bram Moolenaar071d4272004-06-13 20:20:40 +000038
39# ----------- No configurable settings below this line -----------
40
41!include UpgradeDLL.nsh # for VisVim.dll
Bram Moolenaar442b4222010-05-24 21:34:22 +020042!include LogicLib.nsh
43!include x64.nsh
Bram Moolenaar071d4272004-06-13 20:20:40 +000044
45Name "Vim ${VER_MAJOR}.${VER_MINOR}"
46OutFile gvim${VER_MAJOR}${VER_MINOR}.exe
47CRCCheck force
Bram Moolenaar286eacd2016-01-16 18:05:50 +010048SetCompressor /SOLID lzma
Bram Moolenaar071d4272004-06-13 20:20:40 +000049SetDatablockOptimize on
Bram Moolenaar442b4222010-05-24 21:34:22 +020050RequestExecutionLevel highest
Bram Moolenaar286eacd2016-01-16 18:05:50 +010051XPStyle on
Bram Moolenaar071d4272004-06-13 20:20:40 +000052
53ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer."
Bram Moolenaar04344822014-11-05 18:18:17 +010054DirText "Choose a directory to install Vim (should contain 'vim')"
Bram Moolenaar071d4272004-06-13 20:20:40 +000055Icon icons\vim_16c.ico
Bram Moolenaar266411a2013-07-05 20:01:32 +020056# NSIS2 uses a different strategy with six different images in a strip...
Bram Moolenaar071d4272004-06-13 20:20:40 +000057#EnabledBitmap icons\enabled.bmp
58#DisabledBitmap icons\disabled.bmp
59UninstallText "This will uninstall Vim ${VER_MAJOR}.${VER_MINOR} from your system."
60UninstallIcon icons\vim_uninst_16c.ico
61
62# On NSIS 2 using the BGGradient causes trouble on Windows 98, in combination
63# with the BringToFront.
64# BGGradient 004000 008200 FFFFFF
65LicenseText "You should read the following before installing:"
66LicenseData ${VIMRT}\doc\uganda.nsis.txt
67
68!ifdef HAVE_UPX
69 !packhdr temp.dat "upx --best --compress-icons=1 temp.dat"
70!endif
71
72# This adds '\vim' to the user choice automagically. The actual value is
73# obtained below with ReadINIStr.
74InstallDir "$PROGRAMFILES\Vim"
75
76# Types of installs we can perform:
77InstType Typical
78InstType Minimal
79InstType Full
80
81SilentInstall normal
82
83# These are the pages we use
84Page license
85Page components
86Page directory "" "" CheckInstallDir
87Page instfiles
88UninstPage uninstConfirm
89UninstPage instfiles
90
91##########################################################
92# Functions
93
94Function .onInit
95 MessageBox MB_YESNO|MB_ICONQUESTION \
96 "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer.$\n Continue?" \
Bram Moolenaara1bd86e2017-06-24 15:11:01 +020097 /SD IDYES \
98 IDYES NoAbort
Bram Moolenaar071d4272004-06-13 20:20:40 +000099 Abort ; causes installer to quit.
100 NoAbort:
101
102 # run the install program to check for already installed versions
103 SetOutPath $TEMP
104 File /oname=install.exe ${VIMSRC}\installw32.exe
105 ExecWait "$TEMP\install.exe -uninstall-check"
106 Delete $TEMP\install.exe
107
108 # We may have been put to the background when uninstall did something.
109 BringToFront
110
111 # Install will have created a file for us that contains the directory where
112 # we should install. This is $VIM if it's set. This appears to be the only
113 # way to get the value of $VIM here!?
114 ReadINIStr $INSTDIR $TEMP\vimini.ini vimini dir
115 Delete $TEMP\vimini.ini
116
117 # If ReadINIStr failed or did not find a path: use the default dir.
118 StrCmp $INSTDIR "" 0 IniOK
119 StrCpy $INSTDIR "$PROGRAMFILES\Vim"
120 IniOK:
121
122 # Should check for the value of $VIM and use it. Unfortunately I don't know
123 # how to obtain the value of $VIM
124 # IfFileExists "$VIM" 0 No_Vim
125 # StrCpy $INSTDIR "$VIM"
126 # No_Vim:
127
128 # User variables:
129 # $0 - holds the directory the executables are installed to
130 # $1 - holds the parameters to be passed to install.exe. Starts with OLE
131 # registration (since a non-OLE gvim will not complain, and we want to
132 # always register an OLE gvim).
133 # $2 - holds the names to create batch files for
134 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
135 StrCpy $1 "-register-OLE"
Bram Moolenaar7fcab2a2006-03-25 21:46:12 +0000136 StrCpy $2 "gvim evim gview gvimdiff vimtutor"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000137
138FunctionEnd
139
140Function .onUserAbort
141 MessageBox MB_YESNO|MB_ICONQUESTION "Abort install?" IDYES NoCancelAbort
142 Abort ; causes installer to not quit.
143 NoCancelAbort:
144FunctionEnd
145
146# We only accept the directory if it ends in "vim". Using .onVerifyInstDir has
147# the disadvantage that the browse dialog is difficult to use.
148Function CheckInstallDir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000149FunctionEnd
150
151Function .onInstSuccess
152 WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe
153 MessageBox MB_YESNO|MB_ICONQUESTION \
Bram Moolenaarf2330482008-06-24 20:19:36 +0000154 "The installation process has been successful. Happy Vimming! \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000155 $\n$\n Do you want to see the README file now?" IDNO NoReadme
156 Exec '$0\gvim.exe -R "$0\README.txt"'
157 NoReadme:
158FunctionEnd
159
160Function .onInstFailed
161 MessageBox MB_OK|MB_ICONEXCLAMATION "Installation failed. Better luck next time."
162FunctionEnd
163
164Function un.onUnInstSuccess
165 MessageBox MB_OK|MB_ICONINFORMATION \
166 "Vim ${VER_MAJOR}.${VER_MINOR} has been (partly) removed from your system"
167FunctionEnd
168
169Function un.GetParent
170 Exch $0 ; old $0 is on top of stack
171 Push $1
172 Push $2
173 StrCpy $1 -1
174 loop:
175 StrCpy $2 $0 1 $1
176 StrCmp $2 "" exit
177 StrCmp $2 "\" exit
178 IntOp $1 $1 - 1
179 Goto loop
180 exit:
181 StrCpy $0 $0 $1
182 Pop $2
183 Pop $1
184 Exch $0 ; put $0 on top of stack, restore $0 to original value
185FunctionEnd
186
187##########################################################
188Section "Vim executables and runtime files"
Bram Moolenaar49150a42017-09-17 21:00:03 +0200189 SectionIn 1 2 3 RO
Bram Moolenaar071d4272004-06-13 20:20:40 +0000190
191 # we need also this here if the user changes the instdir
192 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
193
194 SetOutPath $0
195 File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe
196 File /oname=install.exe ${VIMSRC}\installw32.exe
197 File /oname=uninstal.exe ${VIMSRC}\uninstalw32.exe
198 File ${VIMSRC}\vimrun.exe
Bram Moolenaarfec246d2016-08-28 18:47:14 +0200199 File /oname=tee.exe ${VIMSRC}\teew32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000200 File /oname=xxd.exe ${VIMSRC}\xxdw32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000201 File ${VIMRT}\vimtutor.bat
202 File ${VIMRT}\README.txt
203 File ..\uninstal.txt
204 File ${VIMRT}\*.vim
205 File ${VIMRT}\rgb.txt
206
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200207 File ${VIMTOOLS}\diff.exe
208 File ${VIMTOOLS}\winpty32.dll
209 File ${VIMTOOLS}\winpty-agent.exe
210
Bram Moolenaar071d4272004-06-13 20:20:40 +0000211 SetOutPath $0\colors
212 File ${VIMRT}\colors\*.*
213
214 SetOutPath $0\compiler
215 File ${VIMRT}\compiler\*.*
216
217 SetOutPath $0\doc
218 File ${VIMRT}\doc\*.txt
219 File ${VIMRT}\doc\tags
220
221 SetOutPath $0\ftplugin
222 File ${VIMRT}\ftplugin\*.*
223
224 SetOutPath $0\indent
225 File ${VIMRT}\indent\*.*
226
227 SetOutPath $0\macros
228 File ${VIMRT}\macros\*.*
Bram Moolenaarc35e4cb2017-09-06 21:43:10 +0200229 SetOutPath $0\macros\hanoi
230 File ${VIMRT}\macros\hanoi\*.*
231 SetOutPath $0\macros\life
232 File ${VIMRT}\macros\life\*.*
233 SetOutPath $0\macros\maze
234 File ${VIMRT}\macros\maze\*.*
235 SetOutPath $0\macros\urm
236 File ${VIMRT}\macros\urm\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000237
Bram Moolenaarc7baa432016-04-26 17:34:44 +0200238 SetOutPath $0\pack\dist\opt\dvorak\dvorak
239 File ${VIMRT}\pack\dist\opt\dvorak\dvorak\*.*
240 SetOutPath $0\pack\dist\opt\dvorak\plugin
241 File ${VIMRT}\pack\dist\opt\dvorak\plugin\*.*
242
243 SetOutPath $0\pack\dist\opt\editexisting\plugin
244 File ${VIMRT}\pack\dist\opt\editexisting\plugin\*.*
245
246 SetOutPath $0\pack\dist\opt\justify\plugin
247 File ${VIMRT}\pack\dist\opt\justify\plugin\*.*
248
249 SetOutPath $0\pack\dist\opt\matchit\doc
250 File ${VIMRT}\pack\dist\opt\matchit\doc\*.*
251 SetOutPath $0\pack\dist\opt\matchit\plugin
252 File ${VIMRT}\pack\dist\opt\matchit\plugin\*.*
253
254 SetOutPath $0\pack\dist\opt\shellmenu\plugin
255 File ${VIMRT}\pack\dist\opt\shellmenu\plugin\*.*
256
257 SetOutPath $0\pack\dist\opt\swapmouse\plugin
258 File ${VIMRT}\pack\dist\opt\swapmouse\plugin\*.*
259
Bram Moolenaar071d4272004-06-13 20:20:40 +0000260 SetOutPath $0\plugin
261 File ${VIMRT}\plugin\*.*
262
Bram Moolenaar7fcab2a2006-03-25 21:46:12 +0000263 SetOutPath $0\autoload
264 File ${VIMRT}\autoload\*.*
265
Bram Moolenaar18144c82006-04-12 21:52:12 +0000266 SetOutPath $0\autoload\xml
267 File ${VIMRT}\autoload\xml\*.*
268
Bram Moolenaar071d4272004-06-13 20:20:40 +0000269 SetOutPath $0\syntax
270 File ${VIMRT}\syntax\*.*
271
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000272 SetOutPath $0\spell
273 File ${VIMRT}\spell\*.txt
274 File ${VIMRT}\spell\*.vim
275 File ${VIMRT}\spell\*.spl
276 File ${VIMRT}\spell\*.sug
277
Bram Moolenaar071d4272004-06-13 20:20:40 +0000278 SetOutPath $0\tools
279 File ${VIMRT}\tools\*.*
280
281 SetOutPath $0\tutor
282 File ${VIMRT}\tutor\*.*
283SectionEnd
284
285##########################################################
286Section "Vim console program (vim.exe)"
287 SectionIn 1 3
288
289 SetOutPath $0
290 ReadRegStr $R0 HKLM \
291 "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
292 IfErrors 0 lbl_winnt
Bram Moolenaarba460752013-07-04 22:35:01 +0200293 # Windows 95/98/ME: not supported
Bram Moolenaar071d4272004-06-13 20:20:40 +0000294 Goto lbl_done
295 lbl_winnt:
Bram Moolenaar266411a2013-07-05 20:01:32 +0200296 # Windows NT/2000/XP and later
Bram Moolenaar071d4272004-06-13 20:20:40 +0000297 File /oname=vim.exe ${VIMSRC}\vimw32.exe
298 lbl_done:
299 StrCpy $2 "$2 vim view vimdiff"
300SectionEnd
301
302##########################################################
303Section "Create .bat files for command line use"
304 SectionIn 3
305
306 StrCpy $1 "$1 -create-batfiles $2"
307SectionEnd
308
309##########################################################
310Section "Create icons on the Desktop"
311 SectionIn 1 3
312
313 StrCpy $1 "$1 -install-icons"
314SectionEnd
315
316##########################################################
317Section "Add Vim to the Start Menu"
318 SectionIn 1 3
319
320 StrCpy $1 "$1 -add-start-menu"
321SectionEnd
322
323##########################################################
324Section "Add an Edit-with-Vim context menu entry"
325 SectionIn 1 3
326
327 # Be aware of this sequence of events:
328 # - user uninstalls Vim, gvimext.dll can't be removed (it's in use) and
329 # is scheduled to be removed at next reboot.
330 # - user installs Vim in same directory, gvimext.dll still exists.
331 # If we now skip installing gvimext.dll, it will disappear at the next
332 # reboot. Thus when copying gvimext.dll fails always schedule it to be
333 # installed at the next reboot. Can't use UpgradeDLL!
334 # We don't ask the user to reboot, the old dll will keep on working.
335 SetOutPath $0
336 ClearErrors
337 SetOverwrite try
Bram Moolenaar6199d432017-10-14 19:05:44 +0200338
Bram Moolenaar442b4222010-05-24 21:34:22 +0200339 ${If} ${RunningX64}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200340 # Install 64-bit gvimext.dll into the GvimExt64 directory.
341 SetOutPath $0\GvimExt64
342 ClearErrors
Bram Moolenaar442b4222010-05-24 21:34:22 +0200343 File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext64.dll
Bram Moolenaar6199d432017-10-14 19:05:44 +0200344!ifdef HAVE_NLS
345 File ${GETTEXT}\gettext64\libintl-8.dll
346 File ${GETTEXT}\gettext64\libiconv-2.dll
347!endif
348
349 IfErrors 0 GvimExt64Done
350
351 # Can't copy gvimext.dll, create it under another name and rename it
352 # on next reboot.
353 GetTempFileName $3 $0\GvimExt64
Bram Moolenaar81b07b52017-10-15 21:43:21 +0200354 File /oname=$3 ${VIMSRC}\GvimExt\gvimext64.dll
Bram Moolenaar6199d432017-10-14 19:05:44 +0200355 Rename /REBOOTOK $3 $0\GvimExt64\gvimext.dll
356!ifdef HAVE_NLS
357 GetTempFileName $3 $0\GvimExt64
358 File /oname=$3 ${GETTEXT}\gettext64\libintl-8.dll
359 Rename /REBOOTOK $3 $0\GvimExt64\libintl-8.dll
360 GetTempFileName $3 $0\GvimExt64
361 File /oname=$3 ${GETTEXT}\gettext64\libiconv-2.dll
362 Rename /REBOOTOK $3 $0\GvimExt64\libiconv-2.dll
363!endif
Bram Moolenaar442b4222010-05-24 21:34:22 +0200364 ${EndIf}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200365
366 GvimExt64Done:
367
368 # Install 32-bit gvimext.dll into the GvimExt32 directory.
369 SetOutPath $0\GvimExt32
370 ClearErrors
371
372 File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll
373!ifdef HAVE_NLS
374 File ${GETTEXT}\gettext32\libintl-8.dll
375 File ${GETTEXT}\gettext32\libiconv-2.dll
376 File ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll
377!endif
378
379 IfErrors 0 GvimExt32Done
Bram Moolenaar071d4272004-06-13 20:20:40 +0000380
381 # Can't copy gvimext.dll, create it under another name and rename it on
382 # next reboot.
Bram Moolenaar6199d432017-10-14 19:05:44 +0200383 GetTempFileName $3 $0\GvimExt32
384 File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll
385 Rename /REBOOTOK $3 $0\GvimExt32\gvimext.dll
386!ifdef HAVE_NLS
387 GetTempFileName $3 $0\GvimExt32
388 File /oname=$3 ${GETTEXT}\gettext32\libintl-8.dll
389 Rename /REBOOTOK $3 $0\GvimExt32\libintl-8.dll
390 GetTempFileName $3 $0\GvimExt32
391 File /oname=$3 ${GETTEXT}\gettext32\libiconv-2.dll
392 Rename /REBOOTOK $3 $0\GvimExt32\libiconv-2.dll
393 GetTempFileName $3 $0\GvimExt32
394 File /oname=$3 ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll
395 Rename /REBOOTOK $3 $0\GvimExt32\libgcc_s_sjlj-1.dll
396!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000397
Bram Moolenaar6199d432017-10-14 19:05:44 +0200398 GvimExt32Done:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000399 SetOverwrite lastused
400
401 # We don't have a separate entry for the "Open With..." menu, assume
402 # the user wants either both or none.
403 StrCpy $1 "$1 -install-popup -install-openwith"
404SectionEnd
405
406##########################################################
407Section "Create a _vimrc if it doesn't exist"
408 SectionIn 1 3
409
410 StrCpy $1 "$1 -create-vimrc"
411SectionEnd
412
413##########################################################
414Section "Create plugin directories in HOME or VIM"
415 SectionIn 1 3
416
417 StrCpy $1 "$1 -create-directories home"
418SectionEnd
419
420##########################################################
421Section "Create plugin directories in VIM"
422 SectionIn 3
423
424 StrCpy $1 "$1 -create-directories vim"
425SectionEnd
426
427##########################################################
428Section "VisVim Extension for MS Visual Studio"
429 SectionIn 3
430
431 SetOutPath $0
432 !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0"
433 File ${VIMSRC}\VisVim\README_VisVim.txt
434SectionEnd
435
436##########################################################
437!ifdef HAVE_NLS
438 Section "Native Language Support"
439 SectionIn 1 3
440
441 SetOutPath $0\lang
442 File /r ${VIMRT}\lang\*.*
443 SetOutPath $0\keymap
444 File ${VIMRT}\keymap\README.txt
445 File ${VIMRT}\keymap\*.vim
446 SetOutPath $0
Bram Moolenaar6199d432017-10-14 19:05:44 +0200447 File ${GETTEXT}\gettext32\libintl-8.dll
448 File ${GETTEXT}\gettext32\libiconv-2.dll
449 #File /nonfatal ${VIMRT}\libwinpthread-1.dll
450 File /nonfatal ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll
Bram Moolenaar071d4272004-06-13 20:20:40 +0000451 SectionEnd
452!endif
453
454##########################################################
455Section -call_install_exe
456 SetOutPath $0
457 ExecWait "$0\install.exe $1"
458SectionEnd
459
460##########################################################
461Section -post
462 BringToFront
463SectionEnd
464
465##########################################################
466Section Uninstall
467 # Apparently $INSTDIR is set to the directory where the uninstaller is
468 # created. Thus the "vim61" directory is included in it.
469 StrCpy $0 "$INSTDIR"
470
471 # If VisVim was installed, unregister the DLL.
472 IfFileExists "$0\VisVim.dll" Has_VisVim No_VisVim
473 Has_VisVim:
474 ExecWait "regsvr32.exe /u /s $0\VisVim.dll"
475
476 No_VisVim:
477
478 # delete the context menu entry and batch files
479 ExecWait "$0\uninstal.exe -nsis"
480
481 # We may have been put to the background when uninstall did something.
482 BringToFront
483
484 # ask the user if the Vim version dir must be removed
485 MessageBox MB_YESNO|MB_ICONQUESTION \
486 "Would you like to delete $0?$\n \
487 $\nIt contains the Vim executables and runtime files." IDNO NoRemoveExes
488
489 Delete /REBOOTOK $0\*.dll
Bram Moolenaar6199d432017-10-14 19:05:44 +0200490 Delete /REBOOTOK $0\GvimExt32\*.dll
491 ${If} ${RunningX64}
492 Delete /REBOOTOK $0\GvimExt64\*.dll
493 ${EndIf}
494
Bram Moolenaar071d4272004-06-13 20:20:40 +0000495 ClearErrors
496 # Remove everything but *.dll files. Avoids that
497 # a lot remains when gvimext.dll cannot be deleted.
Bram Moolenaar408b5852006-05-13 10:44:07 +0000498 RMDir /r $0\autoload
Bram Moolenaar071d4272004-06-13 20:20:40 +0000499 RMDir /r $0\colors
500 RMDir /r $0\compiler
501 RMDir /r $0\doc
502 RMDir /r $0\ftplugin
503 RMDir /r $0\indent
504 RMDir /r $0\macros
505 RMDir /r $0\plugin
Bram Moolenaar408b5852006-05-13 10:44:07 +0000506 RMDir /r $0\spell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000507 RMDir /r $0\syntax
508 RMDir /r $0\tools
509 RMDir /r $0\tutor
510 RMDir /r $0\VisVim
511 RMDir /r $0\lang
512 RMDir /r $0\keymap
513 Delete $0\*.exe
514 Delete $0\*.bat
515 Delete $0\*.vim
516 Delete $0\*.txt
517
518 IfErrors ErrorMess NoErrorMess
519 ErrorMess:
520 MessageBox MB_OK|MB_ICONEXCLAMATION \
521 "Some files in $0 have not been deleted!$\nYou must do it manually."
522 NoErrorMess:
523
524 # No error message if the "vim62" directory can't be removed, the
525 # gvimext.dll may still be there.
526 RMDir $0
527
528 NoRemoveExes:
529 # get the parent dir of the installation
530 Push $INSTDIR
531 Call un.GetParent
532 Pop $0
533 StrCpy $1 $0
534
535 # if a plugin dir was created at installation ask the user to remove it
536 # first look in the root of the installation then in HOME
537 IfFileExists $1\vimfiles AskRemove 0
538 ReadEnvStr $1 "HOME"
539 StrCmp $1 "" NoRemove 0
540
541 IfFileExists $1\vimfiles 0 NoRemove
542
543 AskRemove:
544 MessageBox MB_YESNO|MB_ICONQUESTION \
Bram Moolenaare04abda2010-08-01 22:35:43 +0200545 "Remove all files in your $1\vimfiles directory?$\n \
Bram Moolenaar760d14a2010-07-31 22:03:44 +0200546 $\nCAREFUL: If you have created something there that you want to keep, click No" IDNO Fin
Bram Moolenaar071d4272004-06-13 20:20:40 +0000547 RMDir /r $1\vimfiles
548 NoRemove:
549
550 # ask the user if the Vim root dir must be removed
551 MessageBox MB_YESNO|MB_ICONQUESTION \
552 "Would you like to remove $0?$\n \
553 $\nIt contains your Vim configuration files!" IDNO NoDelete
554 RMDir /r $0 ; skipped if no
555 NoDelete:
556
557 Fin:
558 Call un.onUnInstSuccess
559
560SectionEnd