blob: f9b1790b171a3838add2c6f5dbcc7603b47f5f96 [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
Bram Moolenaar3b0ef8c2020-02-12 21:03:32 +010042# Comment the following line to create an English-only installer:
Bram Moolenaaraf610b82018-12-21 16:22:50 +010043!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
Bram Moolenaar9d591522019-05-26 20:49:42 +020050# Definition of Patch for Vim
51!ifndef PATCHLEVEL
52 !define PATCHLEVEL 0
53!endif
54
Bram Moolenaar071d4272004-06-13 20:20:40 +000055# ----------- No configurable settings below this line -----------
56
Bram Moolenaaraf610b82018-12-21 16:22:50 +010057!include "Library.nsh" # For DLL install
58!ifdef HAVE_VIS_VIM
59 !include "UpgradeDLL.nsh" # for VisVim.dll
60!endif
61!include "LogicLib.nsh"
62!include "MUI2.nsh"
63!include "nsDialogs.nsh"
64!include "Sections.nsh"
65!include "x64.nsh"
Bram Moolenaar071d4272004-06-13 20:20:40 +000066
Bram Moolenaaraf610b82018-12-21 16:22:50 +010067!define PRODUCT "Vim ${VER_MAJOR}.${VER_MINOR}"
68!define UNINST_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall"
69!define UNINST_REG_KEY_VIM "${UNINST_REG_KEY}\${PRODUCT}"
70
71!ifdef WIN64
72Name "${PRODUCT} (x64)"
73!else
74Name "${PRODUCT}"
75!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000076OutFile gvim${VER_MAJOR}${VER_MINOR}.exe
77CRCCheck force
Bram Moolenaar286eacd2016-01-16 18:05:50 +010078SetCompressor /SOLID lzma
Bram Moolenaaraf610b82018-12-21 16:22:50 +010079SetCompressorDictSize 64
80ManifestDPIAware true
Bram Moolenaar071d4272004-06-13 20:20:40 +000081SetDatablockOptimize on
Bram Moolenaar442b4222010-05-24 21:34:22 +020082RequestExecutionLevel highest
Bram Moolenaar071d4272004-06-13 20:20:40 +000083
84!ifdef HAVE_UPX
85 !packhdr temp.dat "upx --best --compress-icons=1 temp.dat"
86!endif
87
Bram Moolenaaraf610b82018-12-21 16:22:50 +010088!ifdef WIN64
89!define BIT 64
90!else
91!define BIT 32
92!endif
93
94##########################################################
95# MUI2 settings
96
97!define MUI_ABORTWARNING
98!define MUI_UNABORTWARNING
99
100!define MUI_ICON "icons\vim_16c.ico"
101!define MUI_UNICON "icons\vim_uninst_16c.ico"
102
103# Show all languages, despite user's codepage:
104!define MUI_LANGDLL_ALLLANGUAGES
105!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
106!define MUI_LANGDLL_REGISTRY_KEY "Software\Vim"
107!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
108
109!define MUI_WELCOMEFINISHPAGE_BITMAP "icons\welcome.bmp"
110!define MUI_UNWELCOMEFINISHPAGE_BITMAP "icons\uninstall.bmp"
111!define MUI_HEADERIMAGE
112!define MUI_HEADERIMAGE_BITMAP "icons\header.bmp"
113!define MUI_HEADERIMAGE_UNBITMAP "icons\un_header.bmp"
114
115!define MUI_WELCOMEFINISHPAGE_BITMAP_STRETCH "AspectFitHeight"
116!define MUI_UNWELCOMEFINISHPAGE_BITMAP_STRETCH "AspectFitHeight"
117!define MUI_HEADERIMAGE_BITMAP_STRETCH "AspectFitHeight"
118!define MUI_HEADERIMAGE_UNBITMAP_STRETCH "AspectFitHeight"
119
120!define MUI_COMPONENTSPAGE_SMALLDESC
121!define MUI_LICENSEPAGE_CHECKBOX
Bram Moolenaar4a228972021-05-01 22:41:39 +0200122!define MUI_FINISHPAGE_RUN
123!define MUI_FINISHPAGE_RUN_FUNCTION LaunchApplication
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100124!define MUI_FINISHPAGE_RUN_TEXT $(str_show_readme)
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100125
126# This adds '\Vim' to the user choice automagically. The actual value is
127# obtained below with CheckOldVim.
128!ifdef WIN64
Christian Brabandt7d603842021-07-24 21:19:42 +0200129 !define DEFAULT_INSTDIR "$PROGRAMFILES64\Vim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100130!else
Christian Brabandt7d603842021-07-24 21:19:42 +0200131 !define DEFAULT_INSTDIR "$PROGRAMFILES\Vim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100132!endif
Christian Brabandt7d603842021-07-24 21:19:42 +0200133InstallDir ${DEFAULT_INSTDIR}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000134
135# Types of installs we can perform:
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100136InstType $(str_type_typical)
137InstType $(str_type_minimal)
138InstType $(str_type_full)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000139
140SilentInstall normal
141
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100142# General custom functions for MUI2:
143#!define MUI_CUSTOMFUNCTION_ABORT VimOnUserAbort
144#!define MUI_CUSTOMFUNCTION_UNABORT un.VimOnUserAbort
145
146# Installer pages
147!insertmacro MUI_PAGE_WELCOME
148!insertmacro MUI_PAGE_LICENSE "${VIMRT}\doc\uganda.nsis.txt"
149!insertmacro MUI_PAGE_COMPONENTS
150Page custom SetCustom ValidateCustom
151#!define MUI_PAGE_CUSTOMFUNCTION_LEAVE VimFinalCheck
152!insertmacro MUI_PAGE_DIRECTORY
153!insertmacro MUI_PAGE_INSTFILES
154!define MUI_FINISHPAGE_NOREBOOTSUPPORT
155!insertmacro MUI_PAGE_FINISH
156
157# Uninstaller pages:
158!insertmacro MUI_UNPAGE_CONFIRM
159#!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.VimCheckRunning
160!insertmacro MUI_UNPAGE_COMPONENTS
161!insertmacro MUI_UNPAGE_INSTFILES
162!define MUI_FINISHPAGE_NOREBOOTSUPPORT
163!insertmacro MUI_UNPAGE_FINISH
164
165##########################################################
166# Languages Files
167
168!insertmacro MUI_RESERVEFILE_LANGDLL
169!include "lang\english.nsi"
170
171# Include support for other languages:
172!ifdef HAVE_MULTI_LANG
173 !include "lang\danish.nsi"
174 !include "lang\dutch.nsi"
175 !include "lang\german.nsi"
176 !include "lang\italian.nsi"
177 !include "lang\japanese.nsi"
Bram Moolenaar809fcec2020-09-20 21:43:03 +0200178 !include "lang\russian.nsi"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100179 !include "lang\simpchinese.nsi"
180 !include "lang\tradchinese.nsi"
Bram Moolenaar1a928c22020-01-18 16:10:40 +0100181 !include "lang\turkish.nsi"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100182!endif
183
Bram Moolenaardabfde02019-05-17 12:37:27 +0200184##########################################################
185# Version resources
186
187VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Vim"
188VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Vim Developers"
189VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Vim"
190VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright (C) 1996"
191VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Vi Improved - A Text Editor"
Bram Moolenaar9d591522019-05-26 20:49:42 +0200192VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VER_MAJOR}.${VER_MINOR}.${PATCHLEVEL}.0"
193VIProductVersion "${VER_MAJOR}.${VER_MINOR}.${PATCHLEVEL}.0"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100194
195# Global variables
196Var vim_dialog
197Var vim_nsd_compat
198Var vim_nsd_keymap
199Var vim_nsd_mouse
200Var vim_compat_stat
201Var vim_keymap_stat
202Var vim_mouse_stat
203
Bram Moolenaar071d4272004-06-13 20:20:40 +0000204
Bram Moolenaar5d424742018-02-04 19:11:30 +0100205# Reserve files
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100206ReserveFile ${VIMSRC}\installw32.exe
Bram Moolenaar5d424742018-02-04 19:11:30 +0100207
Bram Moolenaar071d4272004-06-13 20:20:40 +0000208##########################################################
209# Functions
210
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100211# Get parent directory
212# Share this function both on installer and uninstaller
213!macro GetParent un
214Function ${un}GetParent
Bram Moolenaar071d4272004-06-13 20:20:40 +0000215 Exch $0 ; old $0 is on top of stack
216 Push $1
217 Push $2
218 StrCpy $1 -1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100219 ${Do}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000220 StrCpy $2 $0 1 $1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100221 ${If} $2 == ""
222 ${OrIf} $2 == "\"
223 ${ExitDo}
224 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000225 IntOp $1 $1 - 1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100226 ${Loop}
227 StrCpy $0 $0 $1
228 Pop $2
229 Pop $1
230 Exch $0 ; put $0 on top of stack, restore $0 to original value
231FunctionEnd
232!macroend
233
234!insertmacro GetParent ""
235!insertmacro GetParent "un."
236
237# Check if Vim is already installed.
238# return: Installed directory. If not found, it will be empty.
239Function CheckOldVim
240 Push $0
241 Push $R0
242 Push $R1
243 Push $R2
244
245 ${If} ${RunningX64}
246 SetRegView 64
247 ${EndIf}
248
249 ClearErrors
250 StrCpy $0 "" # Installed directory
251 StrCpy $R0 0 # Sub-key index
252 StrCpy $R1 "" # Sub-key
253 ${Do}
254 # Eumerate the sub-key:
255 EnumRegKey $R1 HKLM ${UNINST_REG_KEY} $R0
256
257 # Stop if no more sub-key:
258 ${If} ${Errors}
259 ${OrIf} $R1 == ""
260 ${ExitDo}
261 ${EndIf}
262
263 # Move to the next sub-key:
264 IntOp $R0 $R0 + 1
265
266 # Check if the key is Vim uninstall key or not:
267 StrCpy $R2 $R1 4
268 ${If} $R2 S!= "Vim "
269 ${Continue}
270 ${EndIf}
271
272 # Verifies required sub-keys:
273 ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "DisplayName"
274 ${If} ${Errors}
275 ${OrIf} $R2 == ""
276 ${Continue}
277 ${EndIf}
278
279 ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "UninstallString"
280 ${If} ${Errors}
281 ${OrIf} $R2 == ""
282 ${Continue}
283 ${EndIf}
284
285 # Found
286 Push $R2
287 call GetParent
288 call GetParent
289 Pop $0 # Vim directory
290 ${ExitDo}
291
292 ${Loop}
293
294 ${If} ${RunningX64}
295 SetRegView lastused
296 ${EndIf}
297
298 Pop $R2
299 Pop $R1
300 Pop $R0
301 Exch $0 # put $0 on top of stack, restore $0 to original value
Bram Moolenaar071d4272004-06-13 20:20:40 +0000302FunctionEnd
303
Bram Moolenaar4a228972021-05-01 22:41:39 +0200304Function LaunchApplication
305 SetOutPath $0
Bram Moolenaar5f628a12021-05-02 13:59:46 +0200306 ShellExecAsUser::ShellExecAsUser "" "$0\gvim.exe" '-R "$0\README.txt"'
Bram Moolenaar4a228972021-05-01 22:41:39 +0200307FunctionEnd
308
Bram Moolenaar071d4272004-06-13 20:20:40 +0000309##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100310Section "$(str_section_old_ver)" id_section_old_ver
311 SectionIn 1 2 3 RO
312
313 # run the install program to check for already installed versions
314 SetOutPath $TEMP
315 File /oname=install.exe ${VIMSRC}\installw32.exe
316 DetailPrint "$(str_msg_uninstalling)"
317 ${Do}
318 nsExec::Exec "$TEMP\install.exe -uninstall-check"
319 Pop $3
320
321 call CheckOldVim
322 Pop $3
323 ${If} $3 == ""
324 ${ExitDo}
325 ${Else}
326 # It seems that the old version is still remaining.
327 # TODO: Should we show a warning and run the uninstaller again?
328
329 ${ExitDo} # Just ignore for now.
330 ${EndIf}
331 ${Loop}
332 Delete $TEMP\install.exe
333 Delete $TEMP\vimini.ini # install.exe creates this, but we don't need it.
334
335 # We may have been put to the background when uninstall did something.
336 BringToFront
337SectionEnd
338
339##########################################################
340Section "$(str_section_exe)" id_section_exe
Bram Moolenaar49150a42017-09-17 21:00:03 +0200341 SectionIn 1 2 3 RO
Bram Moolenaar071d4272004-06-13 20:20:40 +0000342
343 # we need also this here if the user changes the instdir
344 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
345
346 SetOutPath $0
347 File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe
Bram Moolenaarafde13b2019-04-28 19:46:49 +0200348!if /FileExists "${VIMSRC}\vim${BIT}.dll"
349 File ${VIMSRC}\vim${BIT}.dll
350!endif
Christian Brabandtcf6ad8e2022-02-13 13:11:32 +0000351!if /FileExists "${VIMRT}\libsodium.dll"
352 File ${VIMRT}\libsodium.dll
353!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000354 File /oname=install.exe ${VIMSRC}\installw32.exe
Bram Moolenaar30e8e732019-09-27 13:08:36 +0200355 File /oname=uninstall.exe ${VIMSRC}\uninstallw32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000356 File ${VIMSRC}\vimrun.exe
Bram Moolenaarfec246d2016-08-28 18:47:14 +0200357 File /oname=tee.exe ${VIMSRC}\teew32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000358 File /oname=xxd.exe ${VIMSRC}\xxdw32.exe
Bram Moolenaar19166732018-12-21 17:59:33 +0100359 File ..\vimtutor.bat
360 File ..\README.txt
Bram Moolenaar30e8e732019-09-27 13:08:36 +0200361 File ..\uninstall.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000362 File ${VIMRT}\*.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000363
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200364 File ${VIMTOOLS}\diff.exe
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100365 File ${VIMTOOLS}\winpty${BIT}.dll
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200366 File ${VIMTOOLS}\winpty-agent.exe
367
Bram Moolenaar071d4272004-06-13 20:20:40 +0000368 SetOutPath $0\colors
369 File ${VIMRT}\colors\*.*
Bram Moolenaard0bce502021-02-26 20:25:35 +0100370 SetOutPath $0\colors\tools
371 File ${VIMRT}\colors\tools\*.*
Drew Vogele30d1022021-10-24 20:35:07 +0100372 SetOutPath $0\colors\lists
373 File ${VIMRT}\colors\lists\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000374
375 SetOutPath $0\compiler
376 File ${VIMRT}\compiler\*.*
377
378 SetOutPath $0\doc
379 File ${VIMRT}\doc\*.txt
380 File ${VIMRT}\doc\tags
381
382 SetOutPath $0\ftplugin
383 File ${VIMRT}\ftplugin\*.*
384
385 SetOutPath $0\indent
386 File ${VIMRT}\indent\*.*
387
388 SetOutPath $0\macros
Bram Moolenaar6a95c882019-03-26 23:02:46 +0100389 File /r ${VIMRT}\macros\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000390
Bram Moolenaar6a95c882019-03-26 23:02:46 +0100391 SetOutPath $0\pack
392 File /r ${VIMRT}\pack\*.*
Bram Moolenaar38623c82018-05-10 21:24:35 +0200393
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
Christian Brabandt176711f2022-03-11 15:24:11 +0000406 SetOutPath $0\bitmaps
407 File ${VIMSRC}\vim.ico
408
Bram Moolenaar071d4272004-06-13 20:20:40 +0000409 SetOutPath $0\syntax
410 File ${VIMRT}\syntax\*.*
411
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000412 SetOutPath $0\spell
413 File ${VIMRT}\spell\*.txt
414 File ${VIMRT}\spell\*.vim
415 File ${VIMRT}\spell\*.spl
416 File ${VIMRT}\spell\*.sug
417
Bram Moolenaar071d4272004-06-13 20:20:40 +0000418 SetOutPath $0\tools
419 File ${VIMRT}\tools\*.*
420
421 SetOutPath $0\tutor
422 File ${VIMRT}\tutor\*.*
423SectionEnd
424
425##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100426Section "$(str_section_console)" id_section_console
Bram Moolenaar071d4272004-06-13 20:20:40 +0000427 SectionIn 1 3
428
429 SetOutPath $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100430 File /oname=vim.exe ${VIMSRC}\vimw32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000431 StrCpy $2 "$2 vim view vimdiff"
432SectionEnd
433
434##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100435Section "$(str_section_batch)" id_section_batch
Bram Moolenaar071d4272004-06-13 20:20:40 +0000436 SectionIn 3
437
438 StrCpy $1 "$1 -create-batfiles $2"
439SectionEnd
440
441##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100442SectionGroup $(str_group_icons) id_group_icons
443 Section "$(str_section_desktop)" id_section_desktop
444 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000445
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100446 StrCpy $1 "$1 -install-icons"
447 SectionEnd
448
449 Section "$(str_section_start_menu)" id_section_startmenu
450 SectionIn 1 3
451
452 StrCpy $1 "$1 -add-start-menu"
453 SectionEnd
454SectionGroupEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000455
456##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100457Section "$(str_section_edit_with)" id_section_editwith
Bram Moolenaar071d4272004-06-13 20:20:40 +0000458 SectionIn 1 3
459
Bram Moolenaar071d4272004-06-13 20:20:40 +0000460 SetOutPath $0
Bram Moolenaar6199d432017-10-14 19:05:44 +0200461
Bram Moolenaar442b4222010-05-24 21:34:22 +0200462 ${If} ${RunningX64}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200463 # Install 64-bit gvimext.dll into the GvimExt64 directory.
464 SetOutPath $0\GvimExt64
465 ClearErrors
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100466 !define LIBRARY_SHELL_EXTENSION
467 !define LIBRARY_X64
468 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
469 "${VIMSRC}\GvimExt\gvimext64.dll" \
470 "$0\GvimExt64\gvimext.dll" "$0"
471 !undef LIBRARY_X64
472 !undef LIBRARY_SHELL_EXTENSION
Bram Moolenaar442b4222010-05-24 21:34:22 +0200473 ${EndIf}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200474
Bram Moolenaar6199d432017-10-14 19:05:44 +0200475 # Install 32-bit gvimext.dll into the GvimExt32 directory.
476 SetOutPath $0\GvimExt32
477 ClearErrors
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100478 !define LIBRARY_SHELL_EXTENSION
479 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
480 "${VIMSRC}\GvimExt\gvimext.dll" \
481 "$0\GvimExt32\gvimext.dll" "$0"
482 !undef LIBRARY_SHELL_EXTENSION
Bram Moolenaar071d4272004-06-13 20:20:40 +0000483
484 # We don't have a separate entry for the "Open With..." menu, assume
485 # the user wants either both or none.
486 StrCpy $1 "$1 -install-popup -install-openwith"
487SectionEnd
488
489##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100490Section "$(str_section_vim_rc)" id_section_vimrc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000491 SectionIn 1 3
492
493 StrCpy $1 "$1 -create-vimrc"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100494
495 ${If} ${RunningX64}
496 SetRegView 64
497 ${EndIf}
498 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_compat" "$vim_compat_stat"
499 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_keyremap" "$vim_keymap_stat"
500 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_mouse" "$vim_mouse_stat"
501 ${If} ${RunningX64}
502 SetRegView lastused
503 ${EndIf}
504
505 ${If} $vim_compat_stat == "vi"
506 StrCpy $1 "$1 -vimrc-compat vi"
507 ${ElseIf} $vim_compat_stat == "vim"
508 StrCpy $1 "$1 -vimrc-compat vim"
509 ${ElseIf} $vim_compat_stat == "defaults"
510 StrCpy $1 "$1 -vimrc-compat defaults"
511 ${Else}
512 StrCpy $1 "$1 -vimrc-compat all"
513 ${EndIf}
514
515 ${If} $vim_keymap_stat == "default"
516 StrCpy $1 "$1 -vimrc-remap no"
517 ${Else}
518 StrCpy $1 "$1 -vimrc-remap win"
519 ${EndIf}
520
521 ${If} $vim_mouse_stat == "default"
522 StrCpy $1 "$1 -vimrc-behave default"
523 ${ElseIf} $vim_mouse_stat == "windows"
524 StrCpy $1 "$1 -vimrc-behave mswin"
525 ${Else}
526 StrCpy $1 "$1 -vimrc-behave unix"
527 ${EndIf}
528
Bram Moolenaar071d4272004-06-13 20:20:40 +0000529SectionEnd
530
531##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100532SectionGroup $(str_group_plugin) id_group_plugin
533 Section "$(str_section_plugin_home)" id_section_pluginhome
534 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000535
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100536 StrCpy $1 "$1 -create-directories home"
537 SectionEnd
538
539 Section "$(str_section_plugin_vim)" id_section_pluginvim
540 SectionIn 3
541
542 StrCpy $1 "$1 -create-directories vim"
543 SectionEnd
544SectionGroupEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000545
546##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100547!ifdef HAVE_VIS_VIM
548Section "$(str_section_vis_vim)" id_section_visvim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000549 SectionIn 3
550
551 SetOutPath $0
552 !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0"
553 File ${VIMSRC}\VisVim\README_VisVim.txt
554SectionEnd
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100555!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000556
557##########################################################
558!ifdef HAVE_NLS
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100559Section "$(str_section_nls)" id_section_nls
560 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000561
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100562 SetOutPath $0\lang
563 File /r ${VIMRT}\lang\*.*
564 SetOutPath $0\keymap
565 File ${VIMRT}\keymap\README.txt
566 File ${VIMRT}\keymap\*.vim
567 SetOutPath $0
568 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
569 "${GETTEXT}\gettext${BIT}\libintl-8.dll" \
570 "$0\libintl-8.dll" "$0"
571 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
572 "${GETTEXT}\gettext${BIT}\libiconv-2.dll" \
573 "$0\libiconv-2.dll" "$0"
574 !if /FileExists "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll"
575 # Install libgcc_s_sjlj-1.dll only if it is needed.
576 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
577 "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll" \
578 "$0\libgcc_s_sjlj-1.dll" "$0"
579 !endif
580
581 ${If} ${SectionIsSelected} ${id_section_editwith}
582 ${If} ${RunningX64}
583 # Install DLLs for 64-bit gvimext.dll into the GvimExt64 directory.
584 SetOutPath $0\GvimExt64
585 ClearErrors
586 !define LIBRARY_X64
587 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
588 "${GETTEXT}\gettext64\libintl-8.dll" \
589 "$0\GvimExt64\libintl-8.dll" "$0\GvimExt64"
590 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
591 "${GETTEXT}\gettext64\libiconv-2.dll" \
592 "$0\GvimExt64\libiconv-2.dll" "$0\GvimExt64"
593 !undef LIBRARY_X64
594 ${EndIf}
595
596 # Install DLLs for 32-bit gvimext.dll into the GvimExt32 directory.
597 SetOutPath $0\GvimExt32
598 ClearErrors
599 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
600 "${GETTEXT}\gettext32\libintl-8.dll" \
601 "$0\GvimExt32\libintl-8.dll" "$0\GvimExt32"
602 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
603 "${GETTEXT}\gettext32\libiconv-2.dll" \
604 "$0\GvimExt32\libiconv-2.dll" "$0\GvimExt32"
605 !if /FileExists "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll"
606 # Install libgcc_s_sjlj-1.dll only if it is needed.
607 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
608 "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll" \
609 "$0\GvimExt32\libgcc_s_sjlj-1.dll" "$0\GvimExt32"
610 !endif
611 ${EndIf}
612SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000613!endif
614
615##########################################################
616Section -call_install_exe
617 SetOutPath $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100618 DetailPrint "$(str_msg_registering)"
619 nsExec::Exec "$0\install.exe $1"
620 Pop $3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000621SectionEnd
622
623##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100624!macro SaveSectionSelection section_id reg_value
625 ${If} ${SectionIsSelected} ${section_id}
626 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 1
627 ${Else}
628 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 0
629 ${EndIf}
630!macroend
631
Bram Moolenaar071d4272004-06-13 20:20:40 +0000632Section -post
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100633
634 # Get estimated install size
635 SectionGetSize ${id_section_exe} $3
636 ${If} ${SectionIsSelected} ${id_section_console}
637 SectionGetSize ${id_section_console} $4
638 IntOp $3 $3 + $4
639 ${EndIf}
640 ${If} ${SectionIsSelected} ${id_section_editwith}
641 SectionGetSize ${id_section_editwith} $4
642 IntOp $3 $3 + $4
643 ${EndIf}
644!ifdef HAVE_VIS_VIM
645 ${If} ${SectionIsSelected} ${id_section_visvim}
646 SectionGetSize ${id_section_visvim} $4
647 IntOp $3 $3 + $4
648 ${EndIf}
649!endif
650!ifdef HAVE_NLS
651 ${If} ${SectionIsSelected} ${id_section_nls}
652 SectionGetSize ${id_section_nls} $4
653 IntOp $3 $3 + $4
654 ${EndIf}
655!endif
656
657 # Register EstimatedSize and AllowSilent.
658 # Other information will be set by the install.exe (dosinst.c).
659 ${If} ${RunningX64}
660 SetRegView 64
661 ${EndIf}
662 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "EstimatedSize" $3
663 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "AllowSilent" 1
664 ${If} ${RunningX64}
665 SetRegView lastused
666 ${EndIf}
667
668 # Store the selections to the registry.
669 ${If} ${RunningX64}
670 SetRegView 64
671 ${EndIf}
672 !insertmacro SaveSectionSelection ${id_section_console} "select_console"
673 !insertmacro SaveSectionSelection ${id_section_batch} "select_batch"
674 !insertmacro SaveSectionSelection ${id_section_desktop} "select_desktop"
675 !insertmacro SaveSectionSelection ${id_section_startmenu} "select_startmenu"
676 !insertmacro SaveSectionSelection ${id_section_editwith} "select_editwith"
677 !insertmacro SaveSectionSelection ${id_section_vimrc} "select_vimrc"
678 !insertmacro SaveSectionSelection ${id_section_pluginhome} "select_pluginhome"
679 !insertmacro SaveSectionSelection ${id_section_pluginvim} "select_pluginvim"
680!ifdef HAVE_VIS_VIM
681 !insertmacro SaveSectionSelection ${id_section_visvim} "select_visvim"
682!endif
683!ifdef HAVE_NLS
684 !insertmacro SaveSectionSelection ${id_section_nls} "select_nls"
685!endif
686 ${If} ${RunningX64}
687 SetRegView lastused
688 ${EndIf}
689
Bram Moolenaar071d4272004-06-13 20:20:40 +0000690 BringToFront
691SectionEnd
692
693##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100694!macro LoadSectionSelection section_id reg_value
695 ClearErrors
696 ReadRegDWORD $3 HKLM "${UNINST_REG_KEY_VIM}" ${reg_value}
697 ${IfNot} ${Errors}
698 ${If} $3 = 1
699 !insertmacro SelectSection ${section_id}
700 ${Else}
701 !insertmacro UnselectSection ${section_id}
702 ${EndIf}
703 ${EndIf}
704!macroend
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200705
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200706!macro LoadDefaultVimrc out_var reg_value default_value
707 ClearErrors
708 ReadRegStr ${out_var} HKLM "${UNINST_REG_KEY_VIM}" ${reg_value}
709 ${If} ${Errors}
710 ${OrIf} ${out_var} == ""
711 StrCpy ${out_var} ${default_value}
712 ${EndIf}
713!macroend
714
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100715Function .onInit
716!ifdef HAVE_MULTI_LANG
717 # Select a language (or read from the registry).
718 !insertmacro MUI_LANGDLL_DISPLAY
719!endif
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200720
Christian Brabandt7d603842021-07-24 21:19:42 +0200721 ${If} $INSTDIR == ${DEFAULT_INSTDIR}
722 # Check $VIM
723 ReadEnvStr $3 "VIM"
724 ${If} $3 != ""
725 StrCpy $INSTDIR $3
726 ${EndIf}
727 ${EndIf}
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100728
729 call CheckOldVim
730 Pop $3
731 ${If} $3 == ""
732 # No old versions of Vim found. Unselect and hide the section.
733 !insertmacro UnselectSection ${id_section_old_ver}
734 SectionSetInstTypes ${id_section_old_ver} 0
735 SectionSetText ${id_section_old_ver} ""
736 ${Else}
Christian Brabandt7d603842021-07-24 21:19:42 +0200737 ${If} $INSTDIR == ${DEFAULT_INSTDIR}
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100738 StrCpy $INSTDIR $3
739 ${EndIf}
740 ${EndIf}
741
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100742 ${If} ${RunningX64}
743 SetRegView 64
744 ${EndIf}
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200745 # Load the selections from the registry (if any).
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100746 !insertmacro LoadSectionSelection ${id_section_console} "select_console"
747 !insertmacro LoadSectionSelection ${id_section_batch} "select_batch"
748 !insertmacro LoadSectionSelection ${id_section_desktop} "select_desktop"
749 !insertmacro LoadSectionSelection ${id_section_startmenu} "select_startmenu"
750 !insertmacro LoadSectionSelection ${id_section_editwith} "select_editwith"
751 !insertmacro LoadSectionSelection ${id_section_vimrc} "select_vimrc"
752 !insertmacro LoadSectionSelection ${id_section_pluginhome} "select_pluginhome"
753 !insertmacro LoadSectionSelection ${id_section_pluginvim} "select_pluginvim"
754!ifdef HAVE_VIS_VIM
755 !insertmacro LoadSectionSelection ${id_section_visvim} "select_visvim"
756!endif
757!ifdef HAVE_NLS
758 !insertmacro LoadSectionSelection ${id_section_nls} "select_nls"
759!endif
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200760 # Load the default _vimrc settings from the registry (if any).
761 !insertmacro LoadDefaultVimrc $vim_compat_stat "vim_compat" "all"
762 !insertmacro LoadDefaultVimrc $vim_keymap_stat "vim_keyremap" "default"
763 !insertmacro LoadDefaultVimrc $vim_mouse_stat "vim_mouse" "default"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100764 ${If} ${RunningX64}
765 SetRegView lastused
766 ${EndIf}
767
768 # User variables:
769 # $0 - holds the directory the executables are installed to
770 # $1 - holds the parameters to be passed to install.exe. Starts with OLE
771 # registration (since a non-OLE gvim will not complain, and we want to
772 # always register an OLE gvim).
773 # $2 - holds the names to create batch files for
774 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
775 StrCpy $1 "-register-OLE"
776 StrCpy $2 "gvim evim gview gvimdiff vimtutor"
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200777FunctionEnd
778
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100779Function .onInstSuccess
780 WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe
781FunctionEnd
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200782
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100783Function .onInstFailed
784 MessageBox MB_OK|MB_ICONEXCLAMATION "$(str_msg_install_fail)" /SD IDOK
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200785FunctionEnd
786
787##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100788Function SetCustom
789 # Display the _vimrc setting dialog using nsDialogs.
790
791 # Check if a _vimrc should be created
792 ${IfNot} ${SectionIsSelected} ${id_section_vimrc}
793 Abort
794 ${EndIf}
795
796 !insertmacro MUI_HEADER_TEXT \
797 $(str_vimrc_page_title) $(str_vimrc_page_subtitle)
798
799 nsDialogs::Create 1018
800 Pop $vim_dialog
801
802 ${If} $vim_dialog == error
803 Abort
804 ${EndIf}
805
806 ${If} ${RunningX64}
807 SetRegView 64
808 ${EndIf}
809
810 GetFunctionAddress $3 ValidateCustom
811 nsDialogs::OnBack $3
812
813
814 # 1st group - Compatibility
815 ${NSD_CreateGroupBox} 0 0 100% 32% $(str_msg_compat_title)
816 Pop $3
817
818 ${NSD_CreateLabel} 5% 10% 35% 8% $(str_msg_compat_desc)
819 Pop $3
820 ${NSD_CreateDropList} 18% 19% 75% 8% ""
821 Pop $vim_nsd_compat
822 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vi)
823 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vim)
824 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_defaults)
825 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_all)
826
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200827 ${If} $vim_compat_stat == "defaults"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100828 StrCpy $4 2
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200829 ${ElseIf} $vim_compat_stat == "vim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100830 StrCpy $4 1
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200831 ${ElseIf} $vim_compat_stat == "vi"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100832 StrCpy $4 0
833 ${Else} # default
834 StrCpy $4 3
835 ${EndIf}
836 ${NSD_CB_SetSelectionIndex} $vim_nsd_compat $4
837
838
839 # 2nd group - Key remapping
840 ${NSD_CreateGroupBox} 0 35% 100% 31% $(str_msg_keymap_title)
841 Pop $3
842
843 ${NSD_CreateLabel} 5% 45% 90% 8% $(str_msg_keymap_desc)
844 Pop $3
845 ${NSD_CreateDropList} 38% 54% 55% 8% ""
846 Pop $vim_nsd_keymap
847 ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_default)
848 ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_windows)
849
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200850 ${If} $vim_keymap_stat == "windows"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100851 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
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200870 ${If} $vim_mouse_stat == "xterm"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100871 StrCpy $4 2
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200872 ${ElseIf} $vim_mouse_stat == "windows"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100873 StrCpy $4 1
874 ${Else} # default
875 StrCpy $4 0
876 ${EndIf}
877 ${NSD_CB_SetSelectionIndex} $vim_nsd_mouse $4
878
879 ${If} ${RunningX64}
880 SetRegView lastused
881 ${EndIf}
882
883 nsDialogs::Show
884FunctionEnd
885
886Function ValidateCustom
887 ${NSD_CB_GetSelectionIndex} $vim_nsd_compat $3
888 ${If} $3 = 0
889 StrCpy $vim_compat_stat "vi"
890 ${ElseIf} $3 = 1
891 StrCpy $vim_compat_stat "vim"
892 ${ElseIf} $3 = 2
893 StrCpy $vim_compat_stat "defaults"
894 ${Else}
895 StrCpy $vim_compat_stat "all"
896 ${EndIf}
897
898 ${NSD_CB_GetSelectionIndex} $vim_nsd_keymap $3
899 ${If} $3 = 0
900 StrCpy $vim_keymap_stat "default"
901 ${Else}
902 StrCpy $vim_keymap_stat "windows"
903 ${EndIf}
904
905 ${NSD_CB_GetSelectionIndex} $vim_nsd_mouse $3
906 ${If} $3 = 0
907 StrCpy $vim_mouse_stat "default"
908 ${ElseIf} $3 = 1
909 StrCpy $vim_mouse_stat "windows"
910 ${Else}
911 StrCpy $vim_mouse_stat "xterm"
912 ${EndIf}
913FunctionEnd
914
915##########################################################
916# Description for Installer Sections
917
918!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
919 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_old_ver} $(str_desc_old_ver)
920 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_exe} $(str_desc_exe)
921 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_console} $(str_desc_console)
922 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_batch} $(str_desc_batch)
923 !insertmacro MUI_DESCRIPTION_TEXT ${id_group_icons} $(str_desc_icons)
924 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_desktop} $(str_desc_desktop)
925 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_startmenu} $(str_desc_start_menu)
926 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_editwith} $(str_desc_edit_with)
927 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_vimrc} $(str_desc_vim_rc)
928 !insertmacro MUI_DESCRIPTION_TEXT ${id_group_plugin} $(str_desc_plugin)
929 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginhome} $(str_desc_plugin_home)
930 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginvim} $(str_desc_plugin_vim)
931!ifdef HAVE_VIS_VIM
932 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_visvim} $(str_desc_vis_vim)
933!endif
934!ifdef HAVE_NLS
935 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_nls} $(str_desc_nls)
936!endif
937!insertmacro MUI_FUNCTION_DESCRIPTION_END
938
939
940##########################################################
941# Uninstaller Functions and Sections
942
943Function un.onInit
944!ifdef HAVE_MULTI_LANG
945 # Get the language from the registry.
946 !insertmacro MUI_UNGETLANGUAGE
947!endif
948FunctionEnd
949
950Section "un.$(str_unsection_register)" id_unsection_register
951 SectionIn RO
952
Bram Moolenaar071d4272004-06-13 20:20:40 +0000953 # Apparently $INSTDIR is set to the directory where the uninstaller is
954 # created. Thus the "vim61" directory is included in it.
955 StrCpy $0 "$INSTDIR"
956
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100957!ifdef HAVE_VIS_VIM
Bram Moolenaar071d4272004-06-13 20:20:40 +0000958 # If VisVim was installed, unregister the DLL.
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100959 ${If} ${FileExists} "$0\VisVim.dll"
960 ExecWait "regsvr32.exe /u /s $0\VisVim.dll"
961 ${EndIf}
962!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000963
964 # delete the context menu entry and batch files
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100965 DetailPrint "$(str_msg_unregistering)"
Bram Moolenaar30e8e732019-09-27 13:08:36 +0200966 nsExec::Exec "$0\uninstall.exe -nsis"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100967 Pop $3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000968
969 # We may have been put to the background when uninstall did something.
970 BringToFront
971
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100972 # Delete the installer language setting.
973 DeleteRegKey ${MUI_LANGDLL_REGISTRY_ROOT} ${MUI_LANGDLL_REGISTRY_KEY}
974SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000975
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100976Section "un.$(str_unsection_exe)" id_unsection_exe
977
978 StrCpy $0 "$INSTDIR"
979
980 # Delete gettext and iconv DLLs
981 ${If} ${FileExists} "$0\libiconv-2.dll"
982 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
983 "$0\libiconv-2.dll"
Bram Moolenaar6199d432017-10-14 19:05:44 +0200984 ${EndIf}
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100985 ${If} ${FileExists} "$0\libintl-8.dll"
986 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
987 "$0\libintl-8.dll"
988 ${EndIf}
989 ${If} ${FileExists} "$0\libgcc_s_sjlj-1.dll"
990 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
991 "$0\libgcc_s_sjlj-1.dll"
992 ${EndIf}
993
994 # Delete other DLLs
995 Delete /REBOOTOK $0\*.dll
996
997 # Delete 64-bit GvimExt
998 ${If} ${RunningX64}
999 !define LIBRARY_X64
1000 ${If} ${FileExists} "$0\GvimExt64\gvimext.dll"
1001 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1002 "$0\GvimExt64\gvimext.dll"
1003 ${EndIf}
1004 ${If} ${FileExists} "$0\GvimExt64\libiconv-2.dll"
1005 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1006 "$0\GvimExt64\libiconv-2.dll"
1007 ${EndIf}
1008 ${If} ${FileExists} "$0\GvimExt64\libintl-8.dll"
1009 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1010 "$0\GvimExt64\libintl-8.dll"
1011 ${EndIf}
1012 ${If} ${FileExists} "$0\GvimExt64\libwinpthread-1.dll"
1013 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1014 "$0\GvimExt64\libwinpthread-1.dll"
1015 ${EndIf}
1016 !undef LIBRARY_X64
1017 RMDir /r $0\GvimExt64
1018 ${EndIf}
1019
1020 # Delete 32-bit GvimExt
1021 ${If} ${FileExists} "$0\GvimExt32\gvimext.dll"
1022 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1023 "$0\GvimExt32\gvimext.dll"
1024 ${EndIf}
1025 ${If} ${FileExists} "$0\GvimExt32\libiconv-2.dll"
1026 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1027 "$0\GvimExt32\libiconv-2.dll"
1028 ${EndIf}
1029 ${If} ${FileExists} "$0\GvimExt32\libintl-8.dll"
1030 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1031 "$0\GvimExt32\libintl-8.dll"
1032 ${EndIf}
1033 ${If} ${FileExists} "$0\GvimExt32\libgcc_s_sjlj-1.dll"
1034 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1035 "$0\GvimExt32\libgcc_s_sjlj-1.dll"
1036 ${EndIf}
1037 RMDir /r $0\GvimExt32
Bram Moolenaar6199d432017-10-14 19:05:44 +02001038
Bram Moolenaar071d4272004-06-13 20:20:40 +00001039 ClearErrors
1040 # Remove everything but *.dll files. Avoids that
1041 # a lot remains when gvimext.dll cannot be deleted.
Bram Moolenaar408b5852006-05-13 10:44:07 +00001042 RMDir /r $0\autoload
Bram Moolenaar071d4272004-06-13 20:20:40 +00001043 RMDir /r $0\colors
1044 RMDir /r $0\compiler
1045 RMDir /r $0\doc
1046 RMDir /r $0\ftplugin
1047 RMDir /r $0\indent
1048 RMDir /r $0\macros
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001049 RMDir /r $0\pack
Bram Moolenaar071d4272004-06-13 20:20:40 +00001050 RMDir /r $0\plugin
Bram Moolenaar408b5852006-05-13 10:44:07 +00001051 RMDir /r $0\spell
Bram Moolenaar071d4272004-06-13 20:20:40 +00001052 RMDir /r $0\syntax
1053 RMDir /r $0\tools
1054 RMDir /r $0\tutor
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001055!ifdef HAVE_VIS_VIM
Bram Moolenaar071d4272004-06-13 20:20:40 +00001056 RMDir /r $0\VisVim
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001057!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001058 RMDir /r $0\lang
1059 RMDir /r $0\keymap
1060 Delete $0\*.exe
1061 Delete $0\*.bat
1062 Delete $0\*.vim
1063 Delete $0\*.txt
1064
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001065 ${If} ${Errors}
1066 MessageBox MB_OK|MB_ICONEXCLAMATION $(str_msg_rm_exe_fail) /SD IDOK
1067 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +00001068
1069 # No error message if the "vim62" directory can't be removed, the
1070 # gvimext.dll may still be there.
1071 RMDir $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001072SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +00001073
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001074# Remove "vimfiles" directory under the specified directory.
1075!macro RemoveVimfiles dir
1076 ${If} ${FileExists} ${dir}\vimfiles
1077 RMDir ${dir}\vimfiles\colors
1078 RMDir ${dir}\vimfiles\compiler
1079 RMDir ${dir}\vimfiles\doc
1080 RMDir ${dir}\vimfiles\ftdetect
1081 RMDir ${dir}\vimfiles\ftplugin
1082 RMDir ${dir}\vimfiles\indent
1083 RMDir ${dir}\vimfiles\keymap
1084 RMDir ${dir}\vimfiles\plugin
1085 RMDir ${dir}\vimfiles\syntax
1086 RMDir ${dir}\vimfiles
1087 ${EndIf}
1088!macroend
1089
1090SectionGroup "un.$(str_ungroup_plugin)" id_ungroup_plugin
1091 Section /o "un.$(str_unsection_plugin_home)" id_unsection_plugin_home
1092 # get the home dir
1093 ReadEnvStr $0 "HOME"
1094 ${If} $0 == ""
1095 ReadEnvStr $0 "HOMEDRIVE"
1096 ReadEnvStr $1 "HOMEPATH"
1097 StrCpy $0 "$0$1"
1098 ${If} $0 == ""
1099 ReadEnvStr $0 "USERPROFILE"
1100 ${EndIf}
1101 ${EndIf}
1102
1103 ${If} $0 != ""
1104 !insertmacro RemoveVimfiles $0
1105 ${EndIf}
1106 SectionEnd
1107
1108 Section "un.$(str_unsection_plugin_vim)" id_unsection_plugin_vim
1109 # get the parent dir of the installation
1110 Push $INSTDIR
1111 Call un.GetParent
1112 Pop $0
1113
1114 # if a plugin dir was created at installation remove it
1115 !insertmacro RemoveVimfiles $0
1116 SectionEnd
1117SectionGroupEnd
1118
1119Section "un.$(str_unsection_rootdir)" id_unsection_rootdir
Bram Moolenaar071d4272004-06-13 20:20:40 +00001120 # get the parent dir of the installation
1121 Push $INSTDIR
1122 Call un.GetParent
1123 Pop $0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001124
Bram Moolenaara8d22e32019-04-12 21:29:33 +02001125 ${IfNot} ${Silent}
1126 Delete $0\_vimrc
1127 ${Endif}
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001128 RMDir $0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001129SectionEnd
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001130
1131##########################################################
1132# Description for Uninstaller Sections
1133
1134!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
1135 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_register} $(str_desc_unregister)
1136 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_exe} $(str_desc_rm_exe)
1137 !insertmacro MUI_DESCRIPTION_TEXT ${id_ungroup_plugin} $(str_desc_rm_plugin)
1138 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_home} $(str_desc_rm_plugin_home)
1139 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_vim} $(str_desc_rm_plugin_vim)
1140 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_rootdir} $(str_desc_rm_rootdir)
1141!insertmacro MUI_UNFUNCTION_DESCRIPTION_END