blob: 62bef0f9cf9dc18b4c9aa27dfd0d1fdd3081dbe6 [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 Moolenaar3b0ef8c2020-02-12 21:03:32 +010039# Comment the following line to create an English-only installer:
Bram Moolenaaraf610b82018-12-21 16:22:50 +010040!define HAVE_MULTI_LANG
41
42# Uncomment the next line if you want to create a 64-bit installer.
43#!define WIN64
44
Bram Moolenaar6c7b4442016-01-02 15:44:32 +010045!include gvim_version.nsh # for version number
Bram Moolenaar071d4272004-06-13 20:20:40 +000046
Bram Moolenaar9d591522019-05-26 20:49:42 +020047# Definition of Patch for Vim
48!ifndef PATCHLEVEL
49 !define PATCHLEVEL 0
50!endif
51
Bram Moolenaar071d4272004-06-13 20:20:40 +000052# ----------- No configurable settings below this line -----------
53
Bram Moolenaaraf610b82018-12-21 16:22:50 +010054!include "Library.nsh" # For DLL install
Bram Moolenaaraf610b82018-12-21 16:22:50 +010055!include "LogicLib.nsh"
56!include "MUI2.nsh"
57!include "nsDialogs.nsh"
58!include "Sections.nsh"
59!include "x64.nsh"
Bram Moolenaar071d4272004-06-13 20:20:40 +000060
Bram Moolenaaraf610b82018-12-21 16:22:50 +010061!define PRODUCT "Vim ${VER_MAJOR}.${VER_MINOR}"
62!define UNINST_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall"
63!define UNINST_REG_KEY_VIM "${UNINST_REG_KEY}\${PRODUCT}"
64
65!ifdef WIN64
66Name "${PRODUCT} (x64)"
67!else
68Name "${PRODUCT}"
69!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000070OutFile gvim${VER_MAJOR}${VER_MINOR}.exe
71CRCCheck force
Bram Moolenaar286eacd2016-01-16 18:05:50 +010072SetCompressor /SOLID lzma
Bram Moolenaaraf610b82018-12-21 16:22:50 +010073SetCompressorDictSize 64
74ManifestDPIAware true
Bram Moolenaar071d4272004-06-13 20:20:40 +000075SetDatablockOptimize on
Bram Moolenaar442b4222010-05-24 21:34:22 +020076RequestExecutionLevel highest
Bram Moolenaar071d4272004-06-13 20:20:40 +000077
78!ifdef HAVE_UPX
79 !packhdr temp.dat "upx --best --compress-icons=1 temp.dat"
80!endif
81
Bram Moolenaaraf610b82018-12-21 16:22:50 +010082!ifdef WIN64
83!define BIT 64
84!else
85!define BIT 32
86!endif
87
88##########################################################
89# MUI2 settings
90
91!define MUI_ABORTWARNING
92!define MUI_UNABORTWARNING
93
94!define MUI_ICON "icons\vim_16c.ico"
95!define MUI_UNICON "icons\vim_uninst_16c.ico"
96
97# Show all languages, despite user's codepage:
98!define MUI_LANGDLL_ALLLANGUAGES
99!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
100!define MUI_LANGDLL_REGISTRY_KEY "Software\Vim"
101!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
102
103!define MUI_WELCOMEFINISHPAGE_BITMAP "icons\welcome.bmp"
104!define MUI_UNWELCOMEFINISHPAGE_BITMAP "icons\uninstall.bmp"
105!define MUI_HEADERIMAGE
106!define MUI_HEADERIMAGE_BITMAP "icons\header.bmp"
107!define MUI_HEADERIMAGE_UNBITMAP "icons\un_header.bmp"
108
109!define MUI_WELCOMEFINISHPAGE_BITMAP_STRETCH "AspectFitHeight"
110!define MUI_UNWELCOMEFINISHPAGE_BITMAP_STRETCH "AspectFitHeight"
111!define MUI_HEADERIMAGE_BITMAP_STRETCH "AspectFitHeight"
112!define MUI_HEADERIMAGE_UNBITMAP_STRETCH "AspectFitHeight"
113
114!define MUI_COMPONENTSPAGE_SMALLDESC
115!define MUI_LICENSEPAGE_CHECKBOX
Bram Moolenaar4a228972021-05-01 22:41:39 +0200116!define MUI_FINISHPAGE_RUN
117!define MUI_FINISHPAGE_RUN_FUNCTION LaunchApplication
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100118!define MUI_FINISHPAGE_RUN_TEXT $(str_show_readme)
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100119
120# This adds '\Vim' to the user choice automagically. The actual value is
121# obtained below with CheckOldVim.
122!ifdef WIN64
Christian Brabandt7d603842021-07-24 21:19:42 +0200123 !define DEFAULT_INSTDIR "$PROGRAMFILES64\Vim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100124!else
Christian Brabandt7d603842021-07-24 21:19:42 +0200125 !define DEFAULT_INSTDIR "$PROGRAMFILES\Vim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100126!endif
Christian Brabandt7d603842021-07-24 21:19:42 +0200127InstallDir ${DEFAULT_INSTDIR}
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"
Bram Moolenaar809fcec2020-09-20 21:43:03 +0200172 !include "lang\russian.nsi"
Ivan Pešiće1051922024-03-05 23:34:00 +0400173 !include "lang\serbian.nsi"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100174 !include "lang\simpchinese.nsi"
175 !include "lang\tradchinese.nsi"
Bram Moolenaar1a928c22020-01-18 16:10:40 +0100176 !include "lang\turkish.nsi"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100177!endif
178
Bram Moolenaardabfde02019-05-17 12:37:27 +0200179##########################################################
180# Version resources
181
182VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Vim"
183VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Vim Developers"
184VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Vim"
185VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright (C) 1996"
186VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Vi Improved - A Text Editor"
Bram Moolenaar9d591522019-05-26 20:49:42 +0200187VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VER_MAJOR}.${VER_MINOR}.${PATCHLEVEL}.0"
188VIProductVersion "${VER_MAJOR}.${VER_MINOR}.${PATCHLEVEL}.0"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100189
190# Global variables
191Var vim_dialog
192Var vim_nsd_compat
193Var vim_nsd_keymap
194Var vim_nsd_mouse
195Var vim_compat_stat
196Var vim_keymap_stat
197Var vim_mouse_stat
198
Bram Moolenaar071d4272004-06-13 20:20:40 +0000199
Bram Moolenaar5d424742018-02-04 19:11:30 +0100200# Reserve files
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100201ReserveFile ${VIMSRC}\installw32.exe
Bram Moolenaar5d424742018-02-04 19:11:30 +0100202
Bram Moolenaar071d4272004-06-13 20:20:40 +0000203##########################################################
204# Functions
205
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100206# Get parent directory
207# Share this function both on installer and uninstaller
208!macro GetParent un
209Function ${un}GetParent
Bram Moolenaar071d4272004-06-13 20:20:40 +0000210 Exch $0 ; old $0 is on top of stack
211 Push $1
212 Push $2
213 StrCpy $1 -1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100214 ${Do}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000215 StrCpy $2 $0 1 $1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100216 ${If} $2 == ""
217 ${OrIf} $2 == "\"
218 ${ExitDo}
219 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000220 IntOp $1 $1 - 1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100221 ${Loop}
222 StrCpy $0 $0 $1
223 Pop $2
224 Pop $1
225 Exch $0 ; put $0 on top of stack, restore $0 to original value
226FunctionEnd
227!macroend
228
229!insertmacro GetParent ""
230!insertmacro GetParent "un."
231
Christopher Plewrighteea0a002023-02-17 20:04:51 +0000232# Get home directory
233!macro GetHomeDir un
234Function ${un}GetHomeDir
235 Push $0
236 Push $1
237 ReadEnvStr $0 "HOME"
238 ${If} $0 == ""
239 ReadEnvStr $0 "HOMEDRIVE"
240 ReadEnvStr $1 "HOMEPATH"
241 StrCpy $0 "$0$1"
242 ${If} $0 == ""
243 ReadEnvStr $0 "USERPROFILE"
244 ${EndIf}
245 ${EndIf}
246 Pop $1
247 Exch $0 # put $0 on top of stack, restore $0 to original value
248FunctionEnd
249!macroend
250
251!insertmacro GetHomeDir ""
252!insertmacro GetHomeDir "un."
253
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100254# Check if Vim is already installed.
255# return: Installed directory. If not found, it will be empty.
256Function CheckOldVim
257 Push $0
258 Push $R0
259 Push $R1
260 Push $R2
261
262 ${If} ${RunningX64}
263 SetRegView 64
264 ${EndIf}
265
266 ClearErrors
267 StrCpy $0 "" # Installed directory
268 StrCpy $R0 0 # Sub-key index
269 StrCpy $R1 "" # Sub-key
270 ${Do}
271 # Eumerate the sub-key:
272 EnumRegKey $R1 HKLM ${UNINST_REG_KEY} $R0
273
274 # Stop if no more sub-key:
275 ${If} ${Errors}
276 ${OrIf} $R1 == ""
277 ${ExitDo}
278 ${EndIf}
279
280 # Move to the next sub-key:
281 IntOp $R0 $R0 + 1
282
283 # Check if the key is Vim uninstall key or not:
284 StrCpy $R2 $R1 4
285 ${If} $R2 S!= "Vim "
286 ${Continue}
287 ${EndIf}
288
289 # Verifies required sub-keys:
290 ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "DisplayName"
291 ${If} ${Errors}
292 ${OrIf} $R2 == ""
293 ${Continue}
294 ${EndIf}
295
296 ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "UninstallString"
297 ${If} ${Errors}
298 ${OrIf} $R2 == ""
299 ${Continue}
300 ${EndIf}
301
302 # Found
303 Push $R2
304 call GetParent
305 call GetParent
306 Pop $0 # Vim directory
307 ${ExitDo}
308
309 ${Loop}
310
311 ${If} ${RunningX64}
312 SetRegView lastused
313 ${EndIf}
314
315 Pop $R2
316 Pop $R1
317 Pop $R0
318 Exch $0 # put $0 on top of stack, restore $0 to original value
Bram Moolenaar071d4272004-06-13 20:20:40 +0000319FunctionEnd
320
Bram Moolenaar4a228972021-05-01 22:41:39 +0200321Function LaunchApplication
322 SetOutPath $0
Bram Moolenaar5f628a12021-05-02 13:59:46 +0200323 ShellExecAsUser::ShellExecAsUser "" "$0\gvim.exe" '-R "$0\README.txt"'
Bram Moolenaar4a228972021-05-01 22:41:39 +0200324FunctionEnd
325
Bram Moolenaar071d4272004-06-13 20:20:40 +0000326##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100327Section "$(str_section_old_ver)" id_section_old_ver
328 SectionIn 1 2 3 RO
329
330 # run the install program to check for already installed versions
331 SetOutPath $TEMP
332 File /oname=install.exe ${VIMSRC}\installw32.exe
333 DetailPrint "$(str_msg_uninstalling)"
334 ${Do}
335 nsExec::Exec "$TEMP\install.exe -uninstall-check"
336 Pop $3
337
338 call CheckOldVim
339 Pop $3
340 ${If} $3 == ""
341 ${ExitDo}
342 ${Else}
343 # It seems that the old version is still remaining.
344 # TODO: Should we show a warning and run the uninstaller again?
345
346 ${ExitDo} # Just ignore for now.
347 ${EndIf}
348 ${Loop}
349 Delete $TEMP\install.exe
350 Delete $TEMP\vimini.ini # install.exe creates this, but we don't need it.
351
352 # We may have been put to the background when uninstall did something.
353 BringToFront
354SectionEnd
355
356##########################################################
357Section "$(str_section_exe)" id_section_exe
Bram Moolenaar49150a42017-09-17 21:00:03 +0200358 SectionIn 1 2 3 RO
Bram Moolenaar071d4272004-06-13 20:20:40 +0000359
360 # we need also this here if the user changes the instdir
361 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
362
363 SetOutPath $0
364 File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe
Bram Moolenaarafde13b2019-04-28 19:46:49 +0200365!if /FileExists "${VIMSRC}\vim${BIT}.dll"
366 File ${VIMSRC}\vim${BIT}.dll
367!endif
Christian Brabandtcf6ad8e2022-02-13 13:11:32 +0000368!if /FileExists "${VIMRT}\libsodium.dll"
369 File ${VIMRT}\libsodium.dll
370!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000371 File /oname=install.exe ${VIMSRC}\installw32.exe
Bram Moolenaar30e8e732019-09-27 13:08:36 +0200372 File /oname=uninstall.exe ${VIMSRC}\uninstallw32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000373 File ${VIMSRC}\vimrun.exe
Bram Moolenaarfec246d2016-08-28 18:47:14 +0200374 File /oname=tee.exe ${VIMSRC}\teew32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000375 File /oname=xxd.exe ${VIMSRC}\xxdw32.exe
Bram Moolenaar19166732018-12-21 17:59:33 +0100376 File ..\vimtutor.bat
377 File ..\README.txt
Bram Moolenaar30e8e732019-09-27 13:08:36 +0200378 File ..\uninstall.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000379 File ${VIMRT}\*.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000380
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200381 File ${VIMTOOLS}\diff.exe
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100382 File ${VIMTOOLS}\winpty${BIT}.dll
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200383 File ${VIMTOOLS}\winpty-agent.exe
384
Bram Moolenaar071d4272004-06-13 20:20:40 +0000385 SetOutPath $0\colors
K.Takata44b9abb2022-08-24 18:08:00 +0100386 File /r ${VIMRT}\colors\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000387
388 SetOutPath $0\compiler
389 File ${VIMRT}\compiler\*.*
390
391 SetOutPath $0\doc
392 File ${VIMRT}\doc\*.txt
393 File ${VIMRT}\doc\tags
394
395 SetOutPath $0\ftplugin
396 File ${VIMRT}\ftplugin\*.*
397
398 SetOutPath $0\indent
399 File ${VIMRT}\indent\*.*
400
Ken Takata1a9aba82024-01-16 17:14:29 +0100401 SetOutPath $0\keymap
402 File ${VIMRT}\keymap\*.*
403
Bram Moolenaar071d4272004-06-13 20:20:40 +0000404 SetOutPath $0\macros
Bram Moolenaar6a95c882019-03-26 23:02:46 +0100405 File /r ${VIMRT}\macros\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000406
Bram Moolenaar6a95c882019-03-26 23:02:46 +0100407 SetOutPath $0\pack
408 File /r ${VIMRT}\pack\*.*
Bram Moolenaar38623c82018-05-10 21:24:35 +0200409
Bram Moolenaar071d4272004-06-13 20:20:40 +0000410 SetOutPath $0\plugin
411 File ${VIMRT}\plugin\*.*
412
Bram Moolenaar7fcab2a2006-03-25 21:46:12 +0000413 SetOutPath $0\autoload
K.Takata44b9abb2022-08-24 18:08:00 +0100414 File /r ${VIMRT}\autoload\*.*
Bram Moolenaar18144c82006-04-12 21:52:12 +0000415
Bram Moolenaar44433da2022-05-06 18:08:52 +0100416 SetOutPath $0\import\dist
417 File ${VIMRT}\import\dist\*.*
418
Christian Brabandt176711f2022-03-11 15:24:11 +0000419 SetOutPath $0\bitmaps
420 File ${VIMSRC}\vim.ico
421
Bram Moolenaar071d4272004-06-13 20:20:40 +0000422 SetOutPath $0\syntax
h-east9b53c052024-02-13 21:09:22 +0100423 File /r /x testdir /x generator ${VIMRT}\syntax\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000424
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000425 SetOutPath $0\spell
426 File ${VIMRT}\spell\*.txt
427 File ${VIMRT}\spell\*.vim
428 File ${VIMRT}\spell\*.spl
429 File ${VIMRT}\spell\*.sug
430
Bram Moolenaar071d4272004-06-13 20:20:40 +0000431 SetOutPath $0\tools
432 File ${VIMRT}\tools\*.*
433
434 SetOutPath $0\tutor
435 File ${VIMRT}\tutor\*.*
436SectionEnd
437
438##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100439Section "$(str_section_console)" id_section_console
Bram Moolenaar071d4272004-06-13 20:20:40 +0000440 SectionIn 1 3
441
442 SetOutPath $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100443 File /oname=vim.exe ${VIMSRC}\vimw32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000444 StrCpy $2 "$2 vim view vimdiff"
445SectionEnd
446
447##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100448Section "$(str_section_batch)" id_section_batch
Bram Moolenaar071d4272004-06-13 20:20:40 +0000449 SectionIn 3
450
451 StrCpy $1 "$1 -create-batfiles $2"
452SectionEnd
453
454##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100455SectionGroup $(str_group_icons) id_group_icons
456 Section "$(str_section_desktop)" id_section_desktop
457 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000458
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100459 StrCpy $1 "$1 -install-icons"
460 SectionEnd
461
462 Section "$(str_section_start_menu)" id_section_startmenu
463 SectionIn 1 3
464
465 StrCpy $1 "$1 -add-start-menu"
466 SectionEnd
467SectionGroupEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000468
469##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100470Section "$(str_section_edit_with)" id_section_editwith
Bram Moolenaar071d4272004-06-13 20:20:40 +0000471 SectionIn 1 3
472
Bram Moolenaar071d4272004-06-13 20:20:40 +0000473 SetOutPath $0
Bram Moolenaar6199d432017-10-14 19:05:44 +0200474
Bram Moolenaar442b4222010-05-24 21:34:22 +0200475 ${If} ${RunningX64}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200476 # Install 64-bit gvimext.dll into the GvimExt64 directory.
477 SetOutPath $0\GvimExt64
478 ClearErrors
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100479 !define LIBRARY_SHELL_EXTENSION
480 !define LIBRARY_X64
481 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
482 "${VIMSRC}\GvimExt\gvimext64.dll" \
483 "$0\GvimExt64\gvimext.dll" "$0"
484 !undef LIBRARY_X64
485 !undef LIBRARY_SHELL_EXTENSION
Bram Moolenaar442b4222010-05-24 21:34:22 +0200486 ${EndIf}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200487
Bram Moolenaar6199d432017-10-14 19:05:44 +0200488 # Install 32-bit gvimext.dll into the GvimExt32 directory.
489 SetOutPath $0\GvimExt32
490 ClearErrors
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100491 !define LIBRARY_SHELL_EXTENSION
492 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
493 "${VIMSRC}\GvimExt\gvimext.dll" \
494 "$0\GvimExt32\gvimext.dll" "$0"
495 !undef LIBRARY_SHELL_EXTENSION
Bram Moolenaar071d4272004-06-13 20:20:40 +0000496
497 # We don't have a separate entry for the "Open With..." menu, assume
498 # the user wants either both or none.
499 StrCpy $1 "$1 -install-popup -install-openwith"
500SectionEnd
501
502##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100503Section "$(str_section_vim_rc)" id_section_vimrc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000504 SectionIn 1 3
505
506 StrCpy $1 "$1 -create-vimrc"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100507
508 ${If} ${RunningX64}
509 SetRegView 64
510 ${EndIf}
511 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_compat" "$vim_compat_stat"
512 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_keyremap" "$vim_keymap_stat"
513 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_mouse" "$vim_mouse_stat"
514 ${If} ${RunningX64}
515 SetRegView lastused
516 ${EndIf}
517
518 ${If} $vim_compat_stat == "vi"
519 StrCpy $1 "$1 -vimrc-compat vi"
520 ${ElseIf} $vim_compat_stat == "vim"
521 StrCpy $1 "$1 -vimrc-compat vim"
522 ${ElseIf} $vim_compat_stat == "defaults"
523 StrCpy $1 "$1 -vimrc-compat defaults"
524 ${Else}
525 StrCpy $1 "$1 -vimrc-compat all"
526 ${EndIf}
527
528 ${If} $vim_keymap_stat == "default"
529 StrCpy $1 "$1 -vimrc-remap no"
530 ${Else}
531 StrCpy $1 "$1 -vimrc-remap win"
532 ${EndIf}
533
534 ${If} $vim_mouse_stat == "default"
535 StrCpy $1 "$1 -vimrc-behave default"
536 ${ElseIf} $vim_mouse_stat == "windows"
537 StrCpy $1 "$1 -vimrc-behave mswin"
538 ${Else}
539 StrCpy $1 "$1 -vimrc-behave unix"
540 ${EndIf}
541
Bram Moolenaar071d4272004-06-13 20:20:40 +0000542SectionEnd
543
544##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100545SectionGroup $(str_group_plugin) id_group_plugin
546 Section "$(str_section_plugin_home)" id_section_pluginhome
547 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000548
Christopher Plewrighteea0a002023-02-17 20:04:51 +0000549 # use ShellExecAsUser below instead
550 # StrCpy $1 "$1 -create-directories home"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100551 SectionEnd
552
553 Section "$(str_section_plugin_vim)" id_section_pluginvim
554 SectionIn 3
555
556 StrCpy $1 "$1 -create-directories vim"
557 SectionEnd
558SectionGroupEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000559
560##########################################################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000561!ifdef HAVE_NLS
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100562Section "$(str_section_nls)" id_section_nls
563 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000564
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100565 SetOutPath $0\lang
566 File /r ${VIMRT}\lang\*.*
567 SetOutPath $0\keymap
568 File ${VIMRT}\keymap\README.txt
569 File ${VIMRT}\keymap\*.vim
570 SetOutPath $0
571 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
572 "${GETTEXT}\gettext${BIT}\libintl-8.dll" \
573 "$0\libintl-8.dll" "$0"
574 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
575 "${GETTEXT}\gettext${BIT}\libiconv-2.dll" \
576 "$0\libiconv-2.dll" "$0"
577 !if /FileExists "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll"
578 # Install libgcc_s_sjlj-1.dll only if it is needed.
579 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
580 "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll" \
581 "$0\libgcc_s_sjlj-1.dll" "$0"
582 !endif
583
584 ${If} ${SectionIsSelected} ${id_section_editwith}
585 ${If} ${RunningX64}
586 # Install DLLs for 64-bit gvimext.dll into the GvimExt64 directory.
587 SetOutPath $0\GvimExt64
588 ClearErrors
589 !define LIBRARY_X64
590 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
591 "${GETTEXT}\gettext64\libintl-8.dll" \
592 "$0\GvimExt64\libintl-8.dll" "$0\GvimExt64"
593 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
594 "${GETTEXT}\gettext64\libiconv-2.dll" \
595 "$0\GvimExt64\libiconv-2.dll" "$0\GvimExt64"
596 !undef LIBRARY_X64
597 ${EndIf}
598
599 # Install DLLs for 32-bit gvimext.dll into the GvimExt32 directory.
600 SetOutPath $0\GvimExt32
601 ClearErrors
602 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
603 "${GETTEXT}\gettext32\libintl-8.dll" \
604 "$0\GvimExt32\libintl-8.dll" "$0\GvimExt32"
605 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
606 "${GETTEXT}\gettext32\libiconv-2.dll" \
607 "$0\GvimExt32\libiconv-2.dll" "$0\GvimExt32"
608 !if /FileExists "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll"
609 # Install libgcc_s_sjlj-1.dll only if it is needed.
610 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
611 "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll" \
612 "$0\GvimExt32\libgcc_s_sjlj-1.dll" "$0\GvimExt32"
613 !endif
614 ${EndIf}
615SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000616!endif
617
618##########################################################
619Section -call_install_exe
620 SetOutPath $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100621 DetailPrint "$(str_msg_registering)"
622 nsExec::Exec "$0\install.exe $1"
623 Pop $3
Christopher Plewrighteea0a002023-02-17 20:04:51 +0000624
625 ${If} ${SectionIsSelected} ${id_section_pluginhome}
626 ReadEnvStr $3 "COMSPEC"
627 Call GetHomeDir
628 Pop $4
629 ShellExecAsUser::ShellExecAsUser "" "$3" '/c "cd /d "$4" & mkdir vimfiles & cd vimfiles & mkdir colors compiler doc ftdetect ftplugin indent keymap plugin syntax"' SW_HIDE
630 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000631SectionEnd
632
633##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100634!macro SaveSectionSelection section_id reg_value
635 ${If} ${SectionIsSelected} ${section_id}
636 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 1
637 ${Else}
638 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 0
639 ${EndIf}
640!macroend
641
Bram Moolenaar071d4272004-06-13 20:20:40 +0000642Section -post
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100643
644 # Get estimated install size
645 SectionGetSize ${id_section_exe} $3
646 ${If} ${SectionIsSelected} ${id_section_console}
647 SectionGetSize ${id_section_console} $4
648 IntOp $3 $3 + $4
649 ${EndIf}
650 ${If} ${SectionIsSelected} ${id_section_editwith}
651 SectionGetSize ${id_section_editwith} $4
652 IntOp $3 $3 + $4
653 ${EndIf}
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100654!ifdef HAVE_NLS
655 ${If} ${SectionIsSelected} ${id_section_nls}
656 SectionGetSize ${id_section_nls} $4
657 IntOp $3 $3 + $4
658 ${EndIf}
659!endif
660
661 # Register EstimatedSize and AllowSilent.
662 # Other information will be set by the install.exe (dosinst.c).
663 ${If} ${RunningX64}
664 SetRegView 64
665 ${EndIf}
666 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "EstimatedSize" $3
667 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "AllowSilent" 1
668 ${If} ${RunningX64}
669 SetRegView lastused
670 ${EndIf}
671
672 # Store the selections to the registry.
673 ${If} ${RunningX64}
674 SetRegView 64
675 ${EndIf}
676 !insertmacro SaveSectionSelection ${id_section_console} "select_console"
677 !insertmacro SaveSectionSelection ${id_section_batch} "select_batch"
678 !insertmacro SaveSectionSelection ${id_section_desktop} "select_desktop"
679 !insertmacro SaveSectionSelection ${id_section_startmenu} "select_startmenu"
680 !insertmacro SaveSectionSelection ${id_section_editwith} "select_editwith"
681 !insertmacro SaveSectionSelection ${id_section_vimrc} "select_vimrc"
682 !insertmacro SaveSectionSelection ${id_section_pluginhome} "select_pluginhome"
683 !insertmacro SaveSectionSelection ${id_section_pluginvim} "select_pluginvim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100684!ifdef HAVE_NLS
685 !insertmacro SaveSectionSelection ${id_section_nls} "select_nls"
686!endif
687 ${If} ${RunningX64}
688 SetRegView lastused
689 ${EndIf}
690
Bram Moolenaar071d4272004-06-13 20:20:40 +0000691 BringToFront
692SectionEnd
693
694##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100695!macro LoadSectionSelection section_id reg_value
696 ClearErrors
697 ReadRegDWORD $3 HKLM "${UNINST_REG_KEY_VIM}" ${reg_value}
698 ${IfNot} ${Errors}
699 ${If} $3 = 1
700 !insertmacro SelectSection ${section_id}
701 ${Else}
702 !insertmacro UnselectSection ${section_id}
703 ${EndIf}
704 ${EndIf}
705!macroend
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200706
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200707!macro LoadDefaultVimrc out_var reg_value default_value
708 ClearErrors
709 ReadRegStr ${out_var} HKLM "${UNINST_REG_KEY_VIM}" ${reg_value}
710 ${If} ${Errors}
711 ${OrIf} ${out_var} == ""
712 StrCpy ${out_var} ${default_value}
713 ${EndIf}
714!macroend
715
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100716Function .onInit
717!ifdef HAVE_MULTI_LANG
718 # Select a language (or read from the registry).
719 !insertmacro MUI_LANGDLL_DISPLAY
720!endif
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200721
Christian Brabandt7d603842021-07-24 21:19:42 +0200722 ${If} $INSTDIR == ${DEFAULT_INSTDIR}
723 # Check $VIM
724 ReadEnvStr $3 "VIM"
725 ${If} $3 != ""
726 StrCpy $INSTDIR $3
727 ${EndIf}
728 ${EndIf}
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100729
730 call CheckOldVim
731 Pop $3
732 ${If} $3 == ""
733 # No old versions of Vim found. Unselect and hide the section.
734 !insertmacro UnselectSection ${id_section_old_ver}
735 SectionSetInstTypes ${id_section_old_ver} 0
736 SectionSetText ${id_section_old_ver} ""
737 ${Else}
Christian Brabandt7d603842021-07-24 21:19:42 +0200738 ${If} $INSTDIR == ${DEFAULT_INSTDIR}
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100739 StrCpy $INSTDIR $3
740 ${EndIf}
741 ${EndIf}
742
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100743 ${If} ${RunningX64}
744 SetRegView 64
745 ${EndIf}
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200746 # Load the selections from the registry (if any).
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100747 !insertmacro LoadSectionSelection ${id_section_console} "select_console"
748 !insertmacro LoadSectionSelection ${id_section_batch} "select_batch"
749 !insertmacro LoadSectionSelection ${id_section_desktop} "select_desktop"
750 !insertmacro LoadSectionSelection ${id_section_startmenu} "select_startmenu"
751 !insertmacro LoadSectionSelection ${id_section_editwith} "select_editwith"
752 !insertmacro LoadSectionSelection ${id_section_vimrc} "select_vimrc"
753 !insertmacro LoadSectionSelection ${id_section_pluginhome} "select_pluginhome"
754 !insertmacro LoadSectionSelection ${id_section_pluginvim} "select_pluginvim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100755!ifdef HAVE_NLS
756 !insertmacro LoadSectionSelection ${id_section_nls} "select_nls"
757!endif
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200758 # Load the default _vimrc settings from the registry (if any).
759 !insertmacro LoadDefaultVimrc $vim_compat_stat "vim_compat" "all"
760 !insertmacro LoadDefaultVimrc $vim_keymap_stat "vim_keyremap" "default"
761 !insertmacro LoadDefaultVimrc $vim_mouse_stat "vim_mouse" "default"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100762 ${If} ${RunningX64}
763 SetRegView lastused
764 ${EndIf}
765
766 # User variables:
767 # $0 - holds the directory the executables are installed to
768 # $1 - holds the parameters to be passed to install.exe. Starts with OLE
769 # registration (since a non-OLE gvim will not complain, and we want to
770 # always register an OLE gvim).
771 # $2 - holds the names to create batch files for
772 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
773 StrCpy $1 "-register-OLE"
774 StrCpy $2 "gvim evim gview gvimdiff vimtutor"
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200775FunctionEnd
776
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100777Function .onInstSuccess
778 WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe
779FunctionEnd
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200780
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100781Function .onInstFailed
782 MessageBox MB_OK|MB_ICONEXCLAMATION "$(str_msg_install_fail)" /SD IDOK
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200783FunctionEnd
784
785##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100786Function SetCustom
787 # Display the _vimrc setting dialog using nsDialogs.
788
789 # Check if a _vimrc should be created
790 ${IfNot} ${SectionIsSelected} ${id_section_vimrc}
791 Abort
792 ${EndIf}
793
794 !insertmacro MUI_HEADER_TEXT \
795 $(str_vimrc_page_title) $(str_vimrc_page_subtitle)
796
797 nsDialogs::Create 1018
798 Pop $vim_dialog
799
800 ${If} $vim_dialog == error
801 Abort
802 ${EndIf}
803
804 ${If} ${RunningX64}
805 SetRegView 64
806 ${EndIf}
807
808 GetFunctionAddress $3 ValidateCustom
809 nsDialogs::OnBack $3
810
811
812 # 1st group - Compatibility
813 ${NSD_CreateGroupBox} 0 0 100% 32% $(str_msg_compat_title)
814 Pop $3
815
816 ${NSD_CreateLabel} 5% 10% 35% 8% $(str_msg_compat_desc)
817 Pop $3
818 ${NSD_CreateDropList} 18% 19% 75% 8% ""
819 Pop $vim_nsd_compat
820 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vi)
821 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vim)
822 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_defaults)
823 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_all)
824
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200825 ${If} $vim_compat_stat == "defaults"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100826 StrCpy $4 2
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200827 ${ElseIf} $vim_compat_stat == "vim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100828 StrCpy $4 1
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200829 ${ElseIf} $vim_compat_stat == "vi"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100830 StrCpy $4 0
831 ${Else} # default
832 StrCpy $4 3
833 ${EndIf}
834 ${NSD_CB_SetSelectionIndex} $vim_nsd_compat $4
835
836
837 # 2nd group - Key remapping
838 ${NSD_CreateGroupBox} 0 35% 100% 31% $(str_msg_keymap_title)
839 Pop $3
840
841 ${NSD_CreateLabel} 5% 45% 90% 8% $(str_msg_keymap_desc)
842 Pop $3
843 ${NSD_CreateDropList} 38% 54% 55% 8% ""
844 Pop $vim_nsd_keymap
845 ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_default)
846 ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_windows)
847
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200848 ${If} $vim_keymap_stat == "windows"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100849 StrCpy $4 1
850 ${Else} # default
851 StrCpy $4 0
852 ${EndIf}
853 ${NSD_CB_SetSelectionIndex} $vim_nsd_keymap $4
854
855
856 # 3rd group - Mouse behavior
857 ${NSD_CreateGroupBox} 0 69% 100% 31% $(str_msg_mouse_title)
858 Pop $3
859
860 ${NSD_CreateLabel} 5% 79% 90% 8% $(str_msg_mouse_desc)
861 Pop $3
862 ${NSD_CreateDropList} 23% 87% 70% 8% ""
863 Pop $vim_nsd_mouse
864 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_default)
865 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_windows)
866 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_unix)
867
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200868 ${If} $vim_mouse_stat == "xterm"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100869 StrCpy $4 2
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200870 ${ElseIf} $vim_mouse_stat == "windows"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100871 StrCpy $4 1
872 ${Else} # default
873 StrCpy $4 0
874 ${EndIf}
875 ${NSD_CB_SetSelectionIndex} $vim_nsd_mouse $4
876
877 ${If} ${RunningX64}
878 SetRegView lastused
879 ${EndIf}
880
881 nsDialogs::Show
882FunctionEnd
883
884Function ValidateCustom
885 ${NSD_CB_GetSelectionIndex} $vim_nsd_compat $3
886 ${If} $3 = 0
887 StrCpy $vim_compat_stat "vi"
888 ${ElseIf} $3 = 1
889 StrCpy $vim_compat_stat "vim"
890 ${ElseIf} $3 = 2
891 StrCpy $vim_compat_stat "defaults"
892 ${Else}
893 StrCpy $vim_compat_stat "all"
894 ${EndIf}
895
896 ${NSD_CB_GetSelectionIndex} $vim_nsd_keymap $3
897 ${If} $3 = 0
898 StrCpy $vim_keymap_stat "default"
899 ${Else}
900 StrCpy $vim_keymap_stat "windows"
901 ${EndIf}
902
903 ${NSD_CB_GetSelectionIndex} $vim_nsd_mouse $3
904 ${If} $3 = 0
905 StrCpy $vim_mouse_stat "default"
906 ${ElseIf} $3 = 1
907 StrCpy $vim_mouse_stat "windows"
908 ${Else}
909 StrCpy $vim_mouse_stat "xterm"
910 ${EndIf}
911FunctionEnd
912
913##########################################################
914# Description for Installer Sections
915
916!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
917 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_old_ver} $(str_desc_old_ver)
918 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_exe} $(str_desc_exe)
919 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_console} $(str_desc_console)
920 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_batch} $(str_desc_batch)
921 !insertmacro MUI_DESCRIPTION_TEXT ${id_group_icons} $(str_desc_icons)
922 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_desktop} $(str_desc_desktop)
923 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_startmenu} $(str_desc_start_menu)
924 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_editwith} $(str_desc_edit_with)
925 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_vimrc} $(str_desc_vim_rc)
926 !insertmacro MUI_DESCRIPTION_TEXT ${id_group_plugin} $(str_desc_plugin)
927 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginhome} $(str_desc_plugin_home)
928 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginvim} $(str_desc_plugin_vim)
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100929!ifdef HAVE_NLS
930 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_nls} $(str_desc_nls)
931!endif
932!insertmacro MUI_FUNCTION_DESCRIPTION_END
933
934
935##########################################################
936# Uninstaller Functions and Sections
937
938Function un.onInit
939!ifdef HAVE_MULTI_LANG
940 # Get the language from the registry.
941 !insertmacro MUI_UNGETLANGUAGE
942!endif
943FunctionEnd
944
945Section "un.$(str_unsection_register)" id_unsection_register
946 SectionIn RO
947
Bram Moolenaar071d4272004-06-13 20:20:40 +0000948 # Apparently $INSTDIR is set to the directory where the uninstaller is
949 # created. Thus the "vim61" directory is included in it.
950 StrCpy $0 "$INSTDIR"
951
Bram Moolenaar071d4272004-06-13 20:20:40 +0000952 # delete the context menu entry and batch files
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100953 DetailPrint "$(str_msg_unregistering)"
Bram Moolenaar30e8e732019-09-27 13:08:36 +0200954 nsExec::Exec "$0\uninstall.exe -nsis"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100955 Pop $3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000956
957 # We may have been put to the background when uninstall did something.
958 BringToFront
959
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100960 # Delete the installer language setting.
961 DeleteRegKey ${MUI_LANGDLL_REGISTRY_ROOT} ${MUI_LANGDLL_REGISTRY_KEY}
962SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000963
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100964Section "un.$(str_unsection_exe)" id_unsection_exe
965
966 StrCpy $0 "$INSTDIR"
967
968 # Delete gettext and iconv DLLs
969 ${If} ${FileExists} "$0\libiconv-2.dll"
970 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
971 "$0\libiconv-2.dll"
Bram Moolenaar6199d432017-10-14 19:05:44 +0200972 ${EndIf}
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100973 ${If} ${FileExists} "$0\libintl-8.dll"
974 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
975 "$0\libintl-8.dll"
976 ${EndIf}
977 ${If} ${FileExists} "$0\libgcc_s_sjlj-1.dll"
978 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
979 "$0\libgcc_s_sjlj-1.dll"
980 ${EndIf}
981
982 # Delete other DLLs
983 Delete /REBOOTOK $0\*.dll
984
985 # Delete 64-bit GvimExt
986 ${If} ${RunningX64}
987 !define LIBRARY_X64
988 ${If} ${FileExists} "$0\GvimExt64\gvimext.dll"
989 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
990 "$0\GvimExt64\gvimext.dll"
991 ${EndIf}
992 ${If} ${FileExists} "$0\GvimExt64\libiconv-2.dll"
993 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
994 "$0\GvimExt64\libiconv-2.dll"
995 ${EndIf}
996 ${If} ${FileExists} "$0\GvimExt64\libintl-8.dll"
997 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
998 "$0\GvimExt64\libintl-8.dll"
999 ${EndIf}
1000 ${If} ${FileExists} "$0\GvimExt64\libwinpthread-1.dll"
1001 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1002 "$0\GvimExt64\libwinpthread-1.dll"
1003 ${EndIf}
1004 !undef LIBRARY_X64
1005 RMDir /r $0\GvimExt64
1006 ${EndIf}
1007
1008 # Delete 32-bit GvimExt
1009 ${If} ${FileExists} "$0\GvimExt32\gvimext.dll"
1010 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1011 "$0\GvimExt32\gvimext.dll"
1012 ${EndIf}
1013 ${If} ${FileExists} "$0\GvimExt32\libiconv-2.dll"
1014 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1015 "$0\GvimExt32\libiconv-2.dll"
1016 ${EndIf}
1017 ${If} ${FileExists} "$0\GvimExt32\libintl-8.dll"
1018 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1019 "$0\GvimExt32\libintl-8.dll"
1020 ${EndIf}
1021 ${If} ${FileExists} "$0\GvimExt32\libgcc_s_sjlj-1.dll"
1022 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1023 "$0\GvimExt32\libgcc_s_sjlj-1.dll"
1024 ${EndIf}
1025 RMDir /r $0\GvimExt32
Bram Moolenaar6199d432017-10-14 19:05:44 +02001026
Bram Moolenaar071d4272004-06-13 20:20:40 +00001027 ClearErrors
1028 # Remove everything but *.dll files. Avoids that
1029 # a lot remains when gvimext.dll cannot be deleted.
Bram Moolenaar408b5852006-05-13 10:44:07 +00001030 RMDir /r $0\autoload
Bram Moolenaar071d4272004-06-13 20:20:40 +00001031 RMDir /r $0\colors
1032 RMDir /r $0\compiler
1033 RMDir /r $0\doc
1034 RMDir /r $0\ftplugin
Bram Moolenaar44433da2022-05-06 18:08:52 +01001035 RMDir /r $0\import
Bram Moolenaar071d4272004-06-13 20:20:40 +00001036 RMDir /r $0\indent
1037 RMDir /r $0\macros
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001038 RMDir /r $0\pack
Bram Moolenaar071d4272004-06-13 20:20:40 +00001039 RMDir /r $0\plugin
Bram Moolenaar408b5852006-05-13 10:44:07 +00001040 RMDir /r $0\spell
Bram Moolenaar071d4272004-06-13 20:20:40 +00001041 RMDir /r $0\syntax
1042 RMDir /r $0\tools
1043 RMDir /r $0\tutor
Bram Moolenaar071d4272004-06-13 20:20:40 +00001044 RMDir /r $0\lang
1045 RMDir /r $0\keymap
1046 Delete $0\*.exe
1047 Delete $0\*.bat
1048 Delete $0\*.vim
1049 Delete $0\*.txt
1050
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001051 ${If} ${Errors}
1052 MessageBox MB_OK|MB_ICONEXCLAMATION $(str_msg_rm_exe_fail) /SD IDOK
1053 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +00001054
1055 # No error message if the "vim62" directory can't be removed, the
1056 # gvimext.dll may still be there.
1057 RMDir $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001058SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +00001059
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001060# Remove "vimfiles" directory under the specified directory.
1061!macro RemoveVimfiles dir
1062 ${If} ${FileExists} ${dir}\vimfiles
1063 RMDir ${dir}\vimfiles\colors
1064 RMDir ${dir}\vimfiles\compiler
1065 RMDir ${dir}\vimfiles\doc
1066 RMDir ${dir}\vimfiles\ftdetect
1067 RMDir ${dir}\vimfiles\ftplugin
1068 RMDir ${dir}\vimfiles\indent
1069 RMDir ${dir}\vimfiles\keymap
1070 RMDir ${dir}\vimfiles\plugin
1071 RMDir ${dir}\vimfiles\syntax
1072 RMDir ${dir}\vimfiles
1073 ${EndIf}
1074!macroend
1075
1076SectionGroup "un.$(str_ungroup_plugin)" id_ungroup_plugin
1077 Section /o "un.$(str_unsection_plugin_home)" id_unsection_plugin_home
1078 # get the home dir
Christopher Plewrighteea0a002023-02-17 20:04:51 +00001079 Call un.GetHomeDir
1080 Pop $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001081
1082 ${If} $0 != ""
1083 !insertmacro RemoveVimfiles $0
1084 ${EndIf}
1085 SectionEnd
1086
1087 Section "un.$(str_unsection_plugin_vim)" id_unsection_plugin_vim
1088 # get the parent dir of the installation
1089 Push $INSTDIR
1090 Call un.GetParent
1091 Pop $0
1092
1093 # if a plugin dir was created at installation remove it
1094 !insertmacro RemoveVimfiles $0
1095 SectionEnd
1096SectionGroupEnd
1097
1098Section "un.$(str_unsection_rootdir)" id_unsection_rootdir
Bram Moolenaar071d4272004-06-13 20:20:40 +00001099 # get the parent dir of the installation
1100 Push $INSTDIR
1101 Call un.GetParent
1102 Pop $0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001103
Bram Moolenaara8d22e32019-04-12 21:29:33 +02001104 ${IfNot} ${Silent}
1105 Delete $0\_vimrc
1106 ${Endif}
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001107 RMDir $0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001108SectionEnd
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001109
1110##########################################################
1111# Description for Uninstaller Sections
1112
1113!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
1114 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_register} $(str_desc_unregister)
1115 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_exe} $(str_desc_rm_exe)
1116 !insertmacro MUI_DESCRIPTION_TEXT ${id_ungroup_plugin} $(str_desc_rm_plugin)
1117 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_home} $(str_desc_rm_plugin_home)
1118 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_vim} $(str_desc_rm_plugin_vim)
1119 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_rootdir} $(str_desc_rm_rootdir)
1120!insertmacro MUI_UNFUNCTION_DESCRIPTION_END