blob: 2e990b8a057400b992162eef1ed9aa2651d166f7 [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
Bram Moolenaar6a95c882019-03-26 23:02:46 +0100357 File /r ${VIMRT}\macros\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000358
Bram Moolenaar6a95c882019-03-26 23:02:46 +0100359 SetOutPath $0\pack
360 File /r ${VIMRT}\pack\*.*
Bram Moolenaar38623c82018-05-10 21:24:35 +0200361
Bram Moolenaar071d4272004-06-13 20:20:40 +0000362 SetOutPath $0\plugin
363 File ${VIMRT}\plugin\*.*
364
Bram Moolenaar7fcab2a2006-03-25 21:46:12 +0000365 SetOutPath $0\autoload
366 File ${VIMRT}\autoload\*.*
367
Bram Moolenaard09a2062017-11-11 15:37:45 +0100368 SetOutPath $0\autoload\dist
369 File ${VIMRT}\autoload\dist\*.*
370
Bram Moolenaar18144c82006-04-12 21:52:12 +0000371 SetOutPath $0\autoload\xml
372 File ${VIMRT}\autoload\xml\*.*
373
Bram Moolenaar071d4272004-06-13 20:20:40 +0000374 SetOutPath $0\syntax
375 File ${VIMRT}\syntax\*.*
376
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000377 SetOutPath $0\spell
378 File ${VIMRT}\spell\*.txt
379 File ${VIMRT}\spell\*.vim
380 File ${VIMRT}\spell\*.spl
381 File ${VIMRT}\spell\*.sug
382
Bram Moolenaar071d4272004-06-13 20:20:40 +0000383 SetOutPath $0\tools
384 File ${VIMRT}\tools\*.*
385
386 SetOutPath $0\tutor
387 File ${VIMRT}\tutor\*.*
388SectionEnd
389
390##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100391Section "$(str_section_console)" id_section_console
Bram Moolenaar071d4272004-06-13 20:20:40 +0000392 SectionIn 1 3
393
394 SetOutPath $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100395 File /oname=vim.exe ${VIMSRC}\vimw32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000396 StrCpy $2 "$2 vim view vimdiff"
397SectionEnd
398
399##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100400Section "$(str_section_batch)" id_section_batch
Bram Moolenaar071d4272004-06-13 20:20:40 +0000401 SectionIn 3
402
403 StrCpy $1 "$1 -create-batfiles $2"
404SectionEnd
405
406##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100407SectionGroup $(str_group_icons) id_group_icons
408 Section "$(str_section_desktop)" id_section_desktop
409 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000410
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100411 StrCpy $1 "$1 -install-icons"
412 SectionEnd
413
414 Section "$(str_section_start_menu)" id_section_startmenu
415 SectionIn 1 3
416
417 StrCpy $1 "$1 -add-start-menu"
418 SectionEnd
419SectionGroupEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000420
421##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100422Section "$(str_section_edit_with)" id_section_editwith
Bram Moolenaar071d4272004-06-13 20:20:40 +0000423 SectionIn 1 3
424
Bram Moolenaar071d4272004-06-13 20:20:40 +0000425 SetOutPath $0
Bram Moolenaar6199d432017-10-14 19:05:44 +0200426
Bram Moolenaar442b4222010-05-24 21:34:22 +0200427 ${If} ${RunningX64}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200428 # Install 64-bit gvimext.dll into the GvimExt64 directory.
429 SetOutPath $0\GvimExt64
430 ClearErrors
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100431 !define LIBRARY_SHELL_EXTENSION
432 !define LIBRARY_X64
433 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
434 "${VIMSRC}\GvimExt\gvimext64.dll" \
435 "$0\GvimExt64\gvimext.dll" "$0"
436 !undef LIBRARY_X64
437 !undef LIBRARY_SHELL_EXTENSION
Bram Moolenaar442b4222010-05-24 21:34:22 +0200438 ${EndIf}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200439
Bram Moolenaar6199d432017-10-14 19:05:44 +0200440 # Install 32-bit gvimext.dll into the GvimExt32 directory.
441 SetOutPath $0\GvimExt32
442 ClearErrors
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100443 !define LIBRARY_SHELL_EXTENSION
444 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
445 "${VIMSRC}\GvimExt\gvimext.dll" \
446 "$0\GvimExt32\gvimext.dll" "$0"
447 !undef LIBRARY_SHELL_EXTENSION
Bram Moolenaar071d4272004-06-13 20:20:40 +0000448
449 # We don't have a separate entry for the "Open With..." menu, assume
450 # the user wants either both or none.
451 StrCpy $1 "$1 -install-popup -install-openwith"
452SectionEnd
453
454##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100455Section "$(str_section_vim_rc)" id_section_vimrc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000456 SectionIn 1 3
457
458 StrCpy $1 "$1 -create-vimrc"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100459
460 ${If} ${RunningX64}
461 SetRegView 64
462 ${EndIf}
463 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_compat" "$vim_compat_stat"
464 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_keyremap" "$vim_keymap_stat"
465 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_mouse" "$vim_mouse_stat"
466 ${If} ${RunningX64}
467 SetRegView lastused
468 ${EndIf}
469
470 ${If} $vim_compat_stat == "vi"
471 StrCpy $1 "$1 -vimrc-compat vi"
472 ${ElseIf} $vim_compat_stat == "vim"
473 StrCpy $1 "$1 -vimrc-compat vim"
474 ${ElseIf} $vim_compat_stat == "defaults"
475 StrCpy $1 "$1 -vimrc-compat defaults"
476 ${Else}
477 StrCpy $1 "$1 -vimrc-compat all"
478 ${EndIf}
479
480 ${If} $vim_keymap_stat == "default"
481 StrCpy $1 "$1 -vimrc-remap no"
482 ${Else}
483 StrCpy $1 "$1 -vimrc-remap win"
484 ${EndIf}
485
486 ${If} $vim_mouse_stat == "default"
487 StrCpy $1 "$1 -vimrc-behave default"
488 ${ElseIf} $vim_mouse_stat == "windows"
489 StrCpy $1 "$1 -vimrc-behave mswin"
490 ${Else}
491 StrCpy $1 "$1 -vimrc-behave unix"
492 ${EndIf}
493
Bram Moolenaar071d4272004-06-13 20:20:40 +0000494SectionEnd
495
496##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100497SectionGroup $(str_group_plugin) id_group_plugin
498 Section "$(str_section_plugin_home)" id_section_pluginhome
499 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000500
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100501 StrCpy $1 "$1 -create-directories home"
502 SectionEnd
503
504 Section "$(str_section_plugin_vim)" id_section_pluginvim
505 SectionIn 3
506
507 StrCpy $1 "$1 -create-directories vim"
508 SectionEnd
509SectionGroupEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000510
511##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100512!ifdef HAVE_VIS_VIM
513Section "$(str_section_vis_vim)" id_section_visvim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000514 SectionIn 3
515
516 SetOutPath $0
517 !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0"
518 File ${VIMSRC}\VisVim\README_VisVim.txt
519SectionEnd
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100520!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000521
522##########################################################
523!ifdef HAVE_NLS
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100524Section "$(str_section_nls)" id_section_nls
525 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000526
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100527 SetOutPath $0\lang
528 File /r ${VIMRT}\lang\*.*
529 SetOutPath $0\keymap
530 File ${VIMRT}\keymap\README.txt
531 File ${VIMRT}\keymap\*.vim
532 SetOutPath $0
533 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
534 "${GETTEXT}\gettext${BIT}\libintl-8.dll" \
535 "$0\libintl-8.dll" "$0"
536 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
537 "${GETTEXT}\gettext${BIT}\libiconv-2.dll" \
538 "$0\libiconv-2.dll" "$0"
539 !if /FileExists "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll"
540 # Install libgcc_s_sjlj-1.dll only if it is needed.
541 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
542 "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll" \
543 "$0\libgcc_s_sjlj-1.dll" "$0"
544 !endif
545
546 ${If} ${SectionIsSelected} ${id_section_editwith}
547 ${If} ${RunningX64}
548 # Install DLLs for 64-bit gvimext.dll into the GvimExt64 directory.
549 SetOutPath $0\GvimExt64
550 ClearErrors
551 !define LIBRARY_X64
552 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
553 "${GETTEXT}\gettext64\libintl-8.dll" \
554 "$0\GvimExt64\libintl-8.dll" "$0\GvimExt64"
555 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
556 "${GETTEXT}\gettext64\libiconv-2.dll" \
557 "$0\GvimExt64\libiconv-2.dll" "$0\GvimExt64"
558 !undef LIBRARY_X64
559 ${EndIf}
560
561 # Install DLLs for 32-bit gvimext.dll into the GvimExt32 directory.
562 SetOutPath $0\GvimExt32
563 ClearErrors
564 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
565 "${GETTEXT}\gettext32\libintl-8.dll" \
566 "$0\GvimExt32\libintl-8.dll" "$0\GvimExt32"
567 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
568 "${GETTEXT}\gettext32\libiconv-2.dll" \
569 "$0\GvimExt32\libiconv-2.dll" "$0\GvimExt32"
570 !if /FileExists "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll"
571 # Install libgcc_s_sjlj-1.dll only if it is needed.
572 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
573 "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll" \
574 "$0\GvimExt32\libgcc_s_sjlj-1.dll" "$0\GvimExt32"
575 !endif
576 ${EndIf}
577SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000578!endif
579
580##########################################################
581Section -call_install_exe
582 SetOutPath $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100583 DetailPrint "$(str_msg_registering)"
584 nsExec::Exec "$0\install.exe $1"
585 Pop $3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000586SectionEnd
587
588##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100589!macro SaveSectionSelection section_id reg_value
590 ${If} ${SectionIsSelected} ${section_id}
591 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 1
592 ${Else}
593 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 0
594 ${EndIf}
595!macroend
596
Bram Moolenaar071d4272004-06-13 20:20:40 +0000597Section -post
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100598
599 # Get estimated install size
600 SectionGetSize ${id_section_exe} $3
601 ${If} ${SectionIsSelected} ${id_section_console}
602 SectionGetSize ${id_section_console} $4
603 IntOp $3 $3 + $4
604 ${EndIf}
605 ${If} ${SectionIsSelected} ${id_section_editwith}
606 SectionGetSize ${id_section_editwith} $4
607 IntOp $3 $3 + $4
608 ${EndIf}
609!ifdef HAVE_VIS_VIM
610 ${If} ${SectionIsSelected} ${id_section_visvim}
611 SectionGetSize ${id_section_visvim} $4
612 IntOp $3 $3 + $4
613 ${EndIf}
614!endif
615!ifdef HAVE_NLS
616 ${If} ${SectionIsSelected} ${id_section_nls}
617 SectionGetSize ${id_section_nls} $4
618 IntOp $3 $3 + $4
619 ${EndIf}
620!endif
621
622 # Register EstimatedSize and AllowSilent.
623 # Other information will be set by the install.exe (dosinst.c).
624 ${If} ${RunningX64}
625 SetRegView 64
626 ${EndIf}
627 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "EstimatedSize" $3
628 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "AllowSilent" 1
629 ${If} ${RunningX64}
630 SetRegView lastused
631 ${EndIf}
632
633 # Store the selections to the registry.
634 ${If} ${RunningX64}
635 SetRegView 64
636 ${EndIf}
637 !insertmacro SaveSectionSelection ${id_section_console} "select_console"
638 !insertmacro SaveSectionSelection ${id_section_batch} "select_batch"
639 !insertmacro SaveSectionSelection ${id_section_desktop} "select_desktop"
640 !insertmacro SaveSectionSelection ${id_section_startmenu} "select_startmenu"
641 !insertmacro SaveSectionSelection ${id_section_editwith} "select_editwith"
642 !insertmacro SaveSectionSelection ${id_section_vimrc} "select_vimrc"
643 !insertmacro SaveSectionSelection ${id_section_pluginhome} "select_pluginhome"
644 !insertmacro SaveSectionSelection ${id_section_pluginvim} "select_pluginvim"
645!ifdef HAVE_VIS_VIM
646 !insertmacro SaveSectionSelection ${id_section_visvim} "select_visvim"
647!endif
648!ifdef HAVE_NLS
649 !insertmacro SaveSectionSelection ${id_section_nls} "select_nls"
650!endif
651 ${If} ${RunningX64}
652 SetRegView lastused
653 ${EndIf}
654
Bram Moolenaar071d4272004-06-13 20:20:40 +0000655 BringToFront
656SectionEnd
657
658##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100659!macro LoadSectionSelection section_id reg_value
660 ClearErrors
661 ReadRegDWORD $3 HKLM "${UNINST_REG_KEY_VIM}" ${reg_value}
662 ${IfNot} ${Errors}
663 ${If} $3 = 1
664 !insertmacro SelectSection ${section_id}
665 ${Else}
666 !insertmacro UnselectSection ${section_id}
667 ${EndIf}
668 ${EndIf}
669!macroend
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200670
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100671Function .onInit
672!ifdef HAVE_MULTI_LANG
673 # Select a language (or read from the registry).
674 !insertmacro MUI_LANGDLL_DISPLAY
675!endif
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200676
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100677 # Check $VIM
678 ReadEnvStr $INSTDIR "VIM"
679
680 call CheckOldVim
681 Pop $3
682 ${If} $3 == ""
683 # No old versions of Vim found. Unselect and hide the section.
684 !insertmacro UnselectSection ${id_section_old_ver}
685 SectionSetInstTypes ${id_section_old_ver} 0
686 SectionSetText ${id_section_old_ver} ""
687 ${Else}
688 ${If} $INSTDIR == ""
689 StrCpy $INSTDIR $3
690 ${EndIf}
691 ${EndIf}
692
693 # If did not find a path: use the default dir.
694 ${If} $INSTDIR == ""
695!ifdef WIN64
696 StrCpy $INSTDIR "$PROGRAMFILES64\Vim"
697!else
698 StrCpy $INSTDIR "$PROGRAMFILES\Vim"
699!endif
700 ${EndIf}
701
702# Load the selections from the registry (if any).
703 ${If} ${RunningX64}
704 SetRegView 64
705 ${EndIf}
706 !insertmacro LoadSectionSelection ${id_section_console} "select_console"
707 !insertmacro LoadSectionSelection ${id_section_batch} "select_batch"
708 !insertmacro LoadSectionSelection ${id_section_desktop} "select_desktop"
709 !insertmacro LoadSectionSelection ${id_section_startmenu} "select_startmenu"
710 !insertmacro LoadSectionSelection ${id_section_editwith} "select_editwith"
711 !insertmacro LoadSectionSelection ${id_section_vimrc} "select_vimrc"
712 !insertmacro LoadSectionSelection ${id_section_pluginhome} "select_pluginhome"
713 !insertmacro LoadSectionSelection ${id_section_pluginvim} "select_pluginvim"
714!ifdef HAVE_VIS_VIM
715 !insertmacro LoadSectionSelection ${id_section_visvim} "select_visvim"
716!endif
717!ifdef HAVE_NLS
718 !insertmacro LoadSectionSelection ${id_section_nls} "select_nls"
719!endif
720 ${If} ${RunningX64}
721 SetRegView lastused
722 ${EndIf}
723
724 # User variables:
725 # $0 - holds the directory the executables are installed to
726 # $1 - holds the parameters to be passed to install.exe. Starts with OLE
727 # registration (since a non-OLE gvim will not complain, and we want to
728 # always register an OLE gvim).
729 # $2 - holds the names to create batch files for
730 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
731 StrCpy $1 "-register-OLE"
732 StrCpy $2 "gvim evim gview gvimdiff vimtutor"
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200733FunctionEnd
734
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100735Function .onInstSuccess
736 WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe
737FunctionEnd
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200738
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100739Function .onInstFailed
740 MessageBox MB_OK|MB_ICONEXCLAMATION "$(str_msg_install_fail)" /SD IDOK
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200741FunctionEnd
742
743##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100744Function SetCustom
745 # Display the _vimrc setting dialog using nsDialogs.
746
747 # Check if a _vimrc should be created
748 ${IfNot} ${SectionIsSelected} ${id_section_vimrc}
749 Abort
750 ${EndIf}
751
752 !insertmacro MUI_HEADER_TEXT \
753 $(str_vimrc_page_title) $(str_vimrc_page_subtitle)
754
755 nsDialogs::Create 1018
756 Pop $vim_dialog
757
758 ${If} $vim_dialog == error
759 Abort
760 ${EndIf}
761
762 ${If} ${RunningX64}
763 SetRegView 64
764 ${EndIf}
765
766 GetFunctionAddress $3 ValidateCustom
767 nsDialogs::OnBack $3
768
769
770 # 1st group - Compatibility
771 ${NSD_CreateGroupBox} 0 0 100% 32% $(str_msg_compat_title)
772 Pop $3
773
774 ${NSD_CreateLabel} 5% 10% 35% 8% $(str_msg_compat_desc)
775 Pop $3
776 ${NSD_CreateDropList} 18% 19% 75% 8% ""
777 Pop $vim_nsd_compat
778 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vi)
779 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vim)
780 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_defaults)
781 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_all)
782
783 # Default selection
784 ${If} $vim_compat_stat == ""
785 ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_compat"
786 ${Else}
787 StrCpy $3 $vim_compat_stat
788 ${EndIf}
789 ${If} $3 == "defaults"
790 StrCpy $4 2
791 ${ElseIf} $3 == "vim"
792 StrCpy $4 1
793 ${ElseIf} $3 == "vi"
794 StrCpy $4 0
795 ${Else} # default
796 StrCpy $4 3
797 ${EndIf}
798 ${NSD_CB_SetSelectionIndex} $vim_nsd_compat $4
799
800
801 # 2nd group - Key remapping
802 ${NSD_CreateGroupBox} 0 35% 100% 31% $(str_msg_keymap_title)
803 Pop $3
804
805 ${NSD_CreateLabel} 5% 45% 90% 8% $(str_msg_keymap_desc)
806 Pop $3
807 ${NSD_CreateDropList} 38% 54% 55% 8% ""
808 Pop $vim_nsd_keymap
809 ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_default)
810 ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_windows)
811
812 # Default selection
813 ${If} $vim_keymap_stat == ""
814 ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_keyremap"
815 ${Else}
816 StrCpy $3 $vim_keymap_stat
817 ${EndIf}
818 ${If} $3 == "windows"
819 StrCpy $4 1
820 ${Else} # default
821 StrCpy $4 0
822 ${EndIf}
823 ${NSD_CB_SetSelectionIndex} $vim_nsd_keymap $4
824
825
826 # 3rd group - Mouse behavior
827 ${NSD_CreateGroupBox} 0 69% 100% 31% $(str_msg_mouse_title)
828 Pop $3
829
830 ${NSD_CreateLabel} 5% 79% 90% 8% $(str_msg_mouse_desc)
831 Pop $3
832 ${NSD_CreateDropList} 23% 87% 70% 8% ""
833 Pop $vim_nsd_mouse
834 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_default)
835 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_windows)
836 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_unix)
837
838 # Default selection
839 ${If} $vim_mouse_stat == ""
840 ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_mouse"
841 ${Else}
842 StrCpy $3 $vim_mouse_stat
843 ${EndIf}
844 ${If} $3 == "xterm"
845 StrCpy $4 2
846 ${ElseIf} $3 == "windows"
847 StrCpy $4 1
848 ${Else} # default
849 StrCpy $4 0
850 ${EndIf}
851 ${NSD_CB_SetSelectionIndex} $vim_nsd_mouse $4
852
853 ${If} ${RunningX64}
854 SetRegView lastused
855 ${EndIf}
856
857 nsDialogs::Show
858FunctionEnd
859
860Function ValidateCustom
861 ${NSD_CB_GetSelectionIndex} $vim_nsd_compat $3
862 ${If} $3 = 0
863 StrCpy $vim_compat_stat "vi"
864 ${ElseIf} $3 = 1
865 StrCpy $vim_compat_stat "vim"
866 ${ElseIf} $3 = 2
867 StrCpy $vim_compat_stat "defaults"
868 ${Else}
869 StrCpy $vim_compat_stat "all"
870 ${EndIf}
871
872 ${NSD_CB_GetSelectionIndex} $vim_nsd_keymap $3
873 ${If} $3 = 0
874 StrCpy $vim_keymap_stat "default"
875 ${Else}
876 StrCpy $vim_keymap_stat "windows"
877 ${EndIf}
878
879 ${NSD_CB_GetSelectionIndex} $vim_nsd_mouse $3
880 ${If} $3 = 0
881 StrCpy $vim_mouse_stat "default"
882 ${ElseIf} $3 = 1
883 StrCpy $vim_mouse_stat "windows"
884 ${Else}
885 StrCpy $vim_mouse_stat "xterm"
886 ${EndIf}
887FunctionEnd
888
889##########################################################
890# Description for Installer Sections
891
892!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
893 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_old_ver} $(str_desc_old_ver)
894 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_exe} $(str_desc_exe)
895 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_console} $(str_desc_console)
896 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_batch} $(str_desc_batch)
897 !insertmacro MUI_DESCRIPTION_TEXT ${id_group_icons} $(str_desc_icons)
898 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_desktop} $(str_desc_desktop)
899 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_startmenu} $(str_desc_start_menu)
900 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_editwith} $(str_desc_edit_with)
901 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_vimrc} $(str_desc_vim_rc)
902 !insertmacro MUI_DESCRIPTION_TEXT ${id_group_plugin} $(str_desc_plugin)
903 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginhome} $(str_desc_plugin_home)
904 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginvim} $(str_desc_plugin_vim)
905!ifdef HAVE_VIS_VIM
906 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_visvim} $(str_desc_vis_vim)
907!endif
908!ifdef HAVE_NLS
909 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_nls} $(str_desc_nls)
910!endif
911!insertmacro MUI_FUNCTION_DESCRIPTION_END
912
913
914##########################################################
915# Uninstaller Functions and Sections
916
917Function un.onInit
918!ifdef HAVE_MULTI_LANG
919 # Get the language from the registry.
920 !insertmacro MUI_UNGETLANGUAGE
921!endif
922FunctionEnd
923
924Section "un.$(str_unsection_register)" id_unsection_register
925 SectionIn RO
926
Bram Moolenaar071d4272004-06-13 20:20:40 +0000927 # Apparently $INSTDIR is set to the directory where the uninstaller is
928 # created. Thus the "vim61" directory is included in it.
929 StrCpy $0 "$INSTDIR"
930
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100931!ifdef HAVE_VIS_VIM
Bram Moolenaar071d4272004-06-13 20:20:40 +0000932 # If VisVim was installed, unregister the DLL.
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100933 ${If} ${FileExists} "$0\VisVim.dll"
934 ExecWait "regsvr32.exe /u /s $0\VisVim.dll"
935 ${EndIf}
936!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000937
938 # delete the context menu entry and batch files
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100939 DetailPrint "$(str_msg_unregistering)"
940 nsExec::Exec "$0\uninstal.exe -nsis"
941 Pop $3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000942
943 # We may have been put to the background when uninstall did something.
944 BringToFront
945
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100946 # Delete the installer language setting.
947 DeleteRegKey ${MUI_LANGDLL_REGISTRY_ROOT} ${MUI_LANGDLL_REGISTRY_KEY}
948SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000949
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100950Section "un.$(str_unsection_exe)" id_unsection_exe
951
952 StrCpy $0 "$INSTDIR"
953
954 # Delete gettext and iconv DLLs
955 ${If} ${FileExists} "$0\libiconv-2.dll"
956 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
957 "$0\libiconv-2.dll"
Bram Moolenaar6199d432017-10-14 19:05:44 +0200958 ${EndIf}
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100959 ${If} ${FileExists} "$0\libintl-8.dll"
960 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
961 "$0\libintl-8.dll"
962 ${EndIf}
963 ${If} ${FileExists} "$0\libgcc_s_sjlj-1.dll"
964 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
965 "$0\libgcc_s_sjlj-1.dll"
966 ${EndIf}
967
968 # Delete other DLLs
969 Delete /REBOOTOK $0\*.dll
970
971 # Delete 64-bit GvimExt
972 ${If} ${RunningX64}
973 !define LIBRARY_X64
974 ${If} ${FileExists} "$0\GvimExt64\gvimext.dll"
975 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
976 "$0\GvimExt64\gvimext.dll"
977 ${EndIf}
978 ${If} ${FileExists} "$0\GvimExt64\libiconv-2.dll"
979 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
980 "$0\GvimExt64\libiconv-2.dll"
981 ${EndIf}
982 ${If} ${FileExists} "$0\GvimExt64\libintl-8.dll"
983 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
984 "$0\GvimExt64\libintl-8.dll"
985 ${EndIf}
986 ${If} ${FileExists} "$0\GvimExt64\libwinpthread-1.dll"
987 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
988 "$0\GvimExt64\libwinpthread-1.dll"
989 ${EndIf}
990 !undef LIBRARY_X64
991 RMDir /r $0\GvimExt64
992 ${EndIf}
993
994 # Delete 32-bit GvimExt
995 ${If} ${FileExists} "$0\GvimExt32\gvimext.dll"
996 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
997 "$0\GvimExt32\gvimext.dll"
998 ${EndIf}
999 ${If} ${FileExists} "$0\GvimExt32\libiconv-2.dll"
1000 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1001 "$0\GvimExt32\libiconv-2.dll"
1002 ${EndIf}
1003 ${If} ${FileExists} "$0\GvimExt32\libintl-8.dll"
1004 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1005 "$0\GvimExt32\libintl-8.dll"
1006 ${EndIf}
1007 ${If} ${FileExists} "$0\GvimExt32\libgcc_s_sjlj-1.dll"
1008 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1009 "$0\GvimExt32\libgcc_s_sjlj-1.dll"
1010 ${EndIf}
1011 RMDir /r $0\GvimExt32
Bram Moolenaar6199d432017-10-14 19:05:44 +02001012
Bram Moolenaar071d4272004-06-13 20:20:40 +00001013 ClearErrors
1014 # Remove everything but *.dll files. Avoids that
1015 # a lot remains when gvimext.dll cannot be deleted.
Bram Moolenaar408b5852006-05-13 10:44:07 +00001016 RMDir /r $0\autoload
Bram Moolenaar071d4272004-06-13 20:20:40 +00001017 RMDir /r $0\colors
1018 RMDir /r $0\compiler
1019 RMDir /r $0\doc
1020 RMDir /r $0\ftplugin
1021 RMDir /r $0\indent
1022 RMDir /r $0\macros
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001023 RMDir /r $0\pack
Bram Moolenaar071d4272004-06-13 20:20:40 +00001024 RMDir /r $0\plugin
Bram Moolenaar408b5852006-05-13 10:44:07 +00001025 RMDir /r $0\spell
Bram Moolenaar071d4272004-06-13 20:20:40 +00001026 RMDir /r $0\syntax
1027 RMDir /r $0\tools
1028 RMDir /r $0\tutor
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001029!ifdef HAVE_VIS_VIM
Bram Moolenaar071d4272004-06-13 20:20:40 +00001030 RMDir /r $0\VisVim
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001031!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001032 RMDir /r $0\lang
1033 RMDir /r $0\keymap
1034 Delete $0\*.exe
1035 Delete $0\*.bat
1036 Delete $0\*.vim
1037 Delete $0\*.txt
1038
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001039 ${If} ${Errors}
1040 MessageBox MB_OK|MB_ICONEXCLAMATION $(str_msg_rm_exe_fail) /SD IDOK
1041 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +00001042
1043 # No error message if the "vim62" directory can't be removed, the
1044 # gvimext.dll may still be there.
1045 RMDir $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001046SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +00001047
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001048# Remove "vimfiles" directory under the specified directory.
1049!macro RemoveVimfiles dir
1050 ${If} ${FileExists} ${dir}\vimfiles
1051 RMDir ${dir}\vimfiles\colors
1052 RMDir ${dir}\vimfiles\compiler
1053 RMDir ${dir}\vimfiles\doc
1054 RMDir ${dir}\vimfiles\ftdetect
1055 RMDir ${dir}\vimfiles\ftplugin
1056 RMDir ${dir}\vimfiles\indent
1057 RMDir ${dir}\vimfiles\keymap
1058 RMDir ${dir}\vimfiles\plugin
1059 RMDir ${dir}\vimfiles\syntax
1060 RMDir ${dir}\vimfiles
1061 ${EndIf}
1062!macroend
1063
1064SectionGroup "un.$(str_ungroup_plugin)" id_ungroup_plugin
1065 Section /o "un.$(str_unsection_plugin_home)" id_unsection_plugin_home
1066 # get the home dir
1067 ReadEnvStr $0 "HOME"
1068 ${If} $0 == ""
1069 ReadEnvStr $0 "HOMEDRIVE"
1070 ReadEnvStr $1 "HOMEPATH"
1071 StrCpy $0 "$0$1"
1072 ${If} $0 == ""
1073 ReadEnvStr $0 "USERPROFILE"
1074 ${EndIf}
1075 ${EndIf}
1076
1077 ${If} $0 != ""
1078 !insertmacro RemoveVimfiles $0
1079 ${EndIf}
1080 SectionEnd
1081
1082 Section "un.$(str_unsection_plugin_vim)" id_unsection_plugin_vim
1083 # get the parent dir of the installation
1084 Push $INSTDIR
1085 Call un.GetParent
1086 Pop $0
1087
1088 # if a plugin dir was created at installation remove it
1089 !insertmacro RemoveVimfiles $0
1090 SectionEnd
1091SectionGroupEnd
1092
1093Section "un.$(str_unsection_rootdir)" id_unsection_rootdir
Bram Moolenaar071d4272004-06-13 20:20:40 +00001094 # get the parent dir of the installation
1095 Push $INSTDIR
1096 Call un.GetParent
1097 Pop $0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001098
Bram Moolenaara8d22e32019-04-12 21:29:33 +02001099 ${IfNot} ${Silent}
1100 Delete $0\_vimrc
1101 ${Endif}
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001102 RMDir $0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001103SectionEnd
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001104
1105##########################################################
1106# Description for Uninstaller Sections
1107
1108!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
1109 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_register} $(str_desc_unregister)
1110 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_exe} $(str_desc_rm_exe)
1111 !insertmacro MUI_DESCRIPTION_TEXT ${id_ungroup_plugin} $(str_desc_rm_plugin)
1112 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_home} $(str_desc_rm_plugin_home)
1113 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_vim} $(str_desc_rm_plugin_vim)
1114 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_rootdir} $(str_desc_rm_rootdir)
1115!insertmacro MUI_UNFUNCTION_DESCRIPTION_END