blob: ec6536105c4f71bc2919e099a6d141d8712b5e14 [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.
RestorerZ2680a072024-03-20 20:15:51 +01003# Last Change: 2024 Mar 17
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
RestorerZ2680a072024-03-20 20:15:51 +010061# See https://nsis.sourceforge.io/LogicLib
62;FileExists is already part of LogicLib, but returns true for directories
63;as well as files
64!macro _FileExists2 _a _b _t _f
65 !insertmacro _LOGICLIB_TEMP
66 StrCpy $_LOGICLIB_TEMP "0"
67;if path is not blank, continue to next check
68 StrCmp `${_b}` `` +4 0
69;if path exists, continue to next check (IfFileExists returns true if this
70;is a directory)
71 IfFileExists `${_b}` `0` +3
72;if path is not a directory, continue to confirm exists
73 IfFileExists `${_b}\*.*` +2 0
74 StrCpy $_LOGICLIB_TEMP "1" ;file exists
75;now we have a definitive value - the file exists or it does not
76 StrCmp $_LOGICLIB_TEMP "1" `${_t}` `${_f}`
77!macroend
78!undef FileExists
79!define FileExists `"" FileExists2`
80!macro _DirExists _a _b _t _f
81 !insertmacro _LOGICLIB_TEMP
82 StrCpy $_LOGICLIB_TEMP "0"
83;if path is not blank, continue to next check
84 StrCmp `${_b}` `` +3 0
85;if directory exists, continue to confirm exists
86 IfFileExists `${_b}\*.*` 0 +2
87 StrCpy $_LOGICLIB_TEMP "1"
88 StrCmp $_LOGICLIB_TEMP "1" `${_t}` `${_f}`
89!macroend
90!define DirExists `"" DirExists`
91
Bram Moolenaaraf610b82018-12-21 16:22:50 +010092!define PRODUCT "Vim ${VER_MAJOR}.${VER_MINOR}"
93!define UNINST_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall"
94!define UNINST_REG_KEY_VIM "${UNINST_REG_KEY}\${PRODUCT}"
95
96!ifdef WIN64
97Name "${PRODUCT} (x64)"
98!else
99Name "${PRODUCT}"
100!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000101OutFile gvim${VER_MAJOR}${VER_MINOR}.exe
102CRCCheck force
Bram Moolenaar286eacd2016-01-16 18:05:50 +0100103SetCompressor /SOLID lzma
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100104SetCompressorDictSize 64
105ManifestDPIAware true
Bram Moolenaar071d4272004-06-13 20:20:40 +0000106SetDatablockOptimize on
Bram Moolenaar442b4222010-05-24 21:34:22 +0200107RequestExecutionLevel highest
Bram Moolenaar071d4272004-06-13 20:20:40 +0000108
109!ifdef HAVE_UPX
110 !packhdr temp.dat "upx --best --compress-icons=1 temp.dat"
111!endif
112
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100113!ifdef WIN64
114!define BIT 64
115!else
116!define BIT 32
117!endif
118
119##########################################################
120# MUI2 settings
121
122!define MUI_ABORTWARNING
123!define MUI_UNABORTWARNING
124
125!define MUI_ICON "icons\vim_16c.ico"
126!define MUI_UNICON "icons\vim_uninst_16c.ico"
127
128# Show all languages, despite user's codepage:
129!define MUI_LANGDLL_ALLLANGUAGES
130!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
131!define MUI_LANGDLL_REGISTRY_KEY "Software\Vim"
132!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
133
134!define MUI_WELCOMEFINISHPAGE_BITMAP "icons\welcome.bmp"
135!define MUI_UNWELCOMEFINISHPAGE_BITMAP "icons\uninstall.bmp"
136!define MUI_HEADERIMAGE
137!define MUI_HEADERIMAGE_BITMAP "icons\header.bmp"
138!define MUI_HEADERIMAGE_UNBITMAP "icons\un_header.bmp"
139
140!define MUI_WELCOMEFINISHPAGE_BITMAP_STRETCH "AspectFitHeight"
141!define MUI_UNWELCOMEFINISHPAGE_BITMAP_STRETCH "AspectFitHeight"
142!define MUI_HEADERIMAGE_BITMAP_STRETCH "AspectFitHeight"
143!define MUI_HEADERIMAGE_UNBITMAP_STRETCH "AspectFitHeight"
144
145!define MUI_COMPONENTSPAGE_SMALLDESC
146!define MUI_LICENSEPAGE_CHECKBOX
Bram Moolenaar4a228972021-05-01 22:41:39 +0200147!define MUI_FINISHPAGE_RUN
148!define MUI_FINISHPAGE_RUN_FUNCTION LaunchApplication
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100149!define MUI_FINISHPAGE_RUN_TEXT $(str_show_readme)
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100150
151# This adds '\Vim' to the user choice automagically. The actual value is
152# obtained below with CheckOldVim.
153!ifdef WIN64
Christian Brabandt7d603842021-07-24 21:19:42 +0200154 !define DEFAULT_INSTDIR "$PROGRAMFILES64\Vim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100155!else
Christian Brabandt7d603842021-07-24 21:19:42 +0200156 !define DEFAULT_INSTDIR "$PROGRAMFILES\Vim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100157!endif
Christian Brabandt7d603842021-07-24 21:19:42 +0200158InstallDir ${DEFAULT_INSTDIR}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000159
160# Types of installs we can perform:
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100161InstType $(str_type_typical)
162InstType $(str_type_minimal)
163InstType $(str_type_full)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000164
165SilentInstall normal
166
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100167# General custom functions for MUI2:
168#!define MUI_CUSTOMFUNCTION_ABORT VimOnUserAbort
169#!define MUI_CUSTOMFUNCTION_UNABORT un.VimOnUserAbort
170
171# Installer pages
172!insertmacro MUI_PAGE_WELCOME
173!insertmacro MUI_PAGE_LICENSE "${VIMRT}\doc\uganda.nsis.txt"
174!insertmacro MUI_PAGE_COMPONENTS
175Page custom SetCustom ValidateCustom
176#!define MUI_PAGE_CUSTOMFUNCTION_LEAVE VimFinalCheck
177!insertmacro MUI_PAGE_DIRECTORY
178!insertmacro MUI_PAGE_INSTFILES
179!define MUI_FINISHPAGE_NOREBOOTSUPPORT
180!insertmacro MUI_PAGE_FINISH
181
182# Uninstaller pages:
183!insertmacro MUI_UNPAGE_CONFIRM
184#!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.VimCheckRunning
185!insertmacro MUI_UNPAGE_COMPONENTS
186!insertmacro MUI_UNPAGE_INSTFILES
187!define MUI_FINISHPAGE_NOREBOOTSUPPORT
188!insertmacro MUI_UNPAGE_FINISH
189
190##########################################################
191# Languages Files
192
193!insertmacro MUI_RESERVEFILE_LANGDLL
194!include "lang\english.nsi"
195
196# Include support for other languages:
197!ifdef HAVE_MULTI_LANG
198 !include "lang\danish.nsi"
199 !include "lang\dutch.nsi"
200 !include "lang\german.nsi"
Christos Longrosc62dacb2024-03-06 20:53:02 +0100201 !include "lang\greek.nsi"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100202 !include "lang\italian.nsi"
203 !include "lang\japanese.nsi"
Bram Moolenaar809fcec2020-09-20 21:43:03 +0200204 !include "lang\russian.nsi"
Ivan Pešiće1051922024-03-05 23:34:00 +0400205 !include "lang\serbian.nsi"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100206 !include "lang\simpchinese.nsi"
207 !include "lang\tradchinese.nsi"
Bram Moolenaar1a928c22020-01-18 16:10:40 +0100208 !include "lang\turkish.nsi"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100209!endif
210
Bram Moolenaardabfde02019-05-17 12:37:27 +0200211##########################################################
212# Version resources
213
214VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Vim"
215VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Vim Developers"
216VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Vim"
217VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright (C) 1996"
218VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Vi Improved - A Text Editor"
Bram Moolenaar9d591522019-05-26 20:49:42 +0200219VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VER_MAJOR}.${VER_MINOR}.${PATCHLEVEL}.0"
220VIProductVersion "${VER_MAJOR}.${VER_MINOR}.${PATCHLEVEL}.0"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100221
222# Global variables
223Var vim_dialog
224Var vim_nsd_compat
225Var vim_nsd_keymap
226Var vim_nsd_mouse
227Var vim_compat_stat
228Var vim_keymap_stat
229Var vim_mouse_stat
230
Bram Moolenaar071d4272004-06-13 20:20:40 +0000231
Bram Moolenaar5d424742018-02-04 19:11:30 +0100232# Reserve files
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100233ReserveFile ${VIMSRC}\installw32.exe
Bram Moolenaar5d424742018-02-04 19:11:30 +0100234
Bram Moolenaar071d4272004-06-13 20:20:40 +0000235##########################################################
236# Functions
237
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100238# Get parent directory
239# Share this function both on installer and uninstaller
240!macro GetParent un
241Function ${un}GetParent
Bram Moolenaar071d4272004-06-13 20:20:40 +0000242 Exch $0 ; old $0 is on top of stack
243 Push $1
244 Push $2
245 StrCpy $1 -1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100246 ${Do}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000247 StrCpy $2 $0 1 $1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100248 ${If} $2 == ""
249 ${OrIf} $2 == "\"
250 ${ExitDo}
251 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000252 IntOp $1 $1 - 1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100253 ${Loop}
254 StrCpy $0 $0 $1
255 Pop $2
256 Pop $1
257 Exch $0 ; put $0 on top of stack, restore $0 to original value
258FunctionEnd
259!macroend
260
261!insertmacro GetParent ""
262!insertmacro GetParent "un."
263
Christopher Plewrighteea0a002023-02-17 20:04:51 +0000264# Get home directory
265!macro GetHomeDir un
266Function ${un}GetHomeDir
267 Push $0
268 Push $1
269 ReadEnvStr $0 "HOME"
270 ${If} $0 == ""
271 ReadEnvStr $0 "HOMEDRIVE"
272 ReadEnvStr $1 "HOMEPATH"
273 StrCpy $0 "$0$1"
274 ${If} $0 == ""
275 ReadEnvStr $0 "USERPROFILE"
276 ${EndIf}
277 ${EndIf}
278 Pop $1
279 Exch $0 # put $0 on top of stack, restore $0 to original value
280FunctionEnd
281!macroend
282
283!insertmacro GetHomeDir ""
284!insertmacro GetHomeDir "un."
285
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100286# Check if Vim is already installed.
287# return: Installed directory. If not found, it will be empty.
288Function CheckOldVim
289 Push $0
290 Push $R0
291 Push $R1
292 Push $R2
293
294 ${If} ${RunningX64}
295 SetRegView 64
296 ${EndIf}
297
298 ClearErrors
299 StrCpy $0 "" # Installed directory
300 StrCpy $R0 0 # Sub-key index
301 StrCpy $R1 "" # Sub-key
302 ${Do}
303 # Eumerate the sub-key:
304 EnumRegKey $R1 HKLM ${UNINST_REG_KEY} $R0
305
306 # Stop if no more sub-key:
307 ${If} ${Errors}
308 ${OrIf} $R1 == ""
309 ${ExitDo}
310 ${EndIf}
311
312 # Move to the next sub-key:
313 IntOp $R0 $R0 + 1
314
315 # Check if the key is Vim uninstall key or not:
316 StrCpy $R2 $R1 4
317 ${If} $R2 S!= "Vim "
318 ${Continue}
319 ${EndIf}
320
321 # Verifies required sub-keys:
322 ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "DisplayName"
323 ${If} ${Errors}
324 ${OrIf} $R2 == ""
325 ${Continue}
326 ${EndIf}
327
328 ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "UninstallString"
329 ${If} ${Errors}
330 ${OrIf} $R2 == ""
331 ${Continue}
332 ${EndIf}
333
334 # Found
335 Push $R2
336 call GetParent
337 call GetParent
338 Pop $0 # Vim directory
339 ${ExitDo}
340
341 ${Loop}
342
343 ${If} ${RunningX64}
344 SetRegView lastused
345 ${EndIf}
346
347 Pop $R2
348 Pop $R1
349 Pop $R0
350 Exch $0 # put $0 on top of stack, restore $0 to original value
Bram Moolenaar071d4272004-06-13 20:20:40 +0000351FunctionEnd
352
Bram Moolenaar4a228972021-05-01 22:41:39 +0200353Function LaunchApplication
354 SetOutPath $0
Bram Moolenaar5f628a12021-05-02 13:59:46 +0200355 ShellExecAsUser::ShellExecAsUser "" "$0\gvim.exe" '-R "$0\README.txt"'
Bram Moolenaar4a228972021-05-01 22:41:39 +0200356FunctionEnd
357
Bram Moolenaar071d4272004-06-13 20:20:40 +0000358##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100359Section "$(str_section_old_ver)" id_section_old_ver
360 SectionIn 1 2 3 RO
361
362 # run the install program to check for already installed versions
363 SetOutPath $TEMP
364 File /oname=install.exe ${VIMSRC}\installw32.exe
365 DetailPrint "$(str_msg_uninstalling)"
366 ${Do}
367 nsExec::Exec "$TEMP\install.exe -uninstall-check"
368 Pop $3
369
370 call CheckOldVim
371 Pop $3
372 ${If} $3 == ""
373 ${ExitDo}
374 ${Else}
375 # It seems that the old version is still remaining.
376 # TODO: Should we show a warning and run the uninstaller again?
377
378 ${ExitDo} # Just ignore for now.
379 ${EndIf}
380 ${Loop}
381 Delete $TEMP\install.exe
382 Delete $TEMP\vimini.ini # install.exe creates this, but we don't need it.
383
384 # We may have been put to the background when uninstall did something.
385 BringToFront
386SectionEnd
387
388##########################################################
389Section "$(str_section_exe)" id_section_exe
Bram Moolenaar49150a42017-09-17 21:00:03 +0200390 SectionIn 1 2 3 RO
Bram Moolenaar071d4272004-06-13 20:20:40 +0000391
392 # we need also this here if the user changes the instdir
393 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
394
395 SetOutPath $0
396 File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe
Bram Moolenaarafde13b2019-04-28 19:46:49 +0200397!if /FileExists "${VIMSRC}\vim${BIT}.dll"
398 File ${VIMSRC}\vim${BIT}.dll
399!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000400 File /oname=install.exe ${VIMSRC}\installw32.exe
Bram Moolenaar30e8e732019-09-27 13:08:36 +0200401 File /oname=uninstall.exe ${VIMSRC}\uninstallw32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000402 File ${VIMSRC}\vimrun.exe
Bram Moolenaarfec246d2016-08-28 18:47:14 +0200403 File /oname=tee.exe ${VIMSRC}\teew32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000404 File /oname=xxd.exe ${VIMSRC}\xxdw32.exe
Bram Moolenaar19166732018-12-21 17:59:33 +0100405 File ..\vimtutor.bat
406 File ..\README.txt
Bram Moolenaar30e8e732019-09-27 13:08:36 +0200407 File ..\uninstall.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000408 File ${VIMRT}\*.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000409
RestorerZ2680a072024-03-20 20:15:51 +0100410!if /FileExists "${VIMTOOLS}\diff.exe"
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200411 File ${VIMTOOLS}\diff.exe
RestorerZ2680a072024-03-20 20:15:51 +0100412!endif
413!if /FileExists "${VIMTOOLS}\winpty${BIT}.dll"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100414 File ${VIMTOOLS}\winpty${BIT}.dll
RestorerZ2680a072024-03-20 20:15:51 +0100415!endif
416!if /FileExists "${VIMTOOLS}\winpty-agent.exe"
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200417 File ${VIMTOOLS}\winpty-agent.exe
RestorerZ2680a072024-03-20 20:15:51 +0100418!endif
419!if /FileExists "${VIMTOOLS}\libsodium.dll"
420 File ${VIMTOOLS}\libsodium.dll
421!endif
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200422
Bram Moolenaar071d4272004-06-13 20:20:40 +0000423 SetOutPath $0\colors
K.Takata44b9abb2022-08-24 18:08:00 +0100424 File /r ${VIMRT}\colors\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000425
426 SetOutPath $0\compiler
427 File ${VIMRT}\compiler\*.*
428
429 SetOutPath $0\doc
RestorerZ2680a072024-03-20 20:15:51 +0100430 File /x uganda.nsis.txt ${VIMRT}\doc\*.txt
Bram Moolenaar071d4272004-06-13 20:20:40 +0000431 File ${VIMRT}\doc\tags
432
433 SetOutPath $0\ftplugin
434 File ${VIMRT}\ftplugin\*.*
435
436 SetOutPath $0\indent
RestorerZ2680a072024-03-20 20:15:51 +0100437 File ${VIMRT}\indent\README.txt
438 File ${VIMRT}\indent\*.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000439
Ken Takata1a9aba82024-01-16 17:14:29 +0100440 SetOutPath $0\keymap
RestorerZ2680a072024-03-20 20:15:51 +0100441 File ${VIMRT}\keymap\README.txt
442 File ${VIMRT}\keymap\*.vim
Ken Takata1a9aba82024-01-16 17:14:29 +0100443
Bram Moolenaar071d4272004-06-13 20:20:40 +0000444 SetOutPath $0\macros
RestorerZ2680a072024-03-20 20:15:51 +0100445 File /r /x *.info ${VIMRT}\macros\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000446
Bram Moolenaar6a95c882019-03-26 23:02:46 +0100447 SetOutPath $0\pack
448 File /r ${VIMRT}\pack\*.*
Bram Moolenaar38623c82018-05-10 21:24:35 +0200449
Bram Moolenaar071d4272004-06-13 20:20:40 +0000450 SetOutPath $0\plugin
451 File ${VIMRT}\plugin\*.*
452
Bram Moolenaar7fcab2a2006-03-25 21:46:12 +0000453 SetOutPath $0\autoload
K.Takata44b9abb2022-08-24 18:08:00 +0100454 File /r ${VIMRT}\autoload\*.*
Bram Moolenaar18144c82006-04-12 21:52:12 +0000455
Bram Moolenaar44433da2022-05-06 18:08:52 +0100456 SetOutPath $0\import\dist
457 File ${VIMRT}\import\dist\*.*
458
Christian Brabandt176711f2022-03-11 15:24:11 +0000459 SetOutPath $0\bitmaps
460 File ${VIMSRC}\vim.ico
461
Bram Moolenaar071d4272004-06-13 20:20:40 +0000462 SetOutPath $0\syntax
RestorerZ2680a072024-03-20 20:15:51 +0100463 File /r /x testdir /x generator /x Makefile ${VIMRT}\syntax\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000464
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000465 SetOutPath $0\spell
466 File ${VIMRT}\spell\*.txt
467 File ${VIMRT}\spell\*.vim
468 File ${VIMRT}\spell\*.spl
469 File ${VIMRT}\spell\*.sug
470
Bram Moolenaar071d4272004-06-13 20:20:40 +0000471 SetOutPath $0\tools
472 File ${VIMRT}\tools\*.*
473
474 SetOutPath $0\tutor
RestorerZ2680a072024-03-20 20:15:51 +0100475 File /x Makefile /x *.info ${VIMRT}\tutor\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000476SectionEnd
477
478##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100479Section "$(str_section_console)" id_section_console
Bram Moolenaar071d4272004-06-13 20:20:40 +0000480 SectionIn 1 3
481
482 SetOutPath $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100483 File /oname=vim.exe ${VIMSRC}\vimw32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000484 StrCpy $2 "$2 vim view vimdiff"
485SectionEnd
486
487##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100488Section "$(str_section_batch)" id_section_batch
Bram Moolenaar071d4272004-06-13 20:20:40 +0000489 SectionIn 3
490
491 StrCpy $1 "$1 -create-batfiles $2"
492SectionEnd
493
494##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100495SectionGroup $(str_group_icons) id_group_icons
496 Section "$(str_section_desktop)" id_section_desktop
497 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000498
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100499 StrCpy $1 "$1 -install-icons"
500 SectionEnd
501
502 Section "$(str_section_start_menu)" id_section_startmenu
503 SectionIn 1 3
504
505 StrCpy $1 "$1 -add-start-menu"
506 SectionEnd
507SectionGroupEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000508
509##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100510Section "$(str_section_edit_with)" id_section_editwith
Bram Moolenaar071d4272004-06-13 20:20:40 +0000511 SectionIn 1 3
512
Bram Moolenaar071d4272004-06-13 20:20:40 +0000513 SetOutPath $0
Bram Moolenaar6199d432017-10-14 19:05:44 +0200514
Bram Moolenaar442b4222010-05-24 21:34:22 +0200515 ${If} ${RunningX64}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200516 # Install 64-bit gvimext.dll into the GvimExt64 directory.
517 SetOutPath $0\GvimExt64
518 ClearErrors
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100519 !define LIBRARY_SHELL_EXTENSION
520 !define LIBRARY_X64
521 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
522 "${VIMSRC}\GvimExt\gvimext64.dll" \
523 "$0\GvimExt64\gvimext.dll" "$0"
524 !undef LIBRARY_X64
525 !undef LIBRARY_SHELL_EXTENSION
Bram Moolenaar442b4222010-05-24 21:34:22 +0200526 ${EndIf}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200527
Bram Moolenaar6199d432017-10-14 19:05:44 +0200528 # Install 32-bit gvimext.dll into the GvimExt32 directory.
529 SetOutPath $0\GvimExt32
530 ClearErrors
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100531 !define LIBRARY_SHELL_EXTENSION
532 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
533 "${VIMSRC}\GvimExt\gvimext.dll" \
534 "$0\GvimExt32\gvimext.dll" "$0"
535 !undef LIBRARY_SHELL_EXTENSION
Bram Moolenaar071d4272004-06-13 20:20:40 +0000536
537 # We don't have a separate entry for the "Open With..." menu, assume
538 # the user wants either both or none.
539 StrCpy $1 "$1 -install-popup -install-openwith"
540SectionEnd
541
542##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100543Section "$(str_section_vim_rc)" id_section_vimrc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000544 SectionIn 1 3
545
546 StrCpy $1 "$1 -create-vimrc"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100547
548 ${If} ${RunningX64}
549 SetRegView 64
550 ${EndIf}
551 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_compat" "$vim_compat_stat"
552 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_keyremap" "$vim_keymap_stat"
553 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_mouse" "$vim_mouse_stat"
554 ${If} ${RunningX64}
555 SetRegView lastused
556 ${EndIf}
557
558 ${If} $vim_compat_stat == "vi"
559 StrCpy $1 "$1 -vimrc-compat vi"
560 ${ElseIf} $vim_compat_stat == "vim"
561 StrCpy $1 "$1 -vimrc-compat vim"
562 ${ElseIf} $vim_compat_stat == "defaults"
563 StrCpy $1 "$1 -vimrc-compat defaults"
564 ${Else}
565 StrCpy $1 "$1 -vimrc-compat all"
566 ${EndIf}
567
568 ${If} $vim_keymap_stat == "default"
569 StrCpy $1 "$1 -vimrc-remap no"
570 ${Else}
571 StrCpy $1 "$1 -vimrc-remap win"
572 ${EndIf}
573
574 ${If} $vim_mouse_stat == "default"
575 StrCpy $1 "$1 -vimrc-behave default"
576 ${ElseIf} $vim_mouse_stat == "windows"
577 StrCpy $1 "$1 -vimrc-behave mswin"
578 ${Else}
579 StrCpy $1 "$1 -vimrc-behave unix"
580 ${EndIf}
581
Bram Moolenaar071d4272004-06-13 20:20:40 +0000582SectionEnd
583
584##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100585SectionGroup $(str_group_plugin) id_group_plugin
586 Section "$(str_section_plugin_home)" id_section_pluginhome
587 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000588
Christopher Plewrighteea0a002023-02-17 20:04:51 +0000589 # use ShellExecAsUser below instead
590 # StrCpy $1 "$1 -create-directories home"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100591 SectionEnd
592
593 Section "$(str_section_plugin_vim)" id_section_pluginvim
594 SectionIn 3
595
596 StrCpy $1 "$1 -create-directories vim"
597 SectionEnd
598SectionGroupEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000599
600##########################################################
Bram Moolenaar071d4272004-06-13 20:20:40 +0000601!ifdef HAVE_NLS
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100602Section "$(str_section_nls)" id_section_nls
603 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000604
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100605 SetOutPath $0\lang
RestorerZ2680a072024-03-20 20:15:51 +0100606 File /r /x Makefile ${VIMRT}\lang\*.*
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100607 SetOutPath $0
608 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
609 "${GETTEXT}\gettext${BIT}\libintl-8.dll" \
610 "$0\libintl-8.dll" "$0"
611 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
612 "${GETTEXT}\gettext${BIT}\libiconv-2.dll" \
613 "$0\libiconv-2.dll" "$0"
614 !if /FileExists "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll"
615 # Install libgcc_s_sjlj-1.dll only if it is needed.
616 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
617 "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll" \
618 "$0\libgcc_s_sjlj-1.dll" "$0"
619 !endif
620
621 ${If} ${SectionIsSelected} ${id_section_editwith}
622 ${If} ${RunningX64}
623 # Install DLLs for 64-bit gvimext.dll into the GvimExt64 directory.
624 SetOutPath $0\GvimExt64
625 ClearErrors
626 !define LIBRARY_X64
627 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
628 "${GETTEXT}\gettext64\libintl-8.dll" \
629 "$0\GvimExt64\libintl-8.dll" "$0\GvimExt64"
630 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
631 "${GETTEXT}\gettext64\libiconv-2.dll" \
632 "$0\GvimExt64\libiconv-2.dll" "$0\GvimExt64"
633 !undef LIBRARY_X64
634 ${EndIf}
635
636 # Install DLLs for 32-bit gvimext.dll into the GvimExt32 directory.
637 SetOutPath $0\GvimExt32
638 ClearErrors
639 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
640 "${GETTEXT}\gettext32\libintl-8.dll" \
641 "$0\GvimExt32\libintl-8.dll" "$0\GvimExt32"
642 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
643 "${GETTEXT}\gettext32\libiconv-2.dll" \
644 "$0\GvimExt32\libiconv-2.dll" "$0\GvimExt32"
645 !if /FileExists "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll"
646 # Install libgcc_s_sjlj-1.dll only if it is needed.
647 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
648 "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll" \
649 "$0\GvimExt32\libgcc_s_sjlj-1.dll" "$0\GvimExt32"
650 !endif
651 ${EndIf}
652SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000653!endif
654
655##########################################################
656Section -call_install_exe
657 SetOutPath $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100658 DetailPrint "$(str_msg_registering)"
659 nsExec::Exec "$0\install.exe $1"
660 Pop $3
Christopher Plewrighteea0a002023-02-17 20:04:51 +0000661
662 ${If} ${SectionIsSelected} ${id_section_pluginhome}
663 ReadEnvStr $3 "COMSPEC"
664 Call GetHomeDir
665 Pop $4
666 ShellExecAsUser::ShellExecAsUser "" "$3" '/c "cd /d "$4" & mkdir vimfiles & cd vimfiles & mkdir colors compiler doc ftdetect ftplugin indent keymap plugin syntax"' SW_HIDE
667 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000668SectionEnd
669
670##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100671!macro SaveSectionSelection section_id reg_value
672 ${If} ${SectionIsSelected} ${section_id}
673 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 1
674 ${Else}
675 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 0
676 ${EndIf}
677!macroend
678
Bram Moolenaar071d4272004-06-13 20:20:40 +0000679Section -post
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100680
681 # Get estimated install size
682 SectionGetSize ${id_section_exe} $3
683 ${If} ${SectionIsSelected} ${id_section_console}
684 SectionGetSize ${id_section_console} $4
685 IntOp $3 $3 + $4
686 ${EndIf}
687 ${If} ${SectionIsSelected} ${id_section_editwith}
688 SectionGetSize ${id_section_editwith} $4
689 IntOp $3 $3 + $4
690 ${EndIf}
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100691!ifdef HAVE_NLS
692 ${If} ${SectionIsSelected} ${id_section_nls}
693 SectionGetSize ${id_section_nls} $4
694 IntOp $3 $3 + $4
695 ${EndIf}
696!endif
697
698 # Register EstimatedSize and AllowSilent.
699 # Other information will be set by the install.exe (dosinst.c).
700 ${If} ${RunningX64}
701 SetRegView 64
702 ${EndIf}
703 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "EstimatedSize" $3
704 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "AllowSilent" 1
705 ${If} ${RunningX64}
706 SetRegView lastused
707 ${EndIf}
708
709 # Store the selections to the registry.
710 ${If} ${RunningX64}
711 SetRegView 64
712 ${EndIf}
713 !insertmacro SaveSectionSelection ${id_section_console} "select_console"
714 !insertmacro SaveSectionSelection ${id_section_batch} "select_batch"
715 !insertmacro SaveSectionSelection ${id_section_desktop} "select_desktop"
716 !insertmacro SaveSectionSelection ${id_section_startmenu} "select_startmenu"
717 !insertmacro SaveSectionSelection ${id_section_editwith} "select_editwith"
718 !insertmacro SaveSectionSelection ${id_section_vimrc} "select_vimrc"
719 !insertmacro SaveSectionSelection ${id_section_pluginhome} "select_pluginhome"
720 !insertmacro SaveSectionSelection ${id_section_pluginvim} "select_pluginvim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100721!ifdef HAVE_NLS
722 !insertmacro SaveSectionSelection ${id_section_nls} "select_nls"
723!endif
724 ${If} ${RunningX64}
725 SetRegView lastused
726 ${EndIf}
727
Bram Moolenaar071d4272004-06-13 20:20:40 +0000728 BringToFront
729SectionEnd
730
731##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100732!macro LoadSectionSelection section_id reg_value
733 ClearErrors
734 ReadRegDWORD $3 HKLM "${UNINST_REG_KEY_VIM}" ${reg_value}
735 ${IfNot} ${Errors}
736 ${If} $3 = 1
737 !insertmacro SelectSection ${section_id}
738 ${Else}
739 !insertmacro UnselectSection ${section_id}
740 ${EndIf}
741 ${EndIf}
742!macroend
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200743
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200744!macro LoadDefaultVimrc out_var reg_value default_value
745 ClearErrors
746 ReadRegStr ${out_var} HKLM "${UNINST_REG_KEY_VIM}" ${reg_value}
747 ${If} ${Errors}
748 ${OrIf} ${out_var} == ""
749 StrCpy ${out_var} ${default_value}
750 ${EndIf}
751!macroend
752
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100753Function .onInit
754!ifdef HAVE_MULTI_LANG
755 # Select a language (or read from the registry).
756 !insertmacro MUI_LANGDLL_DISPLAY
757!endif
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200758
Christian Brabandt7d603842021-07-24 21:19:42 +0200759 ${If} $INSTDIR == ${DEFAULT_INSTDIR}
760 # Check $VIM
761 ReadEnvStr $3 "VIM"
762 ${If} $3 != ""
763 StrCpy $INSTDIR $3
764 ${EndIf}
765 ${EndIf}
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100766
767 call CheckOldVim
768 Pop $3
769 ${If} $3 == ""
770 # No old versions of Vim found. Unselect and hide the section.
771 !insertmacro UnselectSection ${id_section_old_ver}
772 SectionSetInstTypes ${id_section_old_ver} 0
773 SectionSetText ${id_section_old_ver} ""
774 ${Else}
Christian Brabandt7d603842021-07-24 21:19:42 +0200775 ${If} $INSTDIR == ${DEFAULT_INSTDIR}
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100776 StrCpy $INSTDIR $3
777 ${EndIf}
778 ${EndIf}
779
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100780 ${If} ${RunningX64}
781 SetRegView 64
782 ${EndIf}
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200783 # Load the selections from the registry (if any).
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100784 !insertmacro LoadSectionSelection ${id_section_console} "select_console"
785 !insertmacro LoadSectionSelection ${id_section_batch} "select_batch"
786 !insertmacro LoadSectionSelection ${id_section_desktop} "select_desktop"
787 !insertmacro LoadSectionSelection ${id_section_startmenu} "select_startmenu"
788 !insertmacro LoadSectionSelection ${id_section_editwith} "select_editwith"
789 !insertmacro LoadSectionSelection ${id_section_vimrc} "select_vimrc"
790 !insertmacro LoadSectionSelection ${id_section_pluginhome} "select_pluginhome"
791 !insertmacro LoadSectionSelection ${id_section_pluginvim} "select_pluginvim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100792!ifdef HAVE_NLS
793 !insertmacro LoadSectionSelection ${id_section_nls} "select_nls"
794!endif
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200795 # Load the default _vimrc settings from the registry (if any).
796 !insertmacro LoadDefaultVimrc $vim_compat_stat "vim_compat" "all"
797 !insertmacro LoadDefaultVimrc $vim_keymap_stat "vim_keyremap" "default"
798 !insertmacro LoadDefaultVimrc $vim_mouse_stat "vim_mouse" "default"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100799 ${If} ${RunningX64}
800 SetRegView lastused
801 ${EndIf}
802
803 # User variables:
804 # $0 - holds the directory the executables are installed to
805 # $1 - holds the parameters to be passed to install.exe. Starts with OLE
806 # registration (since a non-OLE gvim will not complain, and we want to
807 # always register an OLE gvim).
808 # $2 - holds the names to create batch files for
809 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
810 StrCpy $1 "-register-OLE"
811 StrCpy $2 "gvim evim gview gvimdiff vimtutor"
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200812FunctionEnd
813
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100814Function .onInstSuccess
815 WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe
816FunctionEnd
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200817
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100818Function .onInstFailed
819 MessageBox MB_OK|MB_ICONEXCLAMATION "$(str_msg_install_fail)" /SD IDOK
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200820FunctionEnd
821
822##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100823Function SetCustom
824 # Display the _vimrc setting dialog using nsDialogs.
825
826 # Check if a _vimrc should be created
827 ${IfNot} ${SectionIsSelected} ${id_section_vimrc}
828 Abort
829 ${EndIf}
830
831 !insertmacro MUI_HEADER_TEXT \
832 $(str_vimrc_page_title) $(str_vimrc_page_subtitle)
833
834 nsDialogs::Create 1018
835 Pop $vim_dialog
836
837 ${If} $vim_dialog == error
838 Abort
839 ${EndIf}
840
841 ${If} ${RunningX64}
842 SetRegView 64
843 ${EndIf}
844
845 GetFunctionAddress $3 ValidateCustom
846 nsDialogs::OnBack $3
847
848
849 # 1st group - Compatibility
850 ${NSD_CreateGroupBox} 0 0 100% 32% $(str_msg_compat_title)
851 Pop $3
852
853 ${NSD_CreateLabel} 5% 10% 35% 8% $(str_msg_compat_desc)
854 Pop $3
855 ${NSD_CreateDropList} 18% 19% 75% 8% ""
856 Pop $vim_nsd_compat
857 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vi)
858 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vim)
859 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_defaults)
860 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_all)
861
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200862 ${If} $vim_compat_stat == "defaults"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100863 StrCpy $4 2
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200864 ${ElseIf} $vim_compat_stat == "vim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100865 StrCpy $4 1
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200866 ${ElseIf} $vim_compat_stat == "vi"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100867 StrCpy $4 0
868 ${Else} # default
869 StrCpy $4 3
870 ${EndIf}
871 ${NSD_CB_SetSelectionIndex} $vim_nsd_compat $4
872
873
874 # 2nd group - Key remapping
875 ${NSD_CreateGroupBox} 0 35% 100% 31% $(str_msg_keymap_title)
876 Pop $3
877
878 ${NSD_CreateLabel} 5% 45% 90% 8% $(str_msg_keymap_desc)
879 Pop $3
880 ${NSD_CreateDropList} 38% 54% 55% 8% ""
881 Pop $vim_nsd_keymap
882 ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_default)
883 ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_windows)
884
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200885 ${If} $vim_keymap_stat == "windows"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100886 StrCpy $4 1
887 ${Else} # default
888 StrCpy $4 0
889 ${EndIf}
890 ${NSD_CB_SetSelectionIndex} $vim_nsd_keymap $4
891
892
893 # 3rd group - Mouse behavior
894 ${NSD_CreateGroupBox} 0 69% 100% 31% $(str_msg_mouse_title)
895 Pop $3
896
897 ${NSD_CreateLabel} 5% 79% 90% 8% $(str_msg_mouse_desc)
898 Pop $3
899 ${NSD_CreateDropList} 23% 87% 70% 8% ""
900 Pop $vim_nsd_mouse
901 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_default)
902 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_windows)
903 ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_unix)
904
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200905 ${If} $vim_mouse_stat == "xterm"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100906 StrCpy $4 2
Bram Moolenaarceb56dd2020-07-14 22:24:40 +0200907 ${ElseIf} $vim_mouse_stat == "windows"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100908 StrCpy $4 1
909 ${Else} # default
910 StrCpy $4 0
911 ${EndIf}
912 ${NSD_CB_SetSelectionIndex} $vim_nsd_mouse $4
913
914 ${If} ${RunningX64}
915 SetRegView lastused
916 ${EndIf}
917
918 nsDialogs::Show
919FunctionEnd
920
921Function ValidateCustom
922 ${NSD_CB_GetSelectionIndex} $vim_nsd_compat $3
923 ${If} $3 = 0
924 StrCpy $vim_compat_stat "vi"
925 ${ElseIf} $3 = 1
926 StrCpy $vim_compat_stat "vim"
927 ${ElseIf} $3 = 2
928 StrCpy $vim_compat_stat "defaults"
929 ${Else}
930 StrCpy $vim_compat_stat "all"
931 ${EndIf}
932
933 ${NSD_CB_GetSelectionIndex} $vim_nsd_keymap $3
934 ${If} $3 = 0
935 StrCpy $vim_keymap_stat "default"
936 ${Else}
937 StrCpy $vim_keymap_stat "windows"
938 ${EndIf}
939
940 ${NSD_CB_GetSelectionIndex} $vim_nsd_mouse $3
941 ${If} $3 = 0
942 StrCpy $vim_mouse_stat "default"
943 ${ElseIf} $3 = 1
944 StrCpy $vim_mouse_stat "windows"
945 ${Else}
946 StrCpy $vim_mouse_stat "xterm"
947 ${EndIf}
948FunctionEnd
949
950##########################################################
951# Description for Installer Sections
952
953!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
954 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_old_ver} $(str_desc_old_ver)
955 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_exe} $(str_desc_exe)
956 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_console} $(str_desc_console)
957 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_batch} $(str_desc_batch)
958 !insertmacro MUI_DESCRIPTION_TEXT ${id_group_icons} $(str_desc_icons)
959 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_desktop} $(str_desc_desktop)
960 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_startmenu} $(str_desc_start_menu)
961 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_editwith} $(str_desc_edit_with)
962 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_vimrc} $(str_desc_vim_rc)
963 !insertmacro MUI_DESCRIPTION_TEXT ${id_group_plugin} $(str_desc_plugin)
964 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginhome} $(str_desc_plugin_home)
965 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginvim} $(str_desc_plugin_vim)
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100966!ifdef HAVE_NLS
967 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_nls} $(str_desc_nls)
968!endif
969!insertmacro MUI_FUNCTION_DESCRIPTION_END
970
971
972##########################################################
973# Uninstaller Functions and Sections
974
975Function un.onInit
976!ifdef HAVE_MULTI_LANG
977 # Get the language from the registry.
978 !insertmacro MUI_UNGETLANGUAGE
979!endif
980FunctionEnd
981
982Section "un.$(str_unsection_register)" id_unsection_register
983 SectionIn RO
984
Bram Moolenaar071d4272004-06-13 20:20:40 +0000985 # Apparently $INSTDIR is set to the directory where the uninstaller is
RestorerZ2680a072024-03-20 20:15:51 +0100986 # created. Thus the "vim91" directory is included in it.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000987 StrCpy $0 "$INSTDIR"
988
Bram Moolenaar071d4272004-06-13 20:20:40 +0000989 # delete the context menu entry and batch files
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100990 DetailPrint "$(str_msg_unregistering)"
Bram Moolenaar30e8e732019-09-27 13:08:36 +0200991 nsExec::Exec "$0\uninstall.exe -nsis"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100992 Pop $3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000993
994 # We may have been put to the background when uninstall did something.
995 BringToFront
996
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100997 # Delete the installer language setting.
998 DeleteRegKey ${MUI_LANGDLL_REGISTRY_ROOT} ${MUI_LANGDLL_REGISTRY_KEY}
999SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +00001000
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001001Section "un.$(str_unsection_exe)" id_unsection_exe
1002
1003 StrCpy $0 "$INSTDIR"
1004
1005 # Delete gettext and iconv DLLs
1006 ${If} ${FileExists} "$0\libiconv-2.dll"
1007 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1008 "$0\libiconv-2.dll"
Bram Moolenaar6199d432017-10-14 19:05:44 +02001009 ${EndIf}
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001010 ${If} ${FileExists} "$0\libintl-8.dll"
1011 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1012 "$0\libintl-8.dll"
1013 ${EndIf}
1014 ${If} ${FileExists} "$0\libgcc_s_sjlj-1.dll"
1015 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1016 "$0\libgcc_s_sjlj-1.dll"
1017 ${EndIf}
1018
1019 # Delete other DLLs
1020 Delete /REBOOTOK $0\*.dll
1021
1022 # Delete 64-bit GvimExt
1023 ${If} ${RunningX64}
1024 !define LIBRARY_X64
1025 ${If} ${FileExists} "$0\GvimExt64\gvimext.dll"
1026 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1027 "$0\GvimExt64\gvimext.dll"
1028 ${EndIf}
1029 ${If} ${FileExists} "$0\GvimExt64\libiconv-2.dll"
1030 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1031 "$0\GvimExt64\libiconv-2.dll"
1032 ${EndIf}
1033 ${If} ${FileExists} "$0\GvimExt64\libintl-8.dll"
1034 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1035 "$0\GvimExt64\libintl-8.dll"
1036 ${EndIf}
1037 ${If} ${FileExists} "$0\GvimExt64\libwinpthread-1.dll"
1038 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1039 "$0\GvimExt64\libwinpthread-1.dll"
1040 ${EndIf}
1041 !undef LIBRARY_X64
1042 RMDir /r $0\GvimExt64
1043 ${EndIf}
1044
1045 # Delete 32-bit GvimExt
1046 ${If} ${FileExists} "$0\GvimExt32\gvimext.dll"
1047 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1048 "$0\GvimExt32\gvimext.dll"
1049 ${EndIf}
1050 ${If} ${FileExists} "$0\GvimExt32\libiconv-2.dll"
1051 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1052 "$0\GvimExt32\libiconv-2.dll"
1053 ${EndIf}
1054 ${If} ${FileExists} "$0\GvimExt32\libintl-8.dll"
1055 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1056 "$0\GvimExt32\libintl-8.dll"
1057 ${EndIf}
1058 ${If} ${FileExists} "$0\GvimExt32\libgcc_s_sjlj-1.dll"
1059 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1060 "$0\GvimExt32\libgcc_s_sjlj-1.dll"
1061 ${EndIf}
1062 RMDir /r $0\GvimExt32
Bram Moolenaar6199d432017-10-14 19:05:44 +02001063
Bram Moolenaar071d4272004-06-13 20:20:40 +00001064 ClearErrors
1065 # Remove everything but *.dll files. Avoids that
1066 # a lot remains when gvimext.dll cannot be deleted.
Bram Moolenaar408b5852006-05-13 10:44:07 +00001067 RMDir /r $0\autoload
Bram Moolenaar071d4272004-06-13 20:20:40 +00001068 RMDir /r $0\colors
1069 RMDir /r $0\compiler
1070 RMDir /r $0\doc
1071 RMDir /r $0\ftplugin
Bram Moolenaar44433da2022-05-06 18:08:52 +01001072 RMDir /r $0\import
Bram Moolenaar071d4272004-06-13 20:20:40 +00001073 RMDir /r $0\indent
1074 RMDir /r $0\macros
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001075 RMDir /r $0\pack
Bram Moolenaar071d4272004-06-13 20:20:40 +00001076 RMDir /r $0\plugin
Bram Moolenaar408b5852006-05-13 10:44:07 +00001077 RMDir /r $0\spell
Bram Moolenaar071d4272004-06-13 20:20:40 +00001078 RMDir /r $0\syntax
1079 RMDir /r $0\tools
1080 RMDir /r $0\tutor
Bram Moolenaar071d4272004-06-13 20:20:40 +00001081 RMDir /r $0\lang
1082 RMDir /r $0\keymap
RestorerZ2680a072024-03-20 20:15:51 +01001083 RMDir /r $0\bitmaps
Bram Moolenaar071d4272004-06-13 20:20:40 +00001084 Delete $0\*.exe
1085 Delete $0\*.bat
1086 Delete $0\*.vim
1087 Delete $0\*.txt
1088
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001089 ${If} ${Errors}
1090 MessageBox MB_OK|MB_ICONEXCLAMATION $(str_msg_rm_exe_fail) /SD IDOK
1091 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +00001092
RestorerZ2680a072024-03-20 20:15:51 +01001093 # No error message if the "vim91" directory can't be removed, the
Bram Moolenaar071d4272004-06-13 20:20:40 +00001094 # gvimext.dll may still be there.
1095 RMDir $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001096SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +00001097
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001098# Remove "vimfiles" directory under the specified directory.
1099!macro RemoveVimfiles dir
RestorerZ2680a072024-03-20 20:15:51 +01001100 ${If} ${FileExists} ${dir}\_viminfo
1101 Delete ${dir}\_viminfo
1102 ${EndIf}
1103 ${If} ${DirExists} ${dir}\vimfiles
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001104 RMDir ${dir}\vimfiles\colors
1105 RMDir ${dir}\vimfiles\compiler
1106 RMDir ${dir}\vimfiles\doc
1107 RMDir ${dir}\vimfiles\ftdetect
1108 RMDir ${dir}\vimfiles\ftplugin
1109 RMDir ${dir}\vimfiles\indent
1110 RMDir ${dir}\vimfiles\keymap
1111 RMDir ${dir}\vimfiles\plugin
1112 RMDir ${dir}\vimfiles\syntax
RestorerZ2680a072024-03-20 20:15:51 +01001113 ${If} ${FileExists} ${dir}\vimfiles\.netrwhist*
1114 Delete ${dir}\vimfiles\.netrwhist*
1115 ${EndIf}
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001116 RMDir ${dir}\vimfiles
1117 ${EndIf}
1118!macroend
1119
1120SectionGroup "un.$(str_ungroup_plugin)" id_ungroup_plugin
1121 Section /o "un.$(str_unsection_plugin_home)" id_unsection_plugin_home
1122 # get the home dir
Christopher Plewrighteea0a002023-02-17 20:04:51 +00001123 Call un.GetHomeDir
1124 Pop $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001125
1126 ${If} $0 != ""
1127 !insertmacro RemoveVimfiles $0
1128 ${EndIf}
1129 SectionEnd
1130
1131 Section "un.$(str_unsection_plugin_vim)" id_unsection_plugin_vim
1132 # get the parent dir of the installation
1133 Push $INSTDIR
1134 Call un.GetParent
1135 Pop $0
1136
1137 # if a plugin dir was created at installation remove it
1138 !insertmacro RemoveVimfiles $0
1139 SectionEnd
1140SectionGroupEnd
1141
1142Section "un.$(str_unsection_rootdir)" id_unsection_rootdir
Bram Moolenaar071d4272004-06-13 20:20:40 +00001143 # get the parent dir of the installation
1144 Push $INSTDIR
1145 Call un.GetParent
1146 Pop $0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001147
Bram Moolenaara8d22e32019-04-12 21:29:33 +02001148 ${IfNot} ${Silent}
1149 Delete $0\_vimrc
1150 ${Endif}
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001151 RMDir $0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001152SectionEnd
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001153
1154##########################################################
1155# Description for Uninstaller Sections
1156
1157!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
1158 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_register} $(str_desc_unregister)
1159 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_exe} $(str_desc_rm_exe)
1160 !insertmacro MUI_DESCRIPTION_TEXT ${id_ungroup_plugin} $(str_desc_rm_plugin)
1161 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_home} $(str_desc_rm_plugin_home)
1162 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_vim} $(str_desc_rm_plugin_vim)
1163 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_rootdir} $(str_desc_rm_rootdir)
1164!insertmacro MUI_UNFUNCTION_DESCRIPTION_END