blob: cb2664c093a39de1e82e35f54e51bd934c546330 [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
Bram Moolenaardabfde02019-05-17 12:37:27 +0200176##########################################################
177# Version resources
178
179VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Vim"
180VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Vim Developers"
181VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Vim"
182VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright (C) 1996"
183VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Vi Improved - A Text Editor"
184VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VER_MAJOR}.${VER_MINOR}.0.0"
185VIProductVersion "${VER_MAJOR}.${VER_MINOR}.0.0"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100186
187# Global variables
188Var vim_dialog
189Var vim_nsd_compat
190Var vim_nsd_keymap
191Var vim_nsd_mouse
192Var vim_compat_stat
193Var vim_keymap_stat
194Var vim_mouse_stat
195
Bram Moolenaar071d4272004-06-13 20:20:40 +0000196
Bram Moolenaar5d424742018-02-04 19:11:30 +0100197# Reserve files
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100198ReserveFile ${VIMSRC}\installw32.exe
Bram Moolenaar5d424742018-02-04 19:11:30 +0100199
Bram Moolenaar071d4272004-06-13 20:20:40 +0000200##########################################################
201# Functions
202
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100203# Get parent directory
204# Share this function both on installer and uninstaller
205!macro GetParent un
206Function ${un}GetParent
Bram Moolenaar071d4272004-06-13 20:20:40 +0000207 Exch $0 ; old $0 is on top of stack
208 Push $1
209 Push $2
210 StrCpy $1 -1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100211 ${Do}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000212 StrCpy $2 $0 1 $1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100213 ${If} $2 == ""
214 ${OrIf} $2 == "\"
215 ${ExitDo}
216 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000217 IntOp $1 $1 - 1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100218 ${Loop}
219 StrCpy $0 $0 $1
220 Pop $2
221 Pop $1
222 Exch $0 ; put $0 on top of stack, restore $0 to original value
223FunctionEnd
224!macroend
225
226!insertmacro GetParent ""
227!insertmacro GetParent "un."
228
229# Check if Vim is already installed.
230# return: Installed directory. If not found, it will be empty.
231Function CheckOldVim
232 Push $0
233 Push $R0
234 Push $R1
235 Push $R2
236
237 ${If} ${RunningX64}
238 SetRegView 64
239 ${EndIf}
240
241 ClearErrors
242 StrCpy $0 "" # Installed directory
243 StrCpy $R0 0 # Sub-key index
244 StrCpy $R1 "" # Sub-key
245 ${Do}
246 # Eumerate the sub-key:
247 EnumRegKey $R1 HKLM ${UNINST_REG_KEY} $R0
248
249 # Stop if no more sub-key:
250 ${If} ${Errors}
251 ${OrIf} $R1 == ""
252 ${ExitDo}
253 ${EndIf}
254
255 # Move to the next sub-key:
256 IntOp $R0 $R0 + 1
257
258 # Check if the key is Vim uninstall key or not:
259 StrCpy $R2 $R1 4
260 ${If} $R2 S!= "Vim "
261 ${Continue}
262 ${EndIf}
263
264 # Verifies required sub-keys:
265 ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "DisplayName"
266 ${If} ${Errors}
267 ${OrIf} $R2 == ""
268 ${Continue}
269 ${EndIf}
270
271 ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "UninstallString"
272 ${If} ${Errors}
273 ${OrIf} $R2 == ""
274 ${Continue}
275 ${EndIf}
276
277 # Found
278 Push $R2
279 call GetParent
280 call GetParent
281 Pop $0 # Vim directory
282 ${ExitDo}
283
284 ${Loop}
285
286 ${If} ${RunningX64}
287 SetRegView lastused
288 ${EndIf}
289
290 Pop $R2
291 Pop $R1
292 Pop $R0
293 Exch $0 # put $0 on top of stack, restore $0 to original value
Bram Moolenaar071d4272004-06-13 20:20:40 +0000294FunctionEnd
295
296##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100297Section "$(str_section_old_ver)" id_section_old_ver
298 SectionIn 1 2 3 RO
299
300 # run the install program to check for already installed versions
301 SetOutPath $TEMP
302 File /oname=install.exe ${VIMSRC}\installw32.exe
303 DetailPrint "$(str_msg_uninstalling)"
304 ${Do}
305 nsExec::Exec "$TEMP\install.exe -uninstall-check"
306 Pop $3
307
308 call CheckOldVim
309 Pop $3
310 ${If} $3 == ""
311 ${ExitDo}
312 ${Else}
313 # It seems that the old version is still remaining.
314 # TODO: Should we show a warning and run the uninstaller again?
315
316 ${ExitDo} # Just ignore for now.
317 ${EndIf}
318 ${Loop}
319 Delete $TEMP\install.exe
320 Delete $TEMP\vimini.ini # install.exe creates this, but we don't need it.
321
322 # We may have been put to the background when uninstall did something.
323 BringToFront
324SectionEnd
325
326##########################################################
327Section "$(str_section_exe)" id_section_exe
Bram Moolenaar49150a42017-09-17 21:00:03 +0200328 SectionIn 1 2 3 RO
Bram Moolenaar071d4272004-06-13 20:20:40 +0000329
330 # we need also this here if the user changes the instdir
331 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
332
333 SetOutPath $0
334 File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe
Bram Moolenaarafde13b2019-04-28 19:46:49 +0200335!if /FileExists "${VIMSRC}\vim${BIT}.dll"
336 File ${VIMSRC}\vim${BIT}.dll
337!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000338 File /oname=install.exe ${VIMSRC}\installw32.exe
339 File /oname=uninstal.exe ${VIMSRC}\uninstalw32.exe
340 File ${VIMSRC}\vimrun.exe
Bram Moolenaarfec246d2016-08-28 18:47:14 +0200341 File /oname=tee.exe ${VIMSRC}\teew32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000342 File /oname=xxd.exe ${VIMSRC}\xxdw32.exe
Bram Moolenaar19166732018-12-21 17:59:33 +0100343 File ..\vimtutor.bat
344 File ..\README.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000345 File ..\uninstal.txt
346 File ${VIMRT}\*.vim
347 File ${VIMRT}\rgb.txt
348
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200349 File ${VIMTOOLS}\diff.exe
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100350 File ${VIMTOOLS}\winpty${BIT}.dll
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200351 File ${VIMTOOLS}\winpty-agent.exe
352
Bram Moolenaar071d4272004-06-13 20:20:40 +0000353 SetOutPath $0\colors
354 File ${VIMRT}\colors\*.*
355
356 SetOutPath $0\compiler
357 File ${VIMRT}\compiler\*.*
358
359 SetOutPath $0\doc
360 File ${VIMRT}\doc\*.txt
361 File ${VIMRT}\doc\tags
362
363 SetOutPath $0\ftplugin
364 File ${VIMRT}\ftplugin\*.*
365
366 SetOutPath $0\indent
367 File ${VIMRT}\indent\*.*
368
369 SetOutPath $0\macros
Bram Moolenaar6a95c882019-03-26 23:02:46 +0100370 File /r ${VIMRT}\macros\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000371
Bram Moolenaar6a95c882019-03-26 23:02:46 +0100372 SetOutPath $0\pack
373 File /r ${VIMRT}\pack\*.*
Bram Moolenaar38623c82018-05-10 21:24:35 +0200374
Bram Moolenaar071d4272004-06-13 20:20:40 +0000375 SetOutPath $0\plugin
376 File ${VIMRT}\plugin\*.*
377
Bram Moolenaar7fcab2a2006-03-25 21:46:12 +0000378 SetOutPath $0\autoload
379 File ${VIMRT}\autoload\*.*
380
Bram Moolenaard09a2062017-11-11 15:37:45 +0100381 SetOutPath $0\autoload\dist
382 File ${VIMRT}\autoload\dist\*.*
383
Bram Moolenaar18144c82006-04-12 21:52:12 +0000384 SetOutPath $0\autoload\xml
385 File ${VIMRT}\autoload\xml\*.*
386
Bram Moolenaar071d4272004-06-13 20:20:40 +0000387 SetOutPath $0\syntax
388 File ${VIMRT}\syntax\*.*
389
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000390 SetOutPath $0\spell
391 File ${VIMRT}\spell\*.txt
392 File ${VIMRT}\spell\*.vim
393 File ${VIMRT}\spell\*.spl
394 File ${VIMRT}\spell\*.sug
395
Bram Moolenaar071d4272004-06-13 20:20:40 +0000396 SetOutPath $0\tools
397 File ${VIMRT}\tools\*.*
398
399 SetOutPath $0\tutor
400 File ${VIMRT}\tutor\*.*
401SectionEnd
402
403##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100404Section "$(str_section_console)" id_section_console
Bram Moolenaar071d4272004-06-13 20:20:40 +0000405 SectionIn 1 3
406
407 SetOutPath $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100408 File /oname=vim.exe ${VIMSRC}\vimw32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000409 StrCpy $2 "$2 vim view vimdiff"
410SectionEnd
411
412##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100413Section "$(str_section_batch)" id_section_batch
Bram Moolenaar071d4272004-06-13 20:20:40 +0000414 SectionIn 3
415
416 StrCpy $1 "$1 -create-batfiles $2"
417SectionEnd
418
419##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100420SectionGroup $(str_group_icons) id_group_icons
421 Section "$(str_section_desktop)" id_section_desktop
422 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000423
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100424 StrCpy $1 "$1 -install-icons"
425 SectionEnd
426
427 Section "$(str_section_start_menu)" id_section_startmenu
428 SectionIn 1 3
429
430 StrCpy $1 "$1 -add-start-menu"
431 SectionEnd
432SectionGroupEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000433
434##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100435Section "$(str_section_edit_with)" id_section_editwith
Bram Moolenaar071d4272004-06-13 20:20:40 +0000436 SectionIn 1 3
437
Bram Moolenaar071d4272004-06-13 20:20:40 +0000438 SetOutPath $0
Bram Moolenaar6199d432017-10-14 19:05:44 +0200439
Bram Moolenaar442b4222010-05-24 21:34:22 +0200440 ${If} ${RunningX64}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200441 # Install 64-bit gvimext.dll into the GvimExt64 directory.
442 SetOutPath $0\GvimExt64
443 ClearErrors
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100444 !define LIBRARY_SHELL_EXTENSION
445 !define LIBRARY_X64
446 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
447 "${VIMSRC}\GvimExt\gvimext64.dll" \
448 "$0\GvimExt64\gvimext.dll" "$0"
449 !undef LIBRARY_X64
450 !undef LIBRARY_SHELL_EXTENSION
Bram Moolenaar442b4222010-05-24 21:34:22 +0200451 ${EndIf}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200452
Bram Moolenaar6199d432017-10-14 19:05:44 +0200453 # Install 32-bit gvimext.dll into the GvimExt32 directory.
454 SetOutPath $0\GvimExt32
455 ClearErrors
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100456 !define LIBRARY_SHELL_EXTENSION
457 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
458 "${VIMSRC}\GvimExt\gvimext.dll" \
459 "$0\GvimExt32\gvimext.dll" "$0"
460 !undef LIBRARY_SHELL_EXTENSION
Bram Moolenaar071d4272004-06-13 20:20:40 +0000461
462 # We don't have a separate entry for the "Open With..." menu, assume
463 # the user wants either both or none.
464 StrCpy $1 "$1 -install-popup -install-openwith"
465SectionEnd
466
467##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100468Section "$(str_section_vim_rc)" id_section_vimrc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000469 SectionIn 1 3
470
471 StrCpy $1 "$1 -create-vimrc"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100472
473 ${If} ${RunningX64}
474 SetRegView 64
475 ${EndIf}
476 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_compat" "$vim_compat_stat"
477 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_keyremap" "$vim_keymap_stat"
478 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_mouse" "$vim_mouse_stat"
479 ${If} ${RunningX64}
480 SetRegView lastused
481 ${EndIf}
482
483 ${If} $vim_compat_stat == "vi"
484 StrCpy $1 "$1 -vimrc-compat vi"
485 ${ElseIf} $vim_compat_stat == "vim"
486 StrCpy $1 "$1 -vimrc-compat vim"
487 ${ElseIf} $vim_compat_stat == "defaults"
488 StrCpy $1 "$1 -vimrc-compat defaults"
489 ${Else}
490 StrCpy $1 "$1 -vimrc-compat all"
491 ${EndIf}
492
493 ${If} $vim_keymap_stat == "default"
494 StrCpy $1 "$1 -vimrc-remap no"
495 ${Else}
496 StrCpy $1 "$1 -vimrc-remap win"
497 ${EndIf}
498
499 ${If} $vim_mouse_stat == "default"
500 StrCpy $1 "$1 -vimrc-behave default"
501 ${ElseIf} $vim_mouse_stat == "windows"
502 StrCpy $1 "$1 -vimrc-behave mswin"
503 ${Else}
504 StrCpy $1 "$1 -vimrc-behave unix"
505 ${EndIf}
506
Bram Moolenaar071d4272004-06-13 20:20:40 +0000507SectionEnd
508
509##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100510SectionGroup $(str_group_plugin) id_group_plugin
511 Section "$(str_section_plugin_home)" id_section_pluginhome
512 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000513
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100514 StrCpy $1 "$1 -create-directories home"
515 SectionEnd
516
517 Section "$(str_section_plugin_vim)" id_section_pluginvim
518 SectionIn 3
519
520 StrCpy $1 "$1 -create-directories vim"
521 SectionEnd
522SectionGroupEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000523
524##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100525!ifdef HAVE_VIS_VIM
526Section "$(str_section_vis_vim)" id_section_visvim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000527 SectionIn 3
528
529 SetOutPath $0
530 !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0"
531 File ${VIMSRC}\VisVim\README_VisVim.txt
532SectionEnd
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100533!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000534
535##########################################################
536!ifdef HAVE_NLS
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100537Section "$(str_section_nls)" id_section_nls
538 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000539
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100540 SetOutPath $0\lang
541 File /r ${VIMRT}\lang\*.*
542 SetOutPath $0\keymap
543 File ${VIMRT}\keymap\README.txt
544 File ${VIMRT}\keymap\*.vim
545 SetOutPath $0
546 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
547 "${GETTEXT}\gettext${BIT}\libintl-8.dll" \
548 "$0\libintl-8.dll" "$0"
549 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
550 "${GETTEXT}\gettext${BIT}\libiconv-2.dll" \
551 "$0\libiconv-2.dll" "$0"
552 !if /FileExists "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll"
553 # Install libgcc_s_sjlj-1.dll only if it is needed.
554 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
555 "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll" \
556 "$0\libgcc_s_sjlj-1.dll" "$0"
557 !endif
558
559 ${If} ${SectionIsSelected} ${id_section_editwith}
560 ${If} ${RunningX64}
561 # Install DLLs for 64-bit gvimext.dll into the GvimExt64 directory.
562 SetOutPath $0\GvimExt64
563 ClearErrors
564 !define LIBRARY_X64
565 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
566 "${GETTEXT}\gettext64\libintl-8.dll" \
567 "$0\GvimExt64\libintl-8.dll" "$0\GvimExt64"
568 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
569 "${GETTEXT}\gettext64\libiconv-2.dll" \
570 "$0\GvimExt64\libiconv-2.dll" "$0\GvimExt64"
571 !undef LIBRARY_X64
572 ${EndIf}
573
574 # Install DLLs for 32-bit gvimext.dll into the GvimExt32 directory.
575 SetOutPath $0\GvimExt32
576 ClearErrors
577 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
578 "${GETTEXT}\gettext32\libintl-8.dll" \
579 "$0\GvimExt32\libintl-8.dll" "$0\GvimExt32"
580 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
581 "${GETTEXT}\gettext32\libiconv-2.dll" \
582 "$0\GvimExt32\libiconv-2.dll" "$0\GvimExt32"
583 !if /FileExists "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll"
584 # Install libgcc_s_sjlj-1.dll only if it is needed.
585 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
586 "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll" \
587 "$0\GvimExt32\libgcc_s_sjlj-1.dll" "$0\GvimExt32"
588 !endif
589 ${EndIf}
590SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000591!endif
592
593##########################################################
594Section -call_install_exe
595 SetOutPath $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100596 DetailPrint "$(str_msg_registering)"
597 nsExec::Exec "$0\install.exe $1"
598 Pop $3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000599SectionEnd
600
601##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100602!macro SaveSectionSelection section_id reg_value
603 ${If} ${SectionIsSelected} ${section_id}
604 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 1
605 ${Else}
606 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 0
607 ${EndIf}
608!macroend
609
Bram Moolenaar071d4272004-06-13 20:20:40 +0000610Section -post
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100611
612 # Get estimated install size
613 SectionGetSize ${id_section_exe} $3
614 ${If} ${SectionIsSelected} ${id_section_console}
615 SectionGetSize ${id_section_console} $4
616 IntOp $3 $3 + $4
617 ${EndIf}
618 ${If} ${SectionIsSelected} ${id_section_editwith}
619 SectionGetSize ${id_section_editwith} $4
620 IntOp $3 $3 + $4
621 ${EndIf}
622!ifdef HAVE_VIS_VIM
623 ${If} ${SectionIsSelected} ${id_section_visvim}
624 SectionGetSize ${id_section_visvim} $4
625 IntOp $3 $3 + $4
626 ${EndIf}
627!endif
628!ifdef HAVE_NLS
629 ${If} ${SectionIsSelected} ${id_section_nls}
630 SectionGetSize ${id_section_nls} $4
631 IntOp $3 $3 + $4
632 ${EndIf}
633!endif
634
635 # Register EstimatedSize and AllowSilent.
636 # Other information will be set by the install.exe (dosinst.c).
637 ${If} ${RunningX64}
638 SetRegView 64
639 ${EndIf}
640 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "EstimatedSize" $3
641 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "AllowSilent" 1
642 ${If} ${RunningX64}
643 SetRegView lastused
644 ${EndIf}
645
646 # Store the selections to the registry.
647 ${If} ${RunningX64}
648 SetRegView 64
649 ${EndIf}
650 !insertmacro SaveSectionSelection ${id_section_console} "select_console"
651 !insertmacro SaveSectionSelection ${id_section_batch} "select_batch"
652 !insertmacro SaveSectionSelection ${id_section_desktop} "select_desktop"
653 !insertmacro SaveSectionSelection ${id_section_startmenu} "select_startmenu"
654 !insertmacro SaveSectionSelection ${id_section_editwith} "select_editwith"
655 !insertmacro SaveSectionSelection ${id_section_vimrc} "select_vimrc"
656 !insertmacro SaveSectionSelection ${id_section_pluginhome} "select_pluginhome"
657 !insertmacro SaveSectionSelection ${id_section_pluginvim} "select_pluginvim"
658!ifdef HAVE_VIS_VIM
659 !insertmacro SaveSectionSelection ${id_section_visvim} "select_visvim"
660!endif
661!ifdef HAVE_NLS
662 !insertmacro SaveSectionSelection ${id_section_nls} "select_nls"
663!endif
664 ${If} ${RunningX64}
665 SetRegView lastused
666 ${EndIf}
667
Bram Moolenaar071d4272004-06-13 20:20:40 +0000668 BringToFront
669SectionEnd
670
671##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100672!macro LoadSectionSelection section_id reg_value
673 ClearErrors
674 ReadRegDWORD $3 HKLM "${UNINST_REG_KEY_VIM}" ${reg_value}
675 ${IfNot} ${Errors}
676 ${If} $3 = 1
677 !insertmacro SelectSection ${section_id}
678 ${Else}
679 !insertmacro UnselectSection ${section_id}
680 ${EndIf}
681 ${EndIf}
682!macroend
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200683
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100684Function .onInit
685!ifdef HAVE_MULTI_LANG
686 # Select a language (or read from the registry).
687 !insertmacro MUI_LANGDLL_DISPLAY
688!endif
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200689
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100690 # Check $VIM
691 ReadEnvStr $INSTDIR "VIM"
692
693 call CheckOldVim
694 Pop $3
695 ${If} $3 == ""
696 # No old versions of Vim found. Unselect and hide the section.
697 !insertmacro UnselectSection ${id_section_old_ver}
698 SectionSetInstTypes ${id_section_old_ver} 0
699 SectionSetText ${id_section_old_ver} ""
700 ${Else}
701 ${If} $INSTDIR == ""
702 StrCpy $INSTDIR $3
703 ${EndIf}
704 ${EndIf}
705
706 # If did not find a path: use the default dir.
707 ${If} $INSTDIR == ""
708!ifdef WIN64
709 StrCpy $INSTDIR "$PROGRAMFILES64\Vim"
710!else
711 StrCpy $INSTDIR "$PROGRAMFILES\Vim"
712!endif
713 ${EndIf}
714
715# Load the selections from the registry (if any).
716 ${If} ${RunningX64}
717 SetRegView 64
718 ${EndIf}
719 !insertmacro LoadSectionSelection ${id_section_console} "select_console"
720 !insertmacro LoadSectionSelection ${id_section_batch} "select_batch"
721 !insertmacro LoadSectionSelection ${id_section_desktop} "select_desktop"
722 !insertmacro LoadSectionSelection ${id_section_startmenu} "select_startmenu"
723 !insertmacro LoadSectionSelection ${id_section_editwith} "select_editwith"
724 !insertmacro LoadSectionSelection ${id_section_vimrc} "select_vimrc"
725 !insertmacro LoadSectionSelection ${id_section_pluginhome} "select_pluginhome"
726 !insertmacro LoadSectionSelection ${id_section_pluginvim} "select_pluginvim"
727!ifdef HAVE_VIS_VIM
728 !insertmacro LoadSectionSelection ${id_section_visvim} "select_visvim"
729!endif
730!ifdef HAVE_NLS
731 !insertmacro LoadSectionSelection ${id_section_nls} "select_nls"
732!endif
733 ${If} ${RunningX64}
734 SetRegView lastused
735 ${EndIf}
736
737 # User variables:
738 # $0 - holds the directory the executables are installed to
739 # $1 - holds the parameters to be passed to install.exe. Starts with OLE
740 # registration (since a non-OLE gvim will not complain, and we want to
741 # always register an OLE gvim).
742 # $2 - holds the names to create batch files for
743 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
744 StrCpy $1 "-register-OLE"
745 StrCpy $2 "gvim evim gview gvimdiff vimtutor"
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200746FunctionEnd
747
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100748Function .onInstSuccess
749 WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe
750FunctionEnd
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200751
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100752Function .onInstFailed
753 MessageBox MB_OK|MB_ICONEXCLAMATION "$(str_msg_install_fail)" /SD IDOK
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200754FunctionEnd
755
756##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100757Function SetCustom
758 # Display the _vimrc setting dialog using nsDialogs.
759
760 # Check if a _vimrc should be created
761 ${IfNot} ${SectionIsSelected} ${id_section_vimrc}
762 Abort
763 ${EndIf}
764
765 !insertmacro MUI_HEADER_TEXT \
766 $(str_vimrc_page_title) $(str_vimrc_page_subtitle)
767
768 nsDialogs::Create 1018
769 Pop $vim_dialog
770
771 ${If} $vim_dialog == error
772 Abort
773 ${EndIf}
774
775 ${If} ${RunningX64}
776 SetRegView 64
777 ${EndIf}
778
779 GetFunctionAddress $3 ValidateCustom
780 nsDialogs::OnBack $3
781
782
783 # 1st group - Compatibility
784 ${NSD_CreateGroupBox} 0 0 100% 32% $(str_msg_compat_title)
785 Pop $3
786
787 ${NSD_CreateLabel} 5% 10% 35% 8% $(str_msg_compat_desc)
788 Pop $3
789 ${NSD_CreateDropList} 18% 19% 75% 8% ""
790 Pop $vim_nsd_compat
791 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vi)
792 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vim)
793 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_defaults)
794 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_all)
795
796 # Default selection
797 ${If} $vim_compat_stat == ""
798 ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_compat"
799 ${Else}
800 StrCpy $3 $vim_compat_stat
801 ${EndIf}
802 ${If} $3 == "defaults"
803 StrCpy $4 2
804 ${ElseIf} $3 == "vim"
805 StrCpy $4 1
806 ${ElseIf} $3 == "vi"
807 StrCpy $4 0
808 ${Else} # default
809 StrCpy $4 3
810 ${EndIf}
811 ${NSD_CB_SetSelectionIndex} $vim_nsd_compat $4
812
813
814 # 2nd group - Key remapping
815 ${NSD_CreateGroupBox} 0 35% 100% 31% $(str_msg_keymap_title)
816 Pop $3
817
818 ${NSD_CreateLabel} 5% 45% 90% 8% $(str_msg_keymap_desc)
819 Pop $3
820 ${NSD_CreateDropList} 38% 54% 55% 8% ""
821 Pop $vim_nsd_keymap
822 ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_default)
823 ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_windows)
824
825 # Default selection
826 ${If} $vim_keymap_stat == ""
827 ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_keyremap"
828 ${Else}
829 StrCpy $3 $vim_keymap_stat
830 ${EndIf}
831 ${If} $3 == "windows"
832 StrCpy $4 1
833 ${Else} # default
834 StrCpy $4 0
835 ${EndIf}
836 ${NSD_CB_SetSelectionIndex} $vim_nsd_keymap $4
837
838
839 # 3rd group - Mouse behavior
840 ${NSD_CreateGroupBox} 0 69% 100% 31% $(str_msg_mouse_title)
841 Pop $3
842
843 ${NSD_CreateLabel} 5% 79% 90% 8% $(str_msg_mouse_desc)
844 Pop $3
845 ${NSD_CreateDropList} 23% 87% 70% 8% ""
846 Pop $vim_nsd_mouse
847 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_default)
848 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_windows)
849 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_unix)
850
851 # Default selection
852 ${If} $vim_mouse_stat == ""
853 ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_mouse"
854 ${Else}
855 StrCpy $3 $vim_mouse_stat
856 ${EndIf}
857 ${If} $3 == "xterm"
858 StrCpy $4 2
859 ${ElseIf} $3 == "windows"
860 StrCpy $4 1
861 ${Else} # default
862 StrCpy $4 0
863 ${EndIf}
864 ${NSD_CB_SetSelectionIndex} $vim_nsd_mouse $4
865
866 ${If} ${RunningX64}
867 SetRegView lastused
868 ${EndIf}
869
870 nsDialogs::Show
871FunctionEnd
872
873Function ValidateCustom
874 ${NSD_CB_GetSelectionIndex} $vim_nsd_compat $3
875 ${If} $3 = 0
876 StrCpy $vim_compat_stat "vi"
877 ${ElseIf} $3 = 1
878 StrCpy $vim_compat_stat "vim"
879 ${ElseIf} $3 = 2
880 StrCpy $vim_compat_stat "defaults"
881 ${Else}
882 StrCpy $vim_compat_stat "all"
883 ${EndIf}
884
885 ${NSD_CB_GetSelectionIndex} $vim_nsd_keymap $3
886 ${If} $3 = 0
887 StrCpy $vim_keymap_stat "default"
888 ${Else}
889 StrCpy $vim_keymap_stat "windows"
890 ${EndIf}
891
892 ${NSD_CB_GetSelectionIndex} $vim_nsd_mouse $3
893 ${If} $3 = 0
894 StrCpy $vim_mouse_stat "default"
895 ${ElseIf} $3 = 1
896 StrCpy $vim_mouse_stat "windows"
897 ${Else}
898 StrCpy $vim_mouse_stat "xterm"
899 ${EndIf}
900FunctionEnd
901
902##########################################################
903# Description for Installer Sections
904
905!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
906 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_old_ver} $(str_desc_old_ver)
907 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_exe} $(str_desc_exe)
908 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_console} $(str_desc_console)
909 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_batch} $(str_desc_batch)
910 !insertmacro MUI_DESCRIPTION_TEXT ${id_group_icons} $(str_desc_icons)
911 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_desktop} $(str_desc_desktop)
912 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_startmenu} $(str_desc_start_menu)
913 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_editwith} $(str_desc_edit_with)
914 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_vimrc} $(str_desc_vim_rc)
915 !insertmacro MUI_DESCRIPTION_TEXT ${id_group_plugin} $(str_desc_plugin)
916 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginhome} $(str_desc_plugin_home)
917 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginvim} $(str_desc_plugin_vim)
918!ifdef HAVE_VIS_VIM
919 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_visvim} $(str_desc_vis_vim)
920!endif
921!ifdef HAVE_NLS
922 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_nls} $(str_desc_nls)
923!endif
924!insertmacro MUI_FUNCTION_DESCRIPTION_END
925
926
927##########################################################
928# Uninstaller Functions and Sections
929
930Function un.onInit
931!ifdef HAVE_MULTI_LANG
932 # Get the language from the registry.
933 !insertmacro MUI_UNGETLANGUAGE
934!endif
935FunctionEnd
936
937Section "un.$(str_unsection_register)" id_unsection_register
938 SectionIn RO
939
Bram Moolenaar071d4272004-06-13 20:20:40 +0000940 # Apparently $INSTDIR is set to the directory where the uninstaller is
941 # created. Thus the "vim61" directory is included in it.
942 StrCpy $0 "$INSTDIR"
943
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100944!ifdef HAVE_VIS_VIM
Bram Moolenaar071d4272004-06-13 20:20:40 +0000945 # If VisVim was installed, unregister the DLL.
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100946 ${If} ${FileExists} "$0\VisVim.dll"
947 ExecWait "regsvr32.exe /u /s $0\VisVim.dll"
948 ${EndIf}
949!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000950
951 # delete the context menu entry and batch files
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100952 DetailPrint "$(str_msg_unregistering)"
953 nsExec::Exec "$0\uninstal.exe -nsis"
954 Pop $3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000955
956 # We may have been put to the background when uninstall did something.
957 BringToFront
958
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100959 # Delete the installer language setting.
960 DeleteRegKey ${MUI_LANGDLL_REGISTRY_ROOT} ${MUI_LANGDLL_REGISTRY_KEY}
961SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000962
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100963Section "un.$(str_unsection_exe)" id_unsection_exe
964
965 StrCpy $0 "$INSTDIR"
966
967 # Delete gettext and iconv DLLs
968 ${If} ${FileExists} "$0\libiconv-2.dll"
969 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
970 "$0\libiconv-2.dll"
Bram Moolenaar6199d432017-10-14 19:05:44 +0200971 ${EndIf}
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100972 ${If} ${FileExists} "$0\libintl-8.dll"
973 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
974 "$0\libintl-8.dll"
975 ${EndIf}
976 ${If} ${FileExists} "$0\libgcc_s_sjlj-1.dll"
977 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
978 "$0\libgcc_s_sjlj-1.dll"
979 ${EndIf}
980
981 # Delete other DLLs
982 Delete /REBOOTOK $0\*.dll
983
984 # Delete 64-bit GvimExt
985 ${If} ${RunningX64}
986 !define LIBRARY_X64
987 ${If} ${FileExists} "$0\GvimExt64\gvimext.dll"
988 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
989 "$0\GvimExt64\gvimext.dll"
990 ${EndIf}
991 ${If} ${FileExists} "$0\GvimExt64\libiconv-2.dll"
992 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
993 "$0\GvimExt64\libiconv-2.dll"
994 ${EndIf}
995 ${If} ${FileExists} "$0\GvimExt64\libintl-8.dll"
996 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
997 "$0\GvimExt64\libintl-8.dll"
998 ${EndIf}
999 ${If} ${FileExists} "$0\GvimExt64\libwinpthread-1.dll"
1000 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1001 "$0\GvimExt64\libwinpthread-1.dll"
1002 ${EndIf}
1003 !undef LIBRARY_X64
1004 RMDir /r $0\GvimExt64
1005 ${EndIf}
1006
1007 # Delete 32-bit GvimExt
1008 ${If} ${FileExists} "$0\GvimExt32\gvimext.dll"
1009 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1010 "$0\GvimExt32\gvimext.dll"
1011 ${EndIf}
1012 ${If} ${FileExists} "$0\GvimExt32\libiconv-2.dll"
1013 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1014 "$0\GvimExt32\libiconv-2.dll"
1015 ${EndIf}
1016 ${If} ${FileExists} "$0\GvimExt32\libintl-8.dll"
1017 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1018 "$0\GvimExt32\libintl-8.dll"
1019 ${EndIf}
1020 ${If} ${FileExists} "$0\GvimExt32\libgcc_s_sjlj-1.dll"
1021 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1022 "$0\GvimExt32\libgcc_s_sjlj-1.dll"
1023 ${EndIf}
1024 RMDir /r $0\GvimExt32
Bram Moolenaar6199d432017-10-14 19:05:44 +02001025
Bram Moolenaar071d4272004-06-13 20:20:40 +00001026 ClearErrors
1027 # Remove everything but *.dll files. Avoids that
1028 # a lot remains when gvimext.dll cannot be deleted.
Bram Moolenaar408b5852006-05-13 10:44:07 +00001029 RMDir /r $0\autoload
Bram Moolenaar071d4272004-06-13 20:20:40 +00001030 RMDir /r $0\colors
1031 RMDir /r $0\compiler
1032 RMDir /r $0\doc
1033 RMDir /r $0\ftplugin
1034 RMDir /r $0\indent
1035 RMDir /r $0\macros
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001036 RMDir /r $0\pack
Bram Moolenaar071d4272004-06-13 20:20:40 +00001037 RMDir /r $0\plugin
Bram Moolenaar408b5852006-05-13 10:44:07 +00001038 RMDir /r $0\spell
Bram Moolenaar071d4272004-06-13 20:20:40 +00001039 RMDir /r $0\syntax
1040 RMDir /r $0\tools
1041 RMDir /r $0\tutor
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001042!ifdef HAVE_VIS_VIM
Bram Moolenaar071d4272004-06-13 20:20:40 +00001043 RMDir /r $0\VisVim
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001044!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001045 RMDir /r $0\lang
1046 RMDir /r $0\keymap
1047 Delete $0\*.exe
1048 Delete $0\*.bat
1049 Delete $0\*.vim
1050 Delete $0\*.txt
1051
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001052 ${If} ${Errors}
1053 MessageBox MB_OK|MB_ICONEXCLAMATION $(str_msg_rm_exe_fail) /SD IDOK
1054 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +00001055
1056 # No error message if the "vim62" directory can't be removed, the
1057 # gvimext.dll may still be there.
1058 RMDir $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001059SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +00001060
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001061# Remove "vimfiles" directory under the specified directory.
1062!macro RemoveVimfiles dir
1063 ${If} ${FileExists} ${dir}\vimfiles
1064 RMDir ${dir}\vimfiles\colors
1065 RMDir ${dir}\vimfiles\compiler
1066 RMDir ${dir}\vimfiles\doc
1067 RMDir ${dir}\vimfiles\ftdetect
1068 RMDir ${dir}\vimfiles\ftplugin
1069 RMDir ${dir}\vimfiles\indent
1070 RMDir ${dir}\vimfiles\keymap
1071 RMDir ${dir}\vimfiles\plugin
1072 RMDir ${dir}\vimfiles\syntax
1073 RMDir ${dir}\vimfiles
1074 ${EndIf}
1075!macroend
1076
1077SectionGroup "un.$(str_ungroup_plugin)" id_ungroup_plugin
1078 Section /o "un.$(str_unsection_plugin_home)" id_unsection_plugin_home
1079 # get the home dir
1080 ReadEnvStr $0 "HOME"
1081 ${If} $0 == ""
1082 ReadEnvStr $0 "HOMEDRIVE"
1083 ReadEnvStr $1 "HOMEPATH"
1084 StrCpy $0 "$0$1"
1085 ${If} $0 == ""
1086 ReadEnvStr $0 "USERPROFILE"
1087 ${EndIf}
1088 ${EndIf}
1089
1090 ${If} $0 != ""
1091 !insertmacro RemoveVimfiles $0
1092 ${EndIf}
1093 SectionEnd
1094
1095 Section "un.$(str_unsection_plugin_vim)" id_unsection_plugin_vim
1096 # get the parent dir of the installation
1097 Push $INSTDIR
1098 Call un.GetParent
1099 Pop $0
1100
1101 # if a plugin dir was created at installation remove it
1102 !insertmacro RemoveVimfiles $0
1103 SectionEnd
1104SectionGroupEnd
1105
1106Section "un.$(str_unsection_rootdir)" id_unsection_rootdir
Bram Moolenaar071d4272004-06-13 20:20:40 +00001107 # get the parent dir of the installation
1108 Push $INSTDIR
1109 Call un.GetParent
1110 Pop $0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001111
Bram Moolenaara8d22e32019-04-12 21:29:33 +02001112 ${IfNot} ${Silent}
1113 Delete $0\_vimrc
1114 ${Endif}
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001115 RMDir $0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001116SectionEnd
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001117
1118##########################################################
1119# Description for Uninstaller Sections
1120
1121!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
1122 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_register} $(str_desc_unregister)
1123 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_exe} $(str_desc_rm_exe)
1124 !insertmacro MUI_DESCRIPTION_TEXT ${id_ungroup_plugin} $(str_desc_rm_plugin)
1125 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_home} $(str_desc_rm_plugin_home)
1126 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_vim} $(str_desc_rm_plugin_vim)
1127 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_rootdir} $(str_desc_rm_rootdir)
1128!insertmacro MUI_UNFUNCTION_DESCRIPTION_END