blob: 9f9fb4ed53113728983b39a2f959613aa8779814 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001# NSIS file to create a self-installing exe for Vim.
Bram Moolenaaraf610b82018-12-21 16:22:50 +01002# It requires NSIS version 3.0 or later.
Bram Moolenaar04344822014-11-05 18:18:17 +01003# Last Change: 2014 Nov 5
Bram Moolenaar071d4272004-06-13 20:20:40 +00004
Bram Moolenaaraf610b82018-12-21 16:22:50 +01005Unicode true
6
Bram Moolenaar071d4272004-06-13 20:20:40 +00007# WARNING: if you make changes to this script, look out for $0 to be valid,
8# because uninstall deletes most files in $0.
9
Bram Moolenaarba460752013-07-04 22:35:01 +020010# Location of gvim_ole.exe, vimw32.exe, GvimExt/*, etc.
Bram Moolenaar286eacd2016-01-16 18:05:50 +010011!ifndef VIMSRC
12 !define VIMSRC "..\src"
13!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000014
15# Location of runtime files
Bram Moolenaar286eacd2016-01-16 18:05:50 +010016!ifndef VIMRT
17 !define VIMRT ".."
18!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000019
20# Location of extra tools: diff.exe
Bram Moolenaar286eacd2016-01-16 18:05:50 +010021!ifndef VIMTOOLS
22 !define VIMTOOLS ..\..
23!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000024
Bram Moolenaar6199d432017-10-14 19:05:44 +020025# Location of gettext.
26# It must contain two directories: gettext32 and gettext64.
27# See README.txt for detail.
28!ifndef GETTEXT
29 !define GETTEXT ${VIMRT}
30!endif
31
Bram Moolenaar071d4272004-06-13 20:20:40 +000032# Comment the next line if you don't have UPX.
Bram Moolenaar6199d432017-10-14 19:05:44 +020033# Get it at https://upx.github.io/
Bram Moolenaar071d4272004-06-13 20:20:40 +000034!define HAVE_UPX
35
Bram Moolenaaraf610b82018-12-21 16:22:50 +010036# Comment the next line if you do not want to add Native Language Support
Bram Moolenaar071d4272004-06-13 20:20:40 +000037!define HAVE_NLS
38
Bram Moolenaaraf610b82018-12-21 16:22:50 +010039# Uncomment the next line if you want to include VisVim extension:
40#!define HAVE_VIS_VIM
41
42# Comment the following line to create a multilanguage installer:
43!define HAVE_MULTI_LANG
44
45# Uncomment the next line if you want to create a 64-bit installer.
46#!define WIN64
47
Bram Moolenaar6c7b4442016-01-02 15:44:32 +010048!include gvim_version.nsh # for version number
Bram Moolenaar071d4272004-06-13 20:20:40 +000049
50# ----------- No configurable settings below this line -----------
51
Bram Moolenaaraf610b82018-12-21 16:22:50 +010052!include "Library.nsh" # For DLL install
53!ifdef HAVE_VIS_VIM
54 !include "UpgradeDLL.nsh" # for VisVim.dll
55!endif
56!include "LogicLib.nsh"
57!include "MUI2.nsh"
58!include "nsDialogs.nsh"
59!include "Sections.nsh"
60!include "x64.nsh"
Bram Moolenaar071d4272004-06-13 20:20:40 +000061
Bram Moolenaaraf610b82018-12-21 16:22:50 +010062!define PRODUCT "Vim ${VER_MAJOR}.${VER_MINOR}"
63!define UNINST_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall"
64!define UNINST_REG_KEY_VIM "${UNINST_REG_KEY}\${PRODUCT}"
65
66!ifdef WIN64
67Name "${PRODUCT} (x64)"
68!else
69Name "${PRODUCT}"
70!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000071OutFile gvim${VER_MAJOR}${VER_MINOR}.exe
72CRCCheck force
Bram Moolenaar286eacd2016-01-16 18:05:50 +010073SetCompressor /SOLID lzma
Bram Moolenaaraf610b82018-12-21 16:22:50 +010074SetCompressorDictSize 64
75ManifestDPIAware true
Bram Moolenaar071d4272004-06-13 20:20:40 +000076SetDatablockOptimize on
Bram Moolenaar442b4222010-05-24 21:34:22 +020077RequestExecutionLevel highest
Bram Moolenaar071d4272004-06-13 20:20:40 +000078
79!ifdef HAVE_UPX
80 !packhdr temp.dat "upx --best --compress-icons=1 temp.dat"
81!endif
82
Bram Moolenaaraf610b82018-12-21 16:22:50 +010083!ifdef WIN64
84!define BIT 64
85!else
86!define BIT 32
87!endif
88
89##########################################################
90# MUI2 settings
91
92!define MUI_ABORTWARNING
93!define MUI_UNABORTWARNING
94
95!define MUI_ICON "icons\vim_16c.ico"
96!define MUI_UNICON "icons\vim_uninst_16c.ico"
97
98# Show all languages, despite user's codepage:
99!define MUI_LANGDLL_ALLLANGUAGES
100!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
101!define MUI_LANGDLL_REGISTRY_KEY "Software\Vim"
102!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
103
104!define MUI_WELCOMEFINISHPAGE_BITMAP "icons\welcome.bmp"
105!define MUI_UNWELCOMEFINISHPAGE_BITMAP "icons\uninstall.bmp"
106!define MUI_HEADERIMAGE
107!define MUI_HEADERIMAGE_BITMAP "icons\header.bmp"
108!define MUI_HEADERIMAGE_UNBITMAP "icons\un_header.bmp"
109
110!define MUI_WELCOMEFINISHPAGE_BITMAP_STRETCH "AspectFitHeight"
111!define MUI_UNWELCOMEFINISHPAGE_BITMAP_STRETCH "AspectFitHeight"
112!define MUI_HEADERIMAGE_BITMAP_STRETCH "AspectFitHeight"
113!define MUI_HEADERIMAGE_UNBITMAP_STRETCH "AspectFitHeight"
114
115!define MUI_COMPONENTSPAGE_SMALLDESC
116!define MUI_LICENSEPAGE_CHECKBOX
117!define MUI_FINISHPAGE_RUN "$0\gvim.exe"
118!define MUI_FINISHPAGE_RUN_TEXT $(str_show_readme)
119!define MUI_FINISHPAGE_RUN_PARAMETERS "-R $\"$0\README.txt$\""
120
121# This adds '\Vim' to the user choice automagically. The actual value is
122# obtained below with CheckOldVim.
123!ifdef WIN64
124InstallDir "$PROGRAMFILES64\Vim"
125!else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000126InstallDir "$PROGRAMFILES\Vim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100127!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000128
129# Types of installs we can perform:
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100130InstType $(str_type_typical)
131InstType $(str_type_minimal)
132InstType $(str_type_full)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000133
134SilentInstall normal
135
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100136# General custom functions for MUI2:
137#!define MUI_CUSTOMFUNCTION_ABORT VimOnUserAbort
138#!define MUI_CUSTOMFUNCTION_UNABORT un.VimOnUserAbort
139
140# Installer pages
141!insertmacro MUI_PAGE_WELCOME
142!insertmacro MUI_PAGE_LICENSE "${VIMRT}\doc\uganda.nsis.txt"
143!insertmacro MUI_PAGE_COMPONENTS
144Page custom SetCustom ValidateCustom
145#!define MUI_PAGE_CUSTOMFUNCTION_LEAVE VimFinalCheck
146!insertmacro MUI_PAGE_DIRECTORY
147!insertmacro MUI_PAGE_INSTFILES
148!define MUI_FINISHPAGE_NOREBOOTSUPPORT
149!insertmacro MUI_PAGE_FINISH
150
151# Uninstaller pages:
152!insertmacro MUI_UNPAGE_CONFIRM
153#!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.VimCheckRunning
154!insertmacro MUI_UNPAGE_COMPONENTS
155!insertmacro MUI_UNPAGE_INSTFILES
156!define MUI_FINISHPAGE_NOREBOOTSUPPORT
157!insertmacro MUI_UNPAGE_FINISH
158
159##########################################################
160# Languages Files
161
162!insertmacro MUI_RESERVEFILE_LANGDLL
163!include "lang\english.nsi"
164
165# Include support for other languages:
166!ifdef HAVE_MULTI_LANG
167 !include "lang\danish.nsi"
168 !include "lang\dutch.nsi"
169 !include "lang\german.nsi"
170 !include "lang\italian.nsi"
171 !include "lang\japanese.nsi"
172 !include "lang\simpchinese.nsi"
173 !include "lang\tradchinese.nsi"
174!endif
175
176
177# Global variables
178Var vim_dialog
179Var vim_nsd_compat
180Var vim_nsd_keymap
181Var vim_nsd_mouse
182Var vim_compat_stat
183Var vim_keymap_stat
184Var vim_mouse_stat
185
Bram Moolenaar071d4272004-06-13 20:20:40 +0000186
Bram Moolenaar5d424742018-02-04 19:11:30 +0100187# Reserve files
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100188ReserveFile ${VIMSRC}\installw32.exe
Bram Moolenaar5d424742018-02-04 19:11:30 +0100189
Bram Moolenaar071d4272004-06-13 20:20:40 +0000190##########################################################
191# Functions
192
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100193# Get parent directory
194# Share this function both on installer and uninstaller
195!macro GetParent un
196Function ${un}GetParent
Bram Moolenaar071d4272004-06-13 20:20:40 +0000197 Exch $0 ; old $0 is on top of stack
198 Push $1
199 Push $2
200 StrCpy $1 -1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100201 ${Do}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000202 StrCpy $2 $0 1 $1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100203 ${If} $2 == ""
204 ${OrIf} $2 == "\"
205 ${ExitDo}
206 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000207 IntOp $1 $1 - 1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100208 ${Loop}
209 StrCpy $0 $0 $1
210 Pop $2
211 Pop $1
212 Exch $0 ; put $0 on top of stack, restore $0 to original value
213FunctionEnd
214!macroend
215
216!insertmacro GetParent ""
217!insertmacro GetParent "un."
218
219# Check if Vim is already installed.
220# return: Installed directory. If not found, it will be empty.
221Function CheckOldVim
222 Push $0
223 Push $R0
224 Push $R1
225 Push $R2
226
227 ${If} ${RunningX64}
228 SetRegView 64
229 ${EndIf}
230
231 ClearErrors
232 StrCpy $0 "" # Installed directory
233 StrCpy $R0 0 # Sub-key index
234 StrCpy $R1 "" # Sub-key
235 ${Do}
236 # Eumerate the sub-key:
237 EnumRegKey $R1 HKLM ${UNINST_REG_KEY} $R0
238
239 # Stop if no more sub-key:
240 ${If} ${Errors}
241 ${OrIf} $R1 == ""
242 ${ExitDo}
243 ${EndIf}
244
245 # Move to the next sub-key:
246 IntOp $R0 $R0 + 1
247
248 # Check if the key is Vim uninstall key or not:
249 StrCpy $R2 $R1 4
250 ${If} $R2 S!= "Vim "
251 ${Continue}
252 ${EndIf}
253
254 # Verifies required sub-keys:
255 ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "DisplayName"
256 ${If} ${Errors}
257 ${OrIf} $R2 == ""
258 ${Continue}
259 ${EndIf}
260
261 ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "UninstallString"
262 ${If} ${Errors}
263 ${OrIf} $R2 == ""
264 ${Continue}
265 ${EndIf}
266
267 # Found
268 Push $R2
269 call GetParent
270 call GetParent
271 Pop $0 # Vim directory
272 ${ExitDo}
273
274 ${Loop}
275
276 ${If} ${RunningX64}
277 SetRegView lastused
278 ${EndIf}
279
280 Pop $R2
281 Pop $R1
282 Pop $R0
283 Exch $0 # put $0 on top of stack, restore $0 to original value
Bram Moolenaar071d4272004-06-13 20:20:40 +0000284FunctionEnd
285
286##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100287Section "$(str_section_old_ver)" id_section_old_ver
288 SectionIn 1 2 3 RO
289
290 # run the install program to check for already installed versions
291 SetOutPath $TEMP
292 File /oname=install.exe ${VIMSRC}\installw32.exe
293 DetailPrint "$(str_msg_uninstalling)"
294 ${Do}
295 nsExec::Exec "$TEMP\install.exe -uninstall-check"
296 Pop $3
297
298 call CheckOldVim
299 Pop $3
300 ${If} $3 == ""
301 ${ExitDo}
302 ${Else}
303 # It seems that the old version is still remaining.
304 # TODO: Should we show a warning and run the uninstaller again?
305
306 ${ExitDo} # Just ignore for now.
307 ${EndIf}
308 ${Loop}
309 Delete $TEMP\install.exe
310 Delete $TEMP\vimini.ini # install.exe creates this, but we don't need it.
311
312 # We may have been put to the background when uninstall did something.
313 BringToFront
314SectionEnd
315
316##########################################################
317Section "$(str_section_exe)" id_section_exe
Bram Moolenaar49150a42017-09-17 21:00:03 +0200318 SectionIn 1 2 3 RO
Bram Moolenaar071d4272004-06-13 20:20:40 +0000319
320 # we need also this here if the user changes the instdir
321 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
322
323 SetOutPath $0
324 File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe
325 File /oname=install.exe ${VIMSRC}\installw32.exe
326 File /oname=uninstal.exe ${VIMSRC}\uninstalw32.exe
327 File ${VIMSRC}\vimrun.exe
Bram Moolenaarfec246d2016-08-28 18:47:14 +0200328 File /oname=tee.exe ${VIMSRC}\teew32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000329 File /oname=xxd.exe ${VIMSRC}\xxdw32.exe
Bram Moolenaar19166732018-12-21 17:59:33 +0100330 File ..\vimtutor.bat
331 File ..\README.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000332 File ..\uninstal.txt
333 File ${VIMRT}\*.vim
334 File ${VIMRT}\rgb.txt
335
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200336 File ${VIMTOOLS}\diff.exe
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100337 File ${VIMTOOLS}\winpty${BIT}.dll
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200338 File ${VIMTOOLS}\winpty-agent.exe
339
Bram Moolenaar071d4272004-06-13 20:20:40 +0000340 SetOutPath $0\colors
341 File ${VIMRT}\colors\*.*
342
343 SetOutPath $0\compiler
344 File ${VIMRT}\compiler\*.*
345
346 SetOutPath $0\doc
347 File ${VIMRT}\doc\*.txt
348 File ${VIMRT}\doc\tags
349
350 SetOutPath $0\ftplugin
351 File ${VIMRT}\ftplugin\*.*
352
353 SetOutPath $0\indent
354 File ${VIMRT}\indent\*.*
355
356 SetOutPath $0\macros
357 File ${VIMRT}\macros\*.*
Bram Moolenaarc35e4cb2017-09-06 21:43:10 +0200358 SetOutPath $0\macros\hanoi
359 File ${VIMRT}\macros\hanoi\*.*
360 SetOutPath $0\macros\life
361 File ${VIMRT}\macros\life\*.*
362 SetOutPath $0\macros\maze
363 File ${VIMRT}\macros\maze\*.*
364 SetOutPath $0\macros\urm
365 File ${VIMRT}\macros\urm\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000366
Bram Moolenaarc7baa432016-04-26 17:34:44 +0200367 SetOutPath $0\pack\dist\opt\dvorak\dvorak
368 File ${VIMRT}\pack\dist\opt\dvorak\dvorak\*.*
369 SetOutPath $0\pack\dist\opt\dvorak\plugin
370 File ${VIMRT}\pack\dist\opt\dvorak\plugin\*.*
371
372 SetOutPath $0\pack\dist\opt\editexisting\plugin
373 File ${VIMRT}\pack\dist\opt\editexisting\plugin\*.*
374
375 SetOutPath $0\pack\dist\opt\justify\plugin
376 File ${VIMRT}\pack\dist\opt\justify\plugin\*.*
377
378 SetOutPath $0\pack\dist\opt\matchit\doc
379 File ${VIMRT}\pack\dist\opt\matchit\doc\*.*
380 SetOutPath $0\pack\dist\opt\matchit\plugin
381 File ${VIMRT}\pack\dist\opt\matchit\plugin\*.*
Bram Moolenaar66ae3d12019-02-19 21:40:28 +0100382 SetOutPath $0\pack\dist\opt\matchit\autoload
383 File ${VIMRT}\pack\dist\opt\matchit\autoload\*.*
Bram Moolenaarc7baa432016-04-26 17:34:44 +0200384
385 SetOutPath $0\pack\dist\opt\shellmenu\plugin
386 File ${VIMRT}\pack\dist\opt\shellmenu\plugin\*.*
387
388 SetOutPath $0\pack\dist\opt\swapmouse\plugin
389 File ${VIMRT}\pack\dist\opt\swapmouse\plugin\*.*
390
Bram Moolenaar38623c82018-05-10 21:24:35 +0200391 SetOutPath $0\pack\dist\opt\termdebug\plugin
392 File ${VIMRT}\pack\dist\opt\termdebug\plugin\*.*
393
Bram Moolenaar071d4272004-06-13 20:20:40 +0000394 SetOutPath $0\plugin
395 File ${VIMRT}\plugin\*.*
396
Bram Moolenaar7fcab2a2006-03-25 21:46:12 +0000397 SetOutPath $0\autoload
398 File ${VIMRT}\autoload\*.*
399
Bram Moolenaard09a2062017-11-11 15:37:45 +0100400 SetOutPath $0\autoload\dist
401 File ${VIMRT}\autoload\dist\*.*
402
Bram Moolenaar18144c82006-04-12 21:52:12 +0000403 SetOutPath $0\autoload\xml
404 File ${VIMRT}\autoload\xml\*.*
405
Bram Moolenaar071d4272004-06-13 20:20:40 +0000406 SetOutPath $0\syntax
407 File ${VIMRT}\syntax\*.*
408
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000409 SetOutPath $0\spell
410 File ${VIMRT}\spell\*.txt
411 File ${VIMRT}\spell\*.vim
412 File ${VIMRT}\spell\*.spl
413 File ${VIMRT}\spell\*.sug
414
Bram Moolenaar071d4272004-06-13 20:20:40 +0000415 SetOutPath $0\tools
416 File ${VIMRT}\tools\*.*
417
418 SetOutPath $0\tutor
419 File ${VIMRT}\tutor\*.*
420SectionEnd
421
422##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100423Section "$(str_section_console)" id_section_console
Bram Moolenaar071d4272004-06-13 20:20:40 +0000424 SectionIn 1 3
425
426 SetOutPath $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100427 File /oname=vim.exe ${VIMSRC}\vimw32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000428 StrCpy $2 "$2 vim view vimdiff"
429SectionEnd
430
431##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100432Section "$(str_section_batch)" id_section_batch
Bram Moolenaar071d4272004-06-13 20:20:40 +0000433 SectionIn 3
434
435 StrCpy $1 "$1 -create-batfiles $2"
436SectionEnd
437
438##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100439SectionGroup $(str_group_icons) id_group_icons
440 Section "$(str_section_desktop)" id_section_desktop
441 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000442
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100443 StrCpy $1 "$1 -install-icons"
444 SectionEnd
445
446 Section "$(str_section_start_menu)" id_section_startmenu
447 SectionIn 1 3
448
449 StrCpy $1 "$1 -add-start-menu"
450 SectionEnd
451SectionGroupEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000452
453##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100454Section "$(str_section_edit_with)" id_section_editwith
Bram Moolenaar071d4272004-06-13 20:20:40 +0000455 SectionIn 1 3
456
Bram Moolenaar071d4272004-06-13 20:20:40 +0000457 SetOutPath $0
Bram Moolenaar6199d432017-10-14 19:05:44 +0200458
Bram Moolenaar442b4222010-05-24 21:34:22 +0200459 ${If} ${RunningX64}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200460 # Install 64-bit gvimext.dll into the GvimExt64 directory.
461 SetOutPath $0\GvimExt64
462 ClearErrors
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100463 !define LIBRARY_SHELL_EXTENSION
464 !define LIBRARY_X64
465 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
466 "${VIMSRC}\GvimExt\gvimext64.dll" \
467 "$0\GvimExt64\gvimext.dll" "$0"
468 !undef LIBRARY_X64
469 !undef LIBRARY_SHELL_EXTENSION
Bram Moolenaar442b4222010-05-24 21:34:22 +0200470 ${EndIf}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200471
Bram Moolenaar6199d432017-10-14 19:05:44 +0200472 # Install 32-bit gvimext.dll into the GvimExt32 directory.
473 SetOutPath $0\GvimExt32
474 ClearErrors
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100475 !define LIBRARY_SHELL_EXTENSION
476 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
477 "${VIMSRC}\GvimExt\gvimext.dll" \
478 "$0\GvimExt32\gvimext.dll" "$0"
479 !undef LIBRARY_SHELL_EXTENSION
Bram Moolenaar071d4272004-06-13 20:20:40 +0000480
481 # We don't have a separate entry for the "Open With..." menu, assume
482 # the user wants either both or none.
483 StrCpy $1 "$1 -install-popup -install-openwith"
484SectionEnd
485
486##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100487Section "$(str_section_vim_rc)" id_section_vimrc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000488 SectionIn 1 3
489
490 StrCpy $1 "$1 -create-vimrc"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100491
492 ${If} ${RunningX64}
493 SetRegView 64
494 ${EndIf}
495 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_compat" "$vim_compat_stat"
496 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_keyremap" "$vim_keymap_stat"
497 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_mouse" "$vim_mouse_stat"
498 ${If} ${RunningX64}
499 SetRegView lastused
500 ${EndIf}
501
502 ${If} $vim_compat_stat == "vi"
503 StrCpy $1 "$1 -vimrc-compat vi"
504 ${ElseIf} $vim_compat_stat == "vim"
505 StrCpy $1 "$1 -vimrc-compat vim"
506 ${ElseIf} $vim_compat_stat == "defaults"
507 StrCpy $1 "$1 -vimrc-compat defaults"
508 ${Else}
509 StrCpy $1 "$1 -vimrc-compat all"
510 ${EndIf}
511
512 ${If} $vim_keymap_stat == "default"
513 StrCpy $1 "$1 -vimrc-remap no"
514 ${Else}
515 StrCpy $1 "$1 -vimrc-remap win"
516 ${EndIf}
517
518 ${If} $vim_mouse_stat == "default"
519 StrCpy $1 "$1 -vimrc-behave default"
520 ${ElseIf} $vim_mouse_stat == "windows"
521 StrCpy $1 "$1 -vimrc-behave mswin"
522 ${Else}
523 StrCpy $1 "$1 -vimrc-behave unix"
524 ${EndIf}
525
Bram Moolenaar071d4272004-06-13 20:20:40 +0000526SectionEnd
527
528##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100529SectionGroup $(str_group_plugin) id_group_plugin
530 Section "$(str_section_plugin_home)" id_section_pluginhome
531 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000532
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100533 StrCpy $1 "$1 -create-directories home"
534 SectionEnd
535
536 Section "$(str_section_plugin_vim)" id_section_pluginvim
537 SectionIn 3
538
539 StrCpy $1 "$1 -create-directories vim"
540 SectionEnd
541SectionGroupEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000542
543##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100544!ifdef HAVE_VIS_VIM
545Section "$(str_section_vis_vim)" id_section_visvim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000546 SectionIn 3
547
548 SetOutPath $0
549 !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0"
550 File ${VIMSRC}\VisVim\README_VisVim.txt
551SectionEnd
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100552!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000553
554##########################################################
555!ifdef HAVE_NLS
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100556Section "$(str_section_nls)" id_section_nls
557 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000558
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100559 SetOutPath $0\lang
560 File /r ${VIMRT}\lang\*.*
561 SetOutPath $0\keymap
562 File ${VIMRT}\keymap\README.txt
563 File ${VIMRT}\keymap\*.vim
564 SetOutPath $0
565 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
566 "${GETTEXT}\gettext${BIT}\libintl-8.dll" \
567 "$0\libintl-8.dll" "$0"
568 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
569 "${GETTEXT}\gettext${BIT}\libiconv-2.dll" \
570 "$0\libiconv-2.dll" "$0"
571 !if /FileExists "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll"
572 # Install libgcc_s_sjlj-1.dll only if it is needed.
573 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
574 "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll" \
575 "$0\libgcc_s_sjlj-1.dll" "$0"
576 !endif
577
578 ${If} ${SectionIsSelected} ${id_section_editwith}
579 ${If} ${RunningX64}
580 # Install DLLs for 64-bit gvimext.dll into the GvimExt64 directory.
581 SetOutPath $0\GvimExt64
582 ClearErrors
583 !define LIBRARY_X64
584 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
585 "${GETTEXT}\gettext64\libintl-8.dll" \
586 "$0\GvimExt64\libintl-8.dll" "$0\GvimExt64"
587 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
588 "${GETTEXT}\gettext64\libiconv-2.dll" \
589 "$0\GvimExt64\libiconv-2.dll" "$0\GvimExt64"
590 !undef LIBRARY_X64
591 ${EndIf}
592
593 # Install DLLs for 32-bit gvimext.dll into the GvimExt32 directory.
594 SetOutPath $0\GvimExt32
595 ClearErrors
596 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
597 "${GETTEXT}\gettext32\libintl-8.dll" \
598 "$0\GvimExt32\libintl-8.dll" "$0\GvimExt32"
599 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
600 "${GETTEXT}\gettext32\libiconv-2.dll" \
601 "$0\GvimExt32\libiconv-2.dll" "$0\GvimExt32"
602 !if /FileExists "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll"
603 # Install libgcc_s_sjlj-1.dll only if it is needed.
604 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
605 "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll" \
606 "$0\GvimExt32\libgcc_s_sjlj-1.dll" "$0\GvimExt32"
607 !endif
608 ${EndIf}
609SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000610!endif
611
612##########################################################
613Section -call_install_exe
614 SetOutPath $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100615 DetailPrint "$(str_msg_registering)"
616 nsExec::Exec "$0\install.exe $1"
617 Pop $3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000618SectionEnd
619
620##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100621!macro SaveSectionSelection section_id reg_value
622 ${If} ${SectionIsSelected} ${section_id}
623 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 1
624 ${Else}
625 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 0
626 ${EndIf}
627!macroend
628
Bram Moolenaar071d4272004-06-13 20:20:40 +0000629Section -post
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100630
631 # Get estimated install size
632 SectionGetSize ${id_section_exe} $3
633 ${If} ${SectionIsSelected} ${id_section_console}
634 SectionGetSize ${id_section_console} $4
635 IntOp $3 $3 + $4
636 ${EndIf}
637 ${If} ${SectionIsSelected} ${id_section_editwith}
638 SectionGetSize ${id_section_editwith} $4
639 IntOp $3 $3 + $4
640 ${EndIf}
641!ifdef HAVE_VIS_VIM
642 ${If} ${SectionIsSelected} ${id_section_visvim}
643 SectionGetSize ${id_section_visvim} $4
644 IntOp $3 $3 + $4
645 ${EndIf}
646!endif
647!ifdef HAVE_NLS
648 ${If} ${SectionIsSelected} ${id_section_nls}
649 SectionGetSize ${id_section_nls} $4
650 IntOp $3 $3 + $4
651 ${EndIf}
652!endif
653
654 # Register EstimatedSize and AllowSilent.
655 # Other information will be set by the install.exe (dosinst.c).
656 ${If} ${RunningX64}
657 SetRegView 64
658 ${EndIf}
659 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "EstimatedSize" $3
660 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "AllowSilent" 1
661 ${If} ${RunningX64}
662 SetRegView lastused
663 ${EndIf}
664
665 # Store the selections to the registry.
666 ${If} ${RunningX64}
667 SetRegView 64
668 ${EndIf}
669 !insertmacro SaveSectionSelection ${id_section_console} "select_console"
670 !insertmacro SaveSectionSelection ${id_section_batch} "select_batch"
671 !insertmacro SaveSectionSelection ${id_section_desktop} "select_desktop"
672 !insertmacro SaveSectionSelection ${id_section_startmenu} "select_startmenu"
673 !insertmacro SaveSectionSelection ${id_section_editwith} "select_editwith"
674 !insertmacro SaveSectionSelection ${id_section_vimrc} "select_vimrc"
675 !insertmacro SaveSectionSelection ${id_section_pluginhome} "select_pluginhome"
676 !insertmacro SaveSectionSelection ${id_section_pluginvim} "select_pluginvim"
677!ifdef HAVE_VIS_VIM
678 !insertmacro SaveSectionSelection ${id_section_visvim} "select_visvim"
679!endif
680!ifdef HAVE_NLS
681 !insertmacro SaveSectionSelection ${id_section_nls} "select_nls"
682!endif
683 ${If} ${RunningX64}
684 SetRegView lastused
685 ${EndIf}
686
Bram Moolenaar071d4272004-06-13 20:20:40 +0000687 BringToFront
688SectionEnd
689
690##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100691!macro LoadSectionSelection section_id reg_value
692 ClearErrors
693 ReadRegDWORD $3 HKLM "${UNINST_REG_KEY_VIM}" ${reg_value}
694 ${IfNot} ${Errors}
695 ${If} $3 = 1
696 !insertmacro SelectSection ${section_id}
697 ${Else}
698 !insertmacro UnselectSection ${section_id}
699 ${EndIf}
700 ${EndIf}
701!macroend
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200702
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100703Function .onInit
704!ifdef HAVE_MULTI_LANG
705 # Select a language (or read from the registry).
706 !insertmacro MUI_LANGDLL_DISPLAY
707!endif
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200708
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100709 # Check $VIM
710 ReadEnvStr $INSTDIR "VIM"
711
712 call CheckOldVim
713 Pop $3
714 ${If} $3 == ""
715 # No old versions of Vim found. Unselect and hide the section.
716 !insertmacro UnselectSection ${id_section_old_ver}
717 SectionSetInstTypes ${id_section_old_ver} 0
718 SectionSetText ${id_section_old_ver} ""
719 ${Else}
720 ${If} $INSTDIR == ""
721 StrCpy $INSTDIR $3
722 ${EndIf}
723 ${EndIf}
724
725 # If did not find a path: use the default dir.
726 ${If} $INSTDIR == ""
727!ifdef WIN64
728 StrCpy $INSTDIR "$PROGRAMFILES64\Vim"
729!else
730 StrCpy $INSTDIR "$PROGRAMFILES\Vim"
731!endif
732 ${EndIf}
733
734# Load the selections from the registry (if any).
735 ${If} ${RunningX64}
736 SetRegView 64
737 ${EndIf}
738 !insertmacro LoadSectionSelection ${id_section_console} "select_console"
739 !insertmacro LoadSectionSelection ${id_section_batch} "select_batch"
740 !insertmacro LoadSectionSelection ${id_section_desktop} "select_desktop"
741 !insertmacro LoadSectionSelection ${id_section_startmenu} "select_startmenu"
742 !insertmacro LoadSectionSelection ${id_section_editwith} "select_editwith"
743 !insertmacro LoadSectionSelection ${id_section_vimrc} "select_vimrc"
744 !insertmacro LoadSectionSelection ${id_section_pluginhome} "select_pluginhome"
745 !insertmacro LoadSectionSelection ${id_section_pluginvim} "select_pluginvim"
746!ifdef HAVE_VIS_VIM
747 !insertmacro LoadSectionSelection ${id_section_visvim} "select_visvim"
748!endif
749!ifdef HAVE_NLS
750 !insertmacro LoadSectionSelection ${id_section_nls} "select_nls"
751!endif
752 ${If} ${RunningX64}
753 SetRegView lastused
754 ${EndIf}
755
756 # User variables:
757 # $0 - holds the directory the executables are installed to
758 # $1 - holds the parameters to be passed to install.exe. Starts with OLE
759 # registration (since a non-OLE gvim will not complain, and we want to
760 # always register an OLE gvim).
761 # $2 - holds the names to create batch files for
762 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
763 StrCpy $1 "-register-OLE"
764 StrCpy $2 "gvim evim gview gvimdiff vimtutor"
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200765FunctionEnd
766
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100767Function .onInstSuccess
768 WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe
769FunctionEnd
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200770
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100771Function .onInstFailed
772 MessageBox MB_OK|MB_ICONEXCLAMATION "$(str_msg_install_fail)" /SD IDOK
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200773FunctionEnd
774
775##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100776Function SetCustom
777 # Display the _vimrc setting dialog using nsDialogs.
778
779 # Check if a _vimrc should be created
780 ${IfNot} ${SectionIsSelected} ${id_section_vimrc}
781 Abort
782 ${EndIf}
783
784 !insertmacro MUI_HEADER_TEXT \
785 $(str_vimrc_page_title) $(str_vimrc_page_subtitle)
786
787 nsDialogs::Create 1018
788 Pop $vim_dialog
789
790 ${If} $vim_dialog == error
791 Abort
792 ${EndIf}
793
794 ${If} ${RunningX64}
795 SetRegView 64
796 ${EndIf}
797
798 GetFunctionAddress $3 ValidateCustom
799 nsDialogs::OnBack $3
800
801
802 # 1st group - Compatibility
803 ${NSD_CreateGroupBox} 0 0 100% 32% $(str_msg_compat_title)
804 Pop $3
805
806 ${NSD_CreateLabel} 5% 10% 35% 8% $(str_msg_compat_desc)
807 Pop $3
808 ${NSD_CreateDropList} 18% 19% 75% 8% ""
809 Pop $vim_nsd_compat
810 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vi)
811 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vim)
812 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_defaults)
813 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_all)
814
815 # Default selection
816 ${If} $vim_compat_stat == ""
817 ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_compat"
818 ${Else}
819 StrCpy $3 $vim_compat_stat
820 ${EndIf}
821 ${If} $3 == "defaults"
822 StrCpy $4 2
823 ${ElseIf} $3 == "vim"
824 StrCpy $4 1
825 ${ElseIf} $3 == "vi"
826 StrCpy $4 0
827 ${Else} # default
828 StrCpy $4 3
829 ${EndIf}
830 ${NSD_CB_SetSelectionIndex} $vim_nsd_compat $4
831
832
833 # 2nd group - Key remapping
834 ${NSD_CreateGroupBox} 0 35% 100% 31% $(str_msg_keymap_title)
835 Pop $3
836
837 ${NSD_CreateLabel} 5% 45% 90% 8% $(str_msg_keymap_desc)
838 Pop $3
839 ${NSD_CreateDropList} 38% 54% 55% 8% ""
840 Pop $vim_nsd_keymap
841 ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_default)
842 ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_windows)
843
844 # Default selection
845 ${If} $vim_keymap_stat == ""
846 ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_keyremap"
847 ${Else}
848 StrCpy $3 $vim_keymap_stat
849 ${EndIf}
850 ${If} $3 == "windows"
851 StrCpy $4 1
852 ${Else} # default
853 StrCpy $4 0
854 ${EndIf}
855 ${NSD_CB_SetSelectionIndex} $vim_nsd_keymap $4
856
857
858 # 3rd group - Mouse behavior
859 ${NSD_CreateGroupBox} 0 69% 100% 31% $(str_msg_mouse_title)
860 Pop $3
861
862 ${NSD_CreateLabel} 5% 79% 90% 8% $(str_msg_mouse_desc)
863 Pop $3
864 ${NSD_CreateDropList} 23% 87% 70% 8% ""
865 Pop $vim_nsd_mouse
866 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_default)
867 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_windows)
868 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_unix)
869
870 # Default selection
871 ${If} $vim_mouse_stat == ""
872 ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_mouse"
873 ${Else}
874 StrCpy $3 $vim_mouse_stat
875 ${EndIf}
876 ${If} $3 == "xterm"
877 StrCpy $4 2
878 ${ElseIf} $3 == "windows"
879 StrCpy $4 1
880 ${Else} # default
881 StrCpy $4 0
882 ${EndIf}
883 ${NSD_CB_SetSelectionIndex} $vim_nsd_mouse $4
884
885 ${If} ${RunningX64}
886 SetRegView lastused
887 ${EndIf}
888
889 nsDialogs::Show
890FunctionEnd
891
892Function ValidateCustom
893 ${NSD_CB_GetSelectionIndex} $vim_nsd_compat $3
894 ${If} $3 = 0
895 StrCpy $vim_compat_stat "vi"
896 ${ElseIf} $3 = 1
897 StrCpy $vim_compat_stat "vim"
898 ${ElseIf} $3 = 2
899 StrCpy $vim_compat_stat "defaults"
900 ${Else}
901 StrCpy $vim_compat_stat "all"
902 ${EndIf}
903
904 ${NSD_CB_GetSelectionIndex} $vim_nsd_keymap $3
905 ${If} $3 = 0
906 StrCpy $vim_keymap_stat "default"
907 ${Else}
908 StrCpy $vim_keymap_stat "windows"
909 ${EndIf}
910
911 ${NSD_CB_GetSelectionIndex} $vim_nsd_mouse $3
912 ${If} $3 = 0
913 StrCpy $vim_mouse_stat "default"
914 ${ElseIf} $3 = 1
915 StrCpy $vim_mouse_stat "windows"
916 ${Else}
917 StrCpy $vim_mouse_stat "xterm"
918 ${EndIf}
919FunctionEnd
920
921##########################################################
922# Description for Installer Sections
923
924!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
925 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_old_ver} $(str_desc_old_ver)
926 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_exe} $(str_desc_exe)
927 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_console} $(str_desc_console)
928 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_batch} $(str_desc_batch)
929 !insertmacro MUI_DESCRIPTION_TEXT ${id_group_icons} $(str_desc_icons)
930 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_desktop} $(str_desc_desktop)
931 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_startmenu} $(str_desc_start_menu)
932 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_editwith} $(str_desc_edit_with)
933 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_vimrc} $(str_desc_vim_rc)
934 !insertmacro MUI_DESCRIPTION_TEXT ${id_group_plugin} $(str_desc_plugin)
935 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginhome} $(str_desc_plugin_home)
936 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginvim} $(str_desc_plugin_vim)
937!ifdef HAVE_VIS_VIM
938 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_visvim} $(str_desc_vis_vim)
939!endif
940!ifdef HAVE_NLS
941 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_nls} $(str_desc_nls)
942!endif
943!insertmacro MUI_FUNCTION_DESCRIPTION_END
944
945
946##########################################################
947# Uninstaller Functions and Sections
948
949Function un.onInit
950!ifdef HAVE_MULTI_LANG
951 # Get the language from the registry.
952 !insertmacro MUI_UNGETLANGUAGE
953!endif
954FunctionEnd
955
956Section "un.$(str_unsection_register)" id_unsection_register
957 SectionIn RO
958
Bram Moolenaar071d4272004-06-13 20:20:40 +0000959 # Apparently $INSTDIR is set to the directory where the uninstaller is
960 # created. Thus the "vim61" directory is included in it.
961 StrCpy $0 "$INSTDIR"
962
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100963!ifdef HAVE_VIS_VIM
Bram Moolenaar071d4272004-06-13 20:20:40 +0000964 # If VisVim was installed, unregister the DLL.
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100965 ${If} ${FileExists} "$0\VisVim.dll"
966 ExecWait "regsvr32.exe /u /s $0\VisVim.dll"
967 ${EndIf}
968!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000969
970 # delete the context menu entry and batch files
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100971 DetailPrint "$(str_msg_unregistering)"
972 nsExec::Exec "$0\uninstal.exe -nsis"
973 Pop $3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000974
975 # We may have been put to the background when uninstall did something.
976 BringToFront
977
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100978 # Delete the installer language setting.
979 DeleteRegKey ${MUI_LANGDLL_REGISTRY_ROOT} ${MUI_LANGDLL_REGISTRY_KEY}
980SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000981
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100982Section "un.$(str_unsection_exe)" id_unsection_exe
983
984 StrCpy $0 "$INSTDIR"
985
986 # Delete gettext and iconv DLLs
987 ${If} ${FileExists} "$0\libiconv-2.dll"
988 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
989 "$0\libiconv-2.dll"
Bram Moolenaar6199d432017-10-14 19:05:44 +0200990 ${EndIf}
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100991 ${If} ${FileExists} "$0\libintl-8.dll"
992 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
993 "$0\libintl-8.dll"
994 ${EndIf}
995 ${If} ${FileExists} "$0\libgcc_s_sjlj-1.dll"
996 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
997 "$0\libgcc_s_sjlj-1.dll"
998 ${EndIf}
999
1000 # Delete other DLLs
1001 Delete /REBOOTOK $0\*.dll
1002
1003 # Delete 64-bit GvimExt
1004 ${If} ${RunningX64}
1005 !define LIBRARY_X64
1006 ${If} ${FileExists} "$0\GvimExt64\gvimext.dll"
1007 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1008 "$0\GvimExt64\gvimext.dll"
1009 ${EndIf}
1010 ${If} ${FileExists} "$0\GvimExt64\libiconv-2.dll"
1011 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1012 "$0\GvimExt64\libiconv-2.dll"
1013 ${EndIf}
1014 ${If} ${FileExists} "$0\GvimExt64\libintl-8.dll"
1015 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1016 "$0\GvimExt64\libintl-8.dll"
1017 ${EndIf}
1018 ${If} ${FileExists} "$0\GvimExt64\libwinpthread-1.dll"
1019 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1020 "$0\GvimExt64\libwinpthread-1.dll"
1021 ${EndIf}
1022 !undef LIBRARY_X64
1023 RMDir /r $0\GvimExt64
1024 ${EndIf}
1025
1026 # Delete 32-bit GvimExt
1027 ${If} ${FileExists} "$0\GvimExt32\gvimext.dll"
1028 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1029 "$0\GvimExt32\gvimext.dll"
1030 ${EndIf}
1031 ${If} ${FileExists} "$0\GvimExt32\libiconv-2.dll"
1032 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1033 "$0\GvimExt32\libiconv-2.dll"
1034 ${EndIf}
1035 ${If} ${FileExists} "$0\GvimExt32\libintl-8.dll"
1036 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1037 "$0\GvimExt32\libintl-8.dll"
1038 ${EndIf}
1039 ${If} ${FileExists} "$0\GvimExt32\libgcc_s_sjlj-1.dll"
1040 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1041 "$0\GvimExt32\libgcc_s_sjlj-1.dll"
1042 ${EndIf}
1043 RMDir /r $0\GvimExt32
Bram Moolenaar6199d432017-10-14 19:05:44 +02001044
Bram Moolenaar071d4272004-06-13 20:20:40 +00001045 ClearErrors
1046 # Remove everything but *.dll files. Avoids that
1047 # a lot remains when gvimext.dll cannot be deleted.
Bram Moolenaar408b5852006-05-13 10:44:07 +00001048 RMDir /r $0\autoload
Bram Moolenaar071d4272004-06-13 20:20:40 +00001049 RMDir /r $0\colors
1050 RMDir /r $0\compiler
1051 RMDir /r $0\doc
1052 RMDir /r $0\ftplugin
1053 RMDir /r $0\indent
1054 RMDir /r $0\macros
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001055 RMDir /r $0\pack
Bram Moolenaar071d4272004-06-13 20:20:40 +00001056 RMDir /r $0\plugin
Bram Moolenaar408b5852006-05-13 10:44:07 +00001057 RMDir /r $0\spell
Bram Moolenaar071d4272004-06-13 20:20:40 +00001058 RMDir /r $0\syntax
1059 RMDir /r $0\tools
1060 RMDir /r $0\tutor
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001061!ifdef HAVE_VIS_VIM
Bram Moolenaar071d4272004-06-13 20:20:40 +00001062 RMDir /r $0\VisVim
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001063!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001064 RMDir /r $0\lang
1065 RMDir /r $0\keymap
1066 Delete $0\*.exe
1067 Delete $0\*.bat
1068 Delete $0\*.vim
1069 Delete $0\*.txt
1070
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001071 ${If} ${Errors}
1072 MessageBox MB_OK|MB_ICONEXCLAMATION $(str_msg_rm_exe_fail) /SD IDOK
1073 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +00001074
1075 # No error message if the "vim62" directory can't be removed, the
1076 # gvimext.dll may still be there.
1077 RMDir $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001078SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +00001079
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001080# Remove "vimfiles" directory under the specified directory.
1081!macro RemoveVimfiles dir
1082 ${If} ${FileExists} ${dir}\vimfiles
1083 RMDir ${dir}\vimfiles\colors
1084 RMDir ${dir}\vimfiles\compiler
1085 RMDir ${dir}\vimfiles\doc
1086 RMDir ${dir}\vimfiles\ftdetect
1087 RMDir ${dir}\vimfiles\ftplugin
1088 RMDir ${dir}\vimfiles\indent
1089 RMDir ${dir}\vimfiles\keymap
1090 RMDir ${dir}\vimfiles\plugin
1091 RMDir ${dir}\vimfiles\syntax
1092 RMDir ${dir}\vimfiles
1093 ${EndIf}
1094!macroend
1095
1096SectionGroup "un.$(str_ungroup_plugin)" id_ungroup_plugin
1097 Section /o "un.$(str_unsection_plugin_home)" id_unsection_plugin_home
1098 # get the home dir
1099 ReadEnvStr $0 "HOME"
1100 ${If} $0 == ""
1101 ReadEnvStr $0 "HOMEDRIVE"
1102 ReadEnvStr $1 "HOMEPATH"
1103 StrCpy $0 "$0$1"
1104 ${If} $0 == ""
1105 ReadEnvStr $0 "USERPROFILE"
1106 ${EndIf}
1107 ${EndIf}
1108
1109 ${If} $0 != ""
1110 !insertmacro RemoveVimfiles $0
1111 ${EndIf}
1112 SectionEnd
1113
1114 Section "un.$(str_unsection_plugin_vim)" id_unsection_plugin_vim
1115 # get the parent dir of the installation
1116 Push $INSTDIR
1117 Call un.GetParent
1118 Pop $0
1119
1120 # if a plugin dir was created at installation remove it
1121 !insertmacro RemoveVimfiles $0
1122 SectionEnd
1123SectionGroupEnd
1124
1125Section "un.$(str_unsection_rootdir)" id_unsection_rootdir
Bram Moolenaar071d4272004-06-13 20:20:40 +00001126 # get the parent dir of the installation
1127 Push $INSTDIR
1128 Call un.GetParent
1129 Pop $0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001130
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001131 Delete $0\_vimrc
1132 RMDir $0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001133SectionEnd
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001134
1135##########################################################
1136# Description for Uninstaller Sections
1137
1138!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
1139 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_register} $(str_desc_unregister)
1140 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_exe} $(str_desc_rm_exe)
1141 !insertmacro MUI_DESCRIPTION_TEXT ${id_ungroup_plugin} $(str_desc_rm_plugin)
1142 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_home} $(str_desc_rm_plugin_home)
1143 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_vim} $(str_desc_rm_plugin_vim)
1144 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_rootdir} $(str_desc_rm_rootdir)
1145!insertmacro MUI_UNFUNCTION_DESCRIPTION_END