blob: 55bb4ce0072e02f7c1b4b41b8b935e81b81f4476 [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
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +020086Page custom SetCustom ValidateCustom ": _vimrc setting"
Bram Moolenaar071d4272004-06-13 20:20:40 +000087Page directory "" "" CheckInstallDir
88Page instfiles
89UninstPage uninstConfirm
90UninstPage instfiles
91
Bram Moolenaar5d424742018-02-04 19:11:30 +010092# Reserve files
93# Needed for showing the _vimrc setting page faster.
94ReserveFile /plugin InstallOptions.dll
95ReserveFile vimrc.ini
96
Bram Moolenaar071d4272004-06-13 20:20:40 +000097##########################################################
98# Functions
99
100Function .onInit
101 MessageBox MB_YESNO|MB_ICONQUESTION \
102 "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer.$\n Continue?" \
Bram Moolenaara1bd86e2017-06-24 15:11:01 +0200103 /SD IDYES \
104 IDYES NoAbort
Bram Moolenaar071d4272004-06-13 20:20:40 +0000105 Abort ; causes installer to quit.
106 NoAbort:
107
108 # run the install program to check for already installed versions
109 SetOutPath $TEMP
110 File /oname=install.exe ${VIMSRC}\installw32.exe
111 ExecWait "$TEMP\install.exe -uninstall-check"
112 Delete $TEMP\install.exe
113
114 # We may have been put to the background when uninstall did something.
115 BringToFront
116
117 # Install will have created a file for us that contains the directory where
118 # we should install. This is $VIM if it's set. This appears to be the only
119 # way to get the value of $VIM here!?
120 ReadINIStr $INSTDIR $TEMP\vimini.ini vimini dir
121 Delete $TEMP\vimini.ini
122
123 # If ReadINIStr failed or did not find a path: use the default dir.
124 StrCmp $INSTDIR "" 0 IniOK
125 StrCpy $INSTDIR "$PROGRAMFILES\Vim"
126 IniOK:
127
128 # Should check for the value of $VIM and use it. Unfortunately I don't know
129 # how to obtain the value of $VIM
130 # IfFileExists "$VIM" 0 No_Vim
131 # StrCpy $INSTDIR "$VIM"
132 # No_Vim:
133
134 # User variables:
135 # $0 - holds the directory the executables are installed to
136 # $1 - holds the parameters to be passed to install.exe. Starts with OLE
137 # registration (since a non-OLE gvim will not complain, and we want to
138 # always register an OLE gvim).
139 # $2 - holds the names to create batch files for
140 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
141 StrCpy $1 "-register-OLE"
Bram Moolenaar7fcab2a2006-03-25 21:46:12 +0000142 StrCpy $2 "gvim evim gview gvimdiff vimtutor"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000143
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200144 # Extract InstallOptions files
145 # $PLUGINSDIR will automatically be removed when the installer closes
146 InitPluginsDir
147 File /oname=$PLUGINSDIR\vimrc.ini "vimrc.ini"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000148FunctionEnd
149
150Function .onUserAbort
151 MessageBox MB_YESNO|MB_ICONQUESTION "Abort install?" IDYES NoCancelAbort
152 Abort ; causes installer to not quit.
153 NoCancelAbort:
154FunctionEnd
155
156# We only accept the directory if it ends in "vim". Using .onVerifyInstDir has
157# the disadvantage that the browse dialog is difficult to use.
158Function CheckInstallDir
Bram Moolenaar071d4272004-06-13 20:20:40 +0000159FunctionEnd
160
161Function .onInstSuccess
162 WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe
163 MessageBox MB_YESNO|MB_ICONQUESTION \
Bram Moolenaarf2330482008-06-24 20:19:36 +0000164 "The installation process has been successful. Happy Vimming! \
Bram Moolenaar071d4272004-06-13 20:20:40 +0000165 $\n$\n Do you want to see the README file now?" IDNO NoReadme
166 Exec '$0\gvim.exe -R "$0\README.txt"'
167 NoReadme:
168FunctionEnd
169
170Function .onInstFailed
171 MessageBox MB_OK|MB_ICONEXCLAMATION "Installation failed. Better luck next time."
172FunctionEnd
173
174Function un.onUnInstSuccess
175 MessageBox MB_OK|MB_ICONINFORMATION \
176 "Vim ${VER_MAJOR}.${VER_MINOR} has been (partly) removed from your system"
177FunctionEnd
178
179Function un.GetParent
180 Exch $0 ; old $0 is on top of stack
181 Push $1
182 Push $2
183 StrCpy $1 -1
184 loop:
185 StrCpy $2 $0 1 $1
186 StrCmp $2 "" exit
187 StrCmp $2 "\" exit
188 IntOp $1 $1 - 1
189 Goto loop
190 exit:
191 StrCpy $0 $0 $1
192 Pop $2
193 Pop $1
194 Exch $0 ; put $0 on top of stack, restore $0 to original value
195FunctionEnd
196
197##########################################################
198Section "Vim executables and runtime files"
Bram Moolenaar49150a42017-09-17 21:00:03 +0200199 SectionIn 1 2 3 RO
Bram Moolenaar071d4272004-06-13 20:20:40 +0000200
201 # we need also this here if the user changes the instdir
202 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
203
204 SetOutPath $0
205 File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe
206 File /oname=install.exe ${VIMSRC}\installw32.exe
207 File /oname=uninstal.exe ${VIMSRC}\uninstalw32.exe
208 File ${VIMSRC}\vimrun.exe
Bram Moolenaarfec246d2016-08-28 18:47:14 +0200209 File /oname=tee.exe ${VIMSRC}\teew32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000210 File /oname=xxd.exe ${VIMSRC}\xxdw32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000211 File ${VIMRT}\vimtutor.bat
212 File ${VIMRT}\README.txt
213 File ..\uninstal.txt
214 File ${VIMRT}\*.vim
215 File ${VIMRT}\rgb.txt
216
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200217 File ${VIMTOOLS}\diff.exe
218 File ${VIMTOOLS}\winpty32.dll
219 File ${VIMTOOLS}\winpty-agent.exe
220
Bram Moolenaar071d4272004-06-13 20:20:40 +0000221 SetOutPath $0\colors
222 File ${VIMRT}\colors\*.*
223
224 SetOutPath $0\compiler
225 File ${VIMRT}\compiler\*.*
226
227 SetOutPath $0\doc
228 File ${VIMRT}\doc\*.txt
229 File ${VIMRT}\doc\tags
230
231 SetOutPath $0\ftplugin
232 File ${VIMRT}\ftplugin\*.*
233
234 SetOutPath $0\indent
235 File ${VIMRT}\indent\*.*
236
237 SetOutPath $0\macros
238 File ${VIMRT}\macros\*.*
Bram Moolenaarc35e4cb2017-09-06 21:43:10 +0200239 SetOutPath $0\macros\hanoi
240 File ${VIMRT}\macros\hanoi\*.*
241 SetOutPath $0\macros\life
242 File ${VIMRT}\macros\life\*.*
243 SetOutPath $0\macros\maze
244 File ${VIMRT}\macros\maze\*.*
245 SetOutPath $0\macros\urm
246 File ${VIMRT}\macros\urm\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000247
Bram Moolenaarc7baa432016-04-26 17:34:44 +0200248 SetOutPath $0\pack\dist\opt\dvorak\dvorak
249 File ${VIMRT}\pack\dist\opt\dvorak\dvorak\*.*
250 SetOutPath $0\pack\dist\opt\dvorak\plugin
251 File ${VIMRT}\pack\dist\opt\dvorak\plugin\*.*
252
253 SetOutPath $0\pack\dist\opt\editexisting\plugin
254 File ${VIMRT}\pack\dist\opt\editexisting\plugin\*.*
255
256 SetOutPath $0\pack\dist\opt\justify\plugin
257 File ${VIMRT}\pack\dist\opt\justify\plugin\*.*
258
259 SetOutPath $0\pack\dist\opt\matchit\doc
260 File ${VIMRT}\pack\dist\opt\matchit\doc\*.*
261 SetOutPath $0\pack\dist\opt\matchit\plugin
262 File ${VIMRT}\pack\dist\opt\matchit\plugin\*.*
263
264 SetOutPath $0\pack\dist\opt\shellmenu\plugin
265 File ${VIMRT}\pack\dist\opt\shellmenu\plugin\*.*
266
267 SetOutPath $0\pack\dist\opt\swapmouse\plugin
268 File ${VIMRT}\pack\dist\opt\swapmouse\plugin\*.*
269
Bram Moolenaar38623c82018-05-10 21:24:35 +0200270 SetOutPath $0\pack\dist\opt\termdebug\plugin
271 File ${VIMRT}\pack\dist\opt\termdebug\plugin\*.*
272
Bram Moolenaar071d4272004-06-13 20:20:40 +0000273 SetOutPath $0\plugin
274 File ${VIMRT}\plugin\*.*
275
Bram Moolenaar7fcab2a2006-03-25 21:46:12 +0000276 SetOutPath $0\autoload
277 File ${VIMRT}\autoload\*.*
278
Bram Moolenaard09a2062017-11-11 15:37:45 +0100279 SetOutPath $0\autoload\dist
280 File ${VIMRT}\autoload\dist\*.*
281
Bram Moolenaar18144c82006-04-12 21:52:12 +0000282 SetOutPath $0\autoload\xml
283 File ${VIMRT}\autoload\xml\*.*
284
Bram Moolenaar071d4272004-06-13 20:20:40 +0000285 SetOutPath $0\syntax
286 File ${VIMRT}\syntax\*.*
287
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000288 SetOutPath $0\spell
289 File ${VIMRT}\spell\*.txt
290 File ${VIMRT}\spell\*.vim
291 File ${VIMRT}\spell\*.spl
292 File ${VIMRT}\spell\*.sug
293
Bram Moolenaar071d4272004-06-13 20:20:40 +0000294 SetOutPath $0\tools
295 File ${VIMRT}\tools\*.*
296
297 SetOutPath $0\tutor
298 File ${VIMRT}\tutor\*.*
299SectionEnd
300
301##########################################################
302Section "Vim console program (vim.exe)"
303 SectionIn 1 3
304
305 SetOutPath $0
306 ReadRegStr $R0 HKLM \
307 "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
308 IfErrors 0 lbl_winnt
Bram Moolenaarba460752013-07-04 22:35:01 +0200309 # Windows 95/98/ME: not supported
Bram Moolenaar071d4272004-06-13 20:20:40 +0000310 Goto lbl_done
311 lbl_winnt:
Bram Moolenaar266411a2013-07-05 20:01:32 +0200312 # Windows NT/2000/XP and later
Bram Moolenaar071d4272004-06-13 20:20:40 +0000313 File /oname=vim.exe ${VIMSRC}\vimw32.exe
314 lbl_done:
315 StrCpy $2 "$2 vim view vimdiff"
316SectionEnd
317
318##########################################################
319Section "Create .bat files for command line use"
320 SectionIn 3
321
322 StrCpy $1 "$1 -create-batfiles $2"
323SectionEnd
324
325##########################################################
326Section "Create icons on the Desktop"
327 SectionIn 1 3
328
329 StrCpy $1 "$1 -install-icons"
330SectionEnd
331
332##########################################################
333Section "Add Vim to the Start Menu"
334 SectionIn 1 3
335
336 StrCpy $1 "$1 -add-start-menu"
337SectionEnd
338
339##########################################################
340Section "Add an Edit-with-Vim context menu entry"
341 SectionIn 1 3
342
343 # Be aware of this sequence of events:
344 # - user uninstalls Vim, gvimext.dll can't be removed (it's in use) and
345 # is scheduled to be removed at next reboot.
346 # - user installs Vim in same directory, gvimext.dll still exists.
347 # If we now skip installing gvimext.dll, it will disappear at the next
348 # reboot. Thus when copying gvimext.dll fails always schedule it to be
349 # installed at the next reboot. Can't use UpgradeDLL!
350 # We don't ask the user to reboot, the old dll will keep on working.
351 SetOutPath $0
352 ClearErrors
353 SetOverwrite try
Bram Moolenaar6199d432017-10-14 19:05:44 +0200354
Bram Moolenaar442b4222010-05-24 21:34:22 +0200355 ${If} ${RunningX64}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200356 # Install 64-bit gvimext.dll into the GvimExt64 directory.
357 SetOutPath $0\GvimExt64
358 ClearErrors
Bram Moolenaar442b4222010-05-24 21:34:22 +0200359 File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext64.dll
Bram Moolenaar6199d432017-10-14 19:05:44 +0200360!ifdef HAVE_NLS
361 File ${GETTEXT}\gettext64\libintl-8.dll
362 File ${GETTEXT}\gettext64\libiconv-2.dll
363!endif
364
365 IfErrors 0 GvimExt64Done
366
367 # Can't copy gvimext.dll, create it under another name and rename it
368 # on next reboot.
369 GetTempFileName $3 $0\GvimExt64
Bram Moolenaar81b07b52017-10-15 21:43:21 +0200370 File /oname=$3 ${VIMSRC}\GvimExt\gvimext64.dll
Bram Moolenaar6199d432017-10-14 19:05:44 +0200371 Rename /REBOOTOK $3 $0\GvimExt64\gvimext.dll
372!ifdef HAVE_NLS
373 GetTempFileName $3 $0\GvimExt64
374 File /oname=$3 ${GETTEXT}\gettext64\libintl-8.dll
375 Rename /REBOOTOK $3 $0\GvimExt64\libintl-8.dll
376 GetTempFileName $3 $0\GvimExt64
377 File /oname=$3 ${GETTEXT}\gettext64\libiconv-2.dll
378 Rename /REBOOTOK $3 $0\GvimExt64\libiconv-2.dll
379!endif
Bram Moolenaar442b4222010-05-24 21:34:22 +0200380 ${EndIf}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200381
382 GvimExt64Done:
383
384 # Install 32-bit gvimext.dll into the GvimExt32 directory.
385 SetOutPath $0\GvimExt32
386 ClearErrors
387
388 File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll
389!ifdef HAVE_NLS
390 File ${GETTEXT}\gettext32\libintl-8.dll
391 File ${GETTEXT}\gettext32\libiconv-2.dll
392 File ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll
393!endif
394
395 IfErrors 0 GvimExt32Done
Bram Moolenaar071d4272004-06-13 20:20:40 +0000396
397 # Can't copy gvimext.dll, create it under another name and rename it on
398 # next reboot.
Bram Moolenaar6199d432017-10-14 19:05:44 +0200399 GetTempFileName $3 $0\GvimExt32
400 File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll
401 Rename /REBOOTOK $3 $0\GvimExt32\gvimext.dll
402!ifdef HAVE_NLS
403 GetTempFileName $3 $0\GvimExt32
404 File /oname=$3 ${GETTEXT}\gettext32\libintl-8.dll
405 Rename /REBOOTOK $3 $0\GvimExt32\libintl-8.dll
406 GetTempFileName $3 $0\GvimExt32
407 File /oname=$3 ${GETTEXT}\gettext32\libiconv-2.dll
408 Rename /REBOOTOK $3 $0\GvimExt32\libiconv-2.dll
409 GetTempFileName $3 $0\GvimExt32
410 File /oname=$3 ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll
411 Rename /REBOOTOK $3 $0\GvimExt32\libgcc_s_sjlj-1.dll
412!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000413
Bram Moolenaar6199d432017-10-14 19:05:44 +0200414 GvimExt32Done:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000415 SetOverwrite lastused
416
417 # We don't have a separate entry for the "Open With..." menu, assume
418 # the user wants either both or none.
419 StrCpy $1 "$1 -install-popup -install-openwith"
420SectionEnd
421
422##########################################################
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200423Section "Create a _vimrc if it doesn't exist" sec_vimrc_id
Bram Moolenaar071d4272004-06-13 20:20:40 +0000424 SectionIn 1 3
425
426 StrCpy $1 "$1 -create-vimrc"
427SectionEnd
428
429##########################################################
430Section "Create plugin directories in HOME or VIM"
431 SectionIn 1 3
432
433 StrCpy $1 "$1 -create-directories home"
434SectionEnd
435
436##########################################################
437Section "Create plugin directories in VIM"
438 SectionIn 3
439
440 StrCpy $1 "$1 -create-directories vim"
441SectionEnd
442
443##########################################################
444Section "VisVim Extension for MS Visual Studio"
445 SectionIn 3
446
447 SetOutPath $0
448 !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0"
449 File ${VIMSRC}\VisVim\README_VisVim.txt
450SectionEnd
451
452##########################################################
453!ifdef HAVE_NLS
454 Section "Native Language Support"
455 SectionIn 1 3
456
457 SetOutPath $0\lang
458 File /r ${VIMRT}\lang\*.*
459 SetOutPath $0\keymap
460 File ${VIMRT}\keymap\README.txt
461 File ${VIMRT}\keymap\*.vim
462 SetOutPath $0
Bram Moolenaar6199d432017-10-14 19:05:44 +0200463 File ${GETTEXT}\gettext32\libintl-8.dll
464 File ${GETTEXT}\gettext32\libiconv-2.dll
465 #File /nonfatal ${VIMRT}\libwinpthread-1.dll
466 File /nonfatal ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll
Bram Moolenaar071d4272004-06-13 20:20:40 +0000467 SectionEnd
468!endif
469
470##########################################################
471Section -call_install_exe
472 SetOutPath $0
473 ExecWait "$0\install.exe $1"
474SectionEnd
475
476##########################################################
477Section -post
478 BringToFront
479SectionEnd
480
481##########################################################
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200482Function SetCustom
483 # Display the InstallOptions dialog
484
485 # Check if a _vimrc should be created
Bram Moolenaar5d424742018-02-04 19:11:30 +0100486 SectionGetFlags ${sec_vimrc_id} $3
487 IntOp $3 $3 & 1
488 StrCmp $3 "1" +2 0
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200489 Abort
490
Bram Moolenaar5d424742018-02-04 19:11:30 +0100491 InstallOptions::dialog "$PLUGINSDIR\vimrc.ini"
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200492 Pop $3
493FunctionEnd
494
495Function ValidateCustom
496 ReadINIStr $3 "$PLUGINSDIR\vimrc.ini" "Field 2" "State"
497 StrCmp $3 "1" 0 +3
498 StrCpy $1 "$1 -vimrc-remap no"
499 Goto behave
500
501 StrCpy $1 "$1 -vimrc-remap win"
502
503 behave:
504 ReadINIStr $3 "$PLUGINSDIR\vimrc.ini" "Field 5" "State"
505 StrCmp $3 "1" 0 +3
506 StrCpy $1 "$1 -vimrc-behave unix"
507 Goto done
508
509 ReadINIStr $3 "$PLUGINSDIR\vimrc.ini" "Field 6" "State"
510 StrCmp $3 "1" 0 +3
511 StrCpy $1 "$1 -vimrc-behave mswin"
512 Goto done
513
514 StrCpy $1 "$1 -vimrc-behave default"
515 done:
516FunctionEnd
517
518##########################################################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000519Section Uninstall
520 # Apparently $INSTDIR is set to the directory where the uninstaller is
521 # created. Thus the "vim61" directory is included in it.
522 StrCpy $0 "$INSTDIR"
523
524 # If VisVim was installed, unregister the DLL.
525 IfFileExists "$0\VisVim.dll" Has_VisVim No_VisVim
526 Has_VisVim:
527 ExecWait "regsvr32.exe /u /s $0\VisVim.dll"
528
529 No_VisVim:
530
531 # delete the context menu entry and batch files
532 ExecWait "$0\uninstal.exe -nsis"
533
534 # We may have been put to the background when uninstall did something.
535 BringToFront
536
537 # ask the user if the Vim version dir must be removed
538 MessageBox MB_YESNO|MB_ICONQUESTION \
539 "Would you like to delete $0?$\n \
540 $\nIt contains the Vim executables and runtime files." IDNO NoRemoveExes
541
542 Delete /REBOOTOK $0\*.dll
Bram Moolenaar6199d432017-10-14 19:05:44 +0200543 Delete /REBOOTOK $0\GvimExt32\*.dll
544 ${If} ${RunningX64}
545 Delete /REBOOTOK $0\GvimExt64\*.dll
546 ${EndIf}
547
Bram Moolenaar071d4272004-06-13 20:20:40 +0000548 ClearErrors
549 # Remove everything but *.dll files. Avoids that
550 # a lot remains when gvimext.dll cannot be deleted.
Bram Moolenaar408b5852006-05-13 10:44:07 +0000551 RMDir /r $0\autoload
Bram Moolenaar071d4272004-06-13 20:20:40 +0000552 RMDir /r $0\colors
553 RMDir /r $0\compiler
554 RMDir /r $0\doc
555 RMDir /r $0\ftplugin
556 RMDir /r $0\indent
557 RMDir /r $0\macros
558 RMDir /r $0\plugin
Bram Moolenaar408b5852006-05-13 10:44:07 +0000559 RMDir /r $0\spell
Bram Moolenaar071d4272004-06-13 20:20:40 +0000560 RMDir /r $0\syntax
561 RMDir /r $0\tools
562 RMDir /r $0\tutor
563 RMDir /r $0\VisVim
564 RMDir /r $0\lang
565 RMDir /r $0\keymap
566 Delete $0\*.exe
567 Delete $0\*.bat
568 Delete $0\*.vim
569 Delete $0\*.txt
570
571 IfErrors ErrorMess NoErrorMess
572 ErrorMess:
573 MessageBox MB_OK|MB_ICONEXCLAMATION \
574 "Some files in $0 have not been deleted!$\nYou must do it manually."
575 NoErrorMess:
576
577 # No error message if the "vim62" directory can't be removed, the
578 # gvimext.dll may still be there.
579 RMDir $0
580
581 NoRemoveExes:
582 # get the parent dir of the installation
583 Push $INSTDIR
584 Call un.GetParent
585 Pop $0
586 StrCpy $1 $0
587
588 # if a plugin dir was created at installation ask the user to remove it
589 # first look in the root of the installation then in HOME
590 IfFileExists $1\vimfiles AskRemove 0
591 ReadEnvStr $1 "HOME"
592 StrCmp $1 "" NoRemove 0
593
594 IfFileExists $1\vimfiles 0 NoRemove
595
596 AskRemove:
597 MessageBox MB_YESNO|MB_ICONQUESTION \
Bram Moolenaare04abda2010-08-01 22:35:43 +0200598 "Remove all files in your $1\vimfiles directory?$\n \
Bram Moolenaar760d14a2010-07-31 22:03:44 +0200599 $\nCAREFUL: If you have created something there that you want to keep, click No" IDNO Fin
Bram Moolenaar071d4272004-06-13 20:20:40 +0000600 RMDir /r $1\vimfiles
601 NoRemove:
602
603 # ask the user if the Vim root dir must be removed
604 MessageBox MB_YESNO|MB_ICONQUESTION \
605 "Would you like to remove $0?$\n \
606 $\nIt contains your Vim configuration files!" IDNO NoDelete
607 RMDir /r $0 ; skipped if no
608 NoDelete:
609
610 Fin:
611 Call un.onUnInstSuccess
612
613SectionEnd