blob: 12a55bb611a584259b843bc835babda9c683730c [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001# NSIS file to create a self-installing exe for Vim.
Bram Moolenaaraf610b82018-12-21 16:22:50 +01002# It requires NSIS version 3.0 or later.
Bram Moolenaar04344822014-11-05 18:18:17 +01003# Last Change: 2014 Nov 5
Bram Moolenaar071d4272004-06-13 20:20:40 +00004
Bram Moolenaaraf610b82018-12-21 16:22:50 +01005Unicode true
6
Bram Moolenaar071d4272004-06-13 20:20:40 +00007# WARNING: if you make changes to this script, look out for $0 to be valid,
8# because uninstall deletes most files in $0.
9
Bram Moolenaarba460752013-07-04 22:35:01 +020010# Location of gvim_ole.exe, vimw32.exe, GvimExt/*, etc.
Bram Moolenaar286eacd2016-01-16 18:05:50 +010011!ifndef VIMSRC
12 !define VIMSRC "..\src"
13!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000014
15# Location of runtime files
Bram Moolenaar286eacd2016-01-16 18:05:50 +010016!ifndef VIMRT
17 !define VIMRT ".."
18!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000019
20# Location of extra tools: diff.exe
Bram Moolenaar286eacd2016-01-16 18:05:50 +010021!ifndef VIMTOOLS
22 !define VIMTOOLS ..\..
23!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000024
Bram Moolenaar6199d432017-10-14 19:05:44 +020025# Location of gettext.
26# It must contain two directories: gettext32 and gettext64.
27# See README.txt for detail.
28!ifndef GETTEXT
29 !define GETTEXT ${VIMRT}
30!endif
31
Bram Moolenaar071d4272004-06-13 20:20:40 +000032# Comment the next line if you don't have UPX.
Bram Moolenaar6199d432017-10-14 19:05:44 +020033# Get it at https://upx.github.io/
Bram Moolenaar071d4272004-06-13 20:20:40 +000034!define HAVE_UPX
35
Bram Moolenaaraf610b82018-12-21 16:22:50 +010036# Comment the next line if you do not want to add Native Language Support
Bram Moolenaar071d4272004-06-13 20:20:40 +000037!define HAVE_NLS
38
Bram Moolenaaraf610b82018-12-21 16:22:50 +010039# Uncomment the next line if you want to include VisVim extension:
40#!define HAVE_VIS_VIM
41
42# Comment the following line to create a multilanguage installer:
43!define HAVE_MULTI_LANG
44
45# Uncomment the next line if you want to create a 64-bit installer.
46#!define WIN64
47
Bram Moolenaar6c7b4442016-01-02 15:44:32 +010048!include gvim_version.nsh # for version number
Bram Moolenaar071d4272004-06-13 20:20:40 +000049
50# ----------- No configurable settings below this line -----------
51
Bram Moolenaaraf610b82018-12-21 16:22:50 +010052!include "Library.nsh" # For DLL install
53!ifdef HAVE_VIS_VIM
54 !include "UpgradeDLL.nsh" # for VisVim.dll
55!endif
56!include "LogicLib.nsh"
57!include "MUI2.nsh"
58!include "nsDialogs.nsh"
59!include "Sections.nsh"
60!include "x64.nsh"
Bram Moolenaar071d4272004-06-13 20:20:40 +000061
Bram Moolenaaraf610b82018-12-21 16:22:50 +010062!define PRODUCT "Vim ${VER_MAJOR}.${VER_MINOR}"
63!define UNINST_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall"
64!define UNINST_REG_KEY_VIM "${UNINST_REG_KEY}\${PRODUCT}"
65
66!ifdef WIN64
67Name "${PRODUCT} (x64)"
68!else
69Name "${PRODUCT}"
70!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000071OutFile gvim${VER_MAJOR}${VER_MINOR}.exe
72CRCCheck force
Bram Moolenaar286eacd2016-01-16 18:05:50 +010073SetCompressor /SOLID lzma
Bram Moolenaaraf610b82018-12-21 16:22:50 +010074SetCompressorDictSize 64
75ManifestDPIAware true
Bram Moolenaar071d4272004-06-13 20:20:40 +000076SetDatablockOptimize on
Bram Moolenaar442b4222010-05-24 21:34:22 +020077RequestExecutionLevel highest
Bram Moolenaar071d4272004-06-13 20:20:40 +000078
79!ifdef HAVE_UPX
80 !packhdr temp.dat "upx --best --compress-icons=1 temp.dat"
81!endif
82
Bram Moolenaaraf610b82018-12-21 16:22:50 +010083!ifdef WIN64
84!define BIT 64
85!else
86!define BIT 32
87!endif
88
89##########################################################
90# MUI2 settings
91
92!define MUI_ABORTWARNING
93!define MUI_UNABORTWARNING
94
95!define MUI_ICON "icons\vim_16c.ico"
96!define MUI_UNICON "icons\vim_uninst_16c.ico"
97
98# Show all languages, despite user's codepage:
99!define MUI_LANGDLL_ALLLANGUAGES
100!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
101!define MUI_LANGDLL_REGISTRY_KEY "Software\Vim"
102!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
103
104!define MUI_WELCOMEFINISHPAGE_BITMAP "icons\welcome.bmp"
105!define MUI_UNWELCOMEFINISHPAGE_BITMAP "icons\uninstall.bmp"
106!define MUI_HEADERIMAGE
107!define MUI_HEADERIMAGE_BITMAP "icons\header.bmp"
108!define MUI_HEADERIMAGE_UNBITMAP "icons\un_header.bmp"
109
110!define MUI_WELCOMEFINISHPAGE_BITMAP_STRETCH "AspectFitHeight"
111!define MUI_UNWELCOMEFINISHPAGE_BITMAP_STRETCH "AspectFitHeight"
112!define MUI_HEADERIMAGE_BITMAP_STRETCH "AspectFitHeight"
113!define MUI_HEADERIMAGE_UNBITMAP_STRETCH "AspectFitHeight"
114
115!define MUI_COMPONENTSPAGE_SMALLDESC
116!define MUI_LICENSEPAGE_CHECKBOX
117!define MUI_FINISHPAGE_RUN "$0\gvim.exe"
118!define MUI_FINISHPAGE_RUN_TEXT $(str_show_readme)
119!define MUI_FINISHPAGE_RUN_PARAMETERS "-R $\"$0\README.txt$\""
120
121# This adds '\Vim' to the user choice automagically. The actual value is
122# obtained below with CheckOldVim.
123!ifdef WIN64
124InstallDir "$PROGRAMFILES64\Vim"
125!else
Bram Moolenaar071d4272004-06-13 20:20:40 +0000126InstallDir "$PROGRAMFILES\Vim"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100127!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000128
129# Types of installs we can perform:
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100130InstType $(str_type_typical)
131InstType $(str_type_minimal)
132InstType $(str_type_full)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000133
134SilentInstall normal
135
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100136# General custom functions for MUI2:
137#!define MUI_CUSTOMFUNCTION_ABORT VimOnUserAbort
138#!define MUI_CUSTOMFUNCTION_UNABORT un.VimOnUserAbort
139
140# Installer pages
141!insertmacro MUI_PAGE_WELCOME
142!insertmacro MUI_PAGE_LICENSE "${VIMRT}\doc\uganda.nsis.txt"
143!insertmacro MUI_PAGE_COMPONENTS
144Page custom SetCustom ValidateCustom
145#!define MUI_PAGE_CUSTOMFUNCTION_LEAVE VimFinalCheck
146!insertmacro MUI_PAGE_DIRECTORY
147!insertmacro MUI_PAGE_INSTFILES
148!define MUI_FINISHPAGE_NOREBOOTSUPPORT
149!insertmacro MUI_PAGE_FINISH
150
151# Uninstaller pages:
152!insertmacro MUI_UNPAGE_CONFIRM
153#!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.VimCheckRunning
154!insertmacro MUI_UNPAGE_COMPONENTS
155!insertmacro MUI_UNPAGE_INSTFILES
156!define MUI_FINISHPAGE_NOREBOOTSUPPORT
157!insertmacro MUI_UNPAGE_FINISH
158
159##########################################################
160# Languages Files
161
162!insertmacro MUI_RESERVEFILE_LANGDLL
163!include "lang\english.nsi"
164
165# Include support for other languages:
166!ifdef HAVE_MULTI_LANG
167 !include "lang\danish.nsi"
168 !include "lang\dutch.nsi"
169 !include "lang\german.nsi"
170 !include "lang\italian.nsi"
171 !include "lang\japanese.nsi"
172 !include "lang\simpchinese.nsi"
173 !include "lang\tradchinese.nsi"
174!endif
175
176
177# Global variables
178Var vim_dialog
179Var vim_nsd_compat
180Var vim_nsd_keymap
181Var vim_nsd_mouse
182Var vim_compat_stat
183Var vim_keymap_stat
184Var vim_mouse_stat
185
Bram Moolenaar071d4272004-06-13 20:20:40 +0000186
Bram Moolenaar5d424742018-02-04 19:11:30 +0100187# Reserve files
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100188ReserveFile ${VIMSRC}\installw32.exe
Bram Moolenaar5d424742018-02-04 19:11:30 +0100189
Bram Moolenaar071d4272004-06-13 20:20:40 +0000190##########################################################
191# Functions
192
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100193# Get parent directory
194# Share this function both on installer and uninstaller
195!macro GetParent un
196Function ${un}GetParent
Bram Moolenaar071d4272004-06-13 20:20:40 +0000197 Exch $0 ; old $0 is on top of stack
198 Push $1
199 Push $2
200 StrCpy $1 -1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100201 ${Do}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000202 StrCpy $2 $0 1 $1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100203 ${If} $2 == ""
204 ${OrIf} $2 == "\"
205 ${ExitDo}
206 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +0000207 IntOp $1 $1 - 1
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100208 ${Loop}
209 StrCpy $0 $0 $1
210 Pop $2
211 Pop $1
212 Exch $0 ; put $0 on top of stack, restore $0 to original value
213FunctionEnd
214!macroend
215
216!insertmacro GetParent ""
217!insertmacro GetParent "un."
218
219# Check if Vim is already installed.
220# return: Installed directory. If not found, it will be empty.
221Function CheckOldVim
222 Push $0
223 Push $R0
224 Push $R1
225 Push $R2
226
227 ${If} ${RunningX64}
228 SetRegView 64
229 ${EndIf}
230
231 ClearErrors
232 StrCpy $0 "" # Installed directory
233 StrCpy $R0 0 # Sub-key index
234 StrCpy $R1 "" # Sub-key
235 ${Do}
236 # Eumerate the sub-key:
237 EnumRegKey $R1 HKLM ${UNINST_REG_KEY} $R0
238
239 # Stop if no more sub-key:
240 ${If} ${Errors}
241 ${OrIf} $R1 == ""
242 ${ExitDo}
243 ${EndIf}
244
245 # Move to the next sub-key:
246 IntOp $R0 $R0 + 1
247
248 # Check if the key is Vim uninstall key or not:
249 StrCpy $R2 $R1 4
250 ${If} $R2 S!= "Vim "
251 ${Continue}
252 ${EndIf}
253
254 # Verifies required sub-keys:
255 ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "DisplayName"
256 ${If} ${Errors}
257 ${OrIf} $R2 == ""
258 ${Continue}
259 ${EndIf}
260
261 ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "UninstallString"
262 ${If} ${Errors}
263 ${OrIf} $R2 == ""
264 ${Continue}
265 ${EndIf}
266
267 # Found
268 Push $R2
269 call GetParent
270 call GetParent
271 Pop $0 # Vim directory
272 ${ExitDo}
273
274 ${Loop}
275
276 ${If} ${RunningX64}
277 SetRegView lastused
278 ${EndIf}
279
280 Pop $R2
281 Pop $R1
282 Pop $R0
283 Exch $0 # put $0 on top of stack, restore $0 to original value
Bram Moolenaar071d4272004-06-13 20:20:40 +0000284FunctionEnd
285
286##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100287Section "$(str_section_old_ver)" id_section_old_ver
288 SectionIn 1 2 3 RO
289
290 # run the install program to check for already installed versions
291 SetOutPath $TEMP
292 File /oname=install.exe ${VIMSRC}\installw32.exe
293 DetailPrint "$(str_msg_uninstalling)"
294 ${Do}
295 nsExec::Exec "$TEMP\install.exe -uninstall-check"
296 Pop $3
297
298 call CheckOldVim
299 Pop $3
300 ${If} $3 == ""
301 ${ExitDo}
302 ${Else}
303 # It seems that the old version is still remaining.
304 # TODO: Should we show a warning and run the uninstaller again?
305
306 ${ExitDo} # Just ignore for now.
307 ${EndIf}
308 ${Loop}
309 Delete $TEMP\install.exe
310 Delete $TEMP\vimini.ini # install.exe creates this, but we don't need it.
311
312 # We may have been put to the background when uninstall did something.
313 BringToFront
314SectionEnd
315
316##########################################################
317Section "$(str_section_exe)" id_section_exe
Bram Moolenaar49150a42017-09-17 21:00:03 +0200318 SectionIn 1 2 3 RO
Bram Moolenaar071d4272004-06-13 20:20:40 +0000319
320 # we need also this here if the user changes the instdir
321 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
322
323 SetOutPath $0
324 File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe
325 File /oname=install.exe ${VIMSRC}\installw32.exe
326 File /oname=uninstal.exe ${VIMSRC}\uninstalw32.exe
327 File ${VIMSRC}\vimrun.exe
Bram Moolenaarfec246d2016-08-28 18:47:14 +0200328 File /oname=tee.exe ${VIMSRC}\teew32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000329 File /oname=xxd.exe ${VIMSRC}\xxdw32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000330 File ${VIMRT}\vimtutor.bat
331 File ${VIMRT}\README.txt
332 File ..\uninstal.txt
333 File ${VIMRT}\*.vim
334 File ${VIMRT}\rgb.txt
335
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200336 File ${VIMTOOLS}\diff.exe
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100337 File ${VIMTOOLS}\winpty${BIT}.dll
Bram Moolenaar98ebd2b2017-08-19 13:29:19 +0200338 File ${VIMTOOLS}\winpty-agent.exe
339
Bram Moolenaar071d4272004-06-13 20:20:40 +0000340 SetOutPath $0\colors
341 File ${VIMRT}\colors\*.*
342
343 SetOutPath $0\compiler
344 File ${VIMRT}\compiler\*.*
345
346 SetOutPath $0\doc
347 File ${VIMRT}\doc\*.txt
348 File ${VIMRT}\doc\tags
349
350 SetOutPath $0\ftplugin
351 File ${VIMRT}\ftplugin\*.*
352
353 SetOutPath $0\indent
354 File ${VIMRT}\indent\*.*
355
356 SetOutPath $0\macros
357 File ${VIMRT}\macros\*.*
Bram Moolenaarc35e4cb2017-09-06 21:43:10 +0200358 SetOutPath $0\macros\hanoi
359 File ${VIMRT}\macros\hanoi\*.*
360 SetOutPath $0\macros\life
361 File ${VIMRT}\macros\life\*.*
362 SetOutPath $0\macros\maze
363 File ${VIMRT}\macros\maze\*.*
364 SetOutPath $0\macros\urm
365 File ${VIMRT}\macros\urm\*.*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000366
Bram Moolenaarc7baa432016-04-26 17:34:44 +0200367 SetOutPath $0\pack\dist\opt\dvorak\dvorak
368 File ${VIMRT}\pack\dist\opt\dvorak\dvorak\*.*
369 SetOutPath $0\pack\dist\opt\dvorak\plugin
370 File ${VIMRT}\pack\dist\opt\dvorak\plugin\*.*
371
372 SetOutPath $0\pack\dist\opt\editexisting\plugin
373 File ${VIMRT}\pack\dist\opt\editexisting\plugin\*.*
374
375 SetOutPath $0\pack\dist\opt\justify\plugin
376 File ${VIMRT}\pack\dist\opt\justify\plugin\*.*
377
378 SetOutPath $0\pack\dist\opt\matchit\doc
379 File ${VIMRT}\pack\dist\opt\matchit\doc\*.*
380 SetOutPath $0\pack\dist\opt\matchit\plugin
381 File ${VIMRT}\pack\dist\opt\matchit\plugin\*.*
382
383 SetOutPath $0\pack\dist\opt\shellmenu\plugin
384 File ${VIMRT}\pack\dist\opt\shellmenu\plugin\*.*
385
386 SetOutPath $0\pack\dist\opt\swapmouse\plugin
387 File ${VIMRT}\pack\dist\opt\swapmouse\plugin\*.*
388
Bram Moolenaar38623c82018-05-10 21:24:35 +0200389 SetOutPath $0\pack\dist\opt\termdebug\plugin
390 File ${VIMRT}\pack\dist\opt\termdebug\plugin\*.*
391
Bram Moolenaar071d4272004-06-13 20:20:40 +0000392 SetOutPath $0\plugin
393 File ${VIMRT}\plugin\*.*
394
Bram Moolenaar7fcab2a2006-03-25 21:46:12 +0000395 SetOutPath $0\autoload
396 File ${VIMRT}\autoload\*.*
397
Bram Moolenaard09a2062017-11-11 15:37:45 +0100398 SetOutPath $0\autoload\dist
399 File ${VIMRT}\autoload\dist\*.*
400
Bram Moolenaar18144c82006-04-12 21:52:12 +0000401 SetOutPath $0\autoload\xml
402 File ${VIMRT}\autoload\xml\*.*
403
Bram Moolenaar071d4272004-06-13 20:20:40 +0000404 SetOutPath $0\syntax
405 File ${VIMRT}\syntax\*.*
406
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000407 SetOutPath $0\spell
408 File ${VIMRT}\spell\*.txt
409 File ${VIMRT}\spell\*.vim
410 File ${VIMRT}\spell\*.spl
411 File ${VIMRT}\spell\*.sug
412
Bram Moolenaar071d4272004-06-13 20:20:40 +0000413 SetOutPath $0\tools
414 File ${VIMRT}\tools\*.*
415
416 SetOutPath $0\tutor
417 File ${VIMRT}\tutor\*.*
418SectionEnd
419
420##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100421Section "$(str_section_console)" id_section_console
Bram Moolenaar071d4272004-06-13 20:20:40 +0000422 SectionIn 1 3
423
424 SetOutPath $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100425 File /oname=vim.exe ${VIMSRC}\vimw32.exe
Bram Moolenaar071d4272004-06-13 20:20:40 +0000426 StrCpy $2 "$2 vim view vimdiff"
427SectionEnd
428
429##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100430Section "$(str_section_batch)" id_section_batch
Bram Moolenaar071d4272004-06-13 20:20:40 +0000431 SectionIn 3
432
433 StrCpy $1 "$1 -create-batfiles $2"
434SectionEnd
435
436##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100437SectionGroup $(str_group_icons) id_group_icons
438 Section "$(str_section_desktop)" id_section_desktop
439 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000440
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100441 StrCpy $1 "$1 -install-icons"
442 SectionEnd
443
444 Section "$(str_section_start_menu)" id_section_startmenu
445 SectionIn 1 3
446
447 StrCpy $1 "$1 -add-start-menu"
448 SectionEnd
449SectionGroupEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000450
451##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100452Section "$(str_section_edit_with)" id_section_editwith
Bram Moolenaar071d4272004-06-13 20:20:40 +0000453 SectionIn 1 3
454
Bram Moolenaar071d4272004-06-13 20:20:40 +0000455 SetOutPath $0
Bram Moolenaar6199d432017-10-14 19:05:44 +0200456
Bram Moolenaar442b4222010-05-24 21:34:22 +0200457 ${If} ${RunningX64}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200458 # Install 64-bit gvimext.dll into the GvimExt64 directory.
459 SetOutPath $0\GvimExt64
460 ClearErrors
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100461 !define LIBRARY_SHELL_EXTENSION
462 !define LIBRARY_X64
463 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
464 "${VIMSRC}\GvimExt\gvimext64.dll" \
465 "$0\GvimExt64\gvimext.dll" "$0"
466 !undef LIBRARY_X64
467 !undef LIBRARY_SHELL_EXTENSION
Bram Moolenaar442b4222010-05-24 21:34:22 +0200468 ${EndIf}
Bram Moolenaar6199d432017-10-14 19:05:44 +0200469
Bram Moolenaar6199d432017-10-14 19:05:44 +0200470 # Install 32-bit gvimext.dll into the GvimExt32 directory.
471 SetOutPath $0\GvimExt32
472 ClearErrors
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100473 !define LIBRARY_SHELL_EXTENSION
474 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
475 "${VIMSRC}\GvimExt\gvimext.dll" \
476 "$0\GvimExt32\gvimext.dll" "$0"
477 !undef LIBRARY_SHELL_EXTENSION
Bram Moolenaar071d4272004-06-13 20:20:40 +0000478
479 # We don't have a separate entry for the "Open With..." menu, assume
480 # the user wants either both or none.
481 StrCpy $1 "$1 -install-popup -install-openwith"
482SectionEnd
483
484##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100485Section "$(str_section_vim_rc)" id_section_vimrc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000486 SectionIn 1 3
487
488 StrCpy $1 "$1 -create-vimrc"
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100489
490 ${If} ${RunningX64}
491 SetRegView 64
492 ${EndIf}
493 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_compat" "$vim_compat_stat"
494 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_keyremap" "$vim_keymap_stat"
495 WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_mouse" "$vim_mouse_stat"
496 ${If} ${RunningX64}
497 SetRegView lastused
498 ${EndIf}
499
500 ${If} $vim_compat_stat == "vi"
501 StrCpy $1 "$1 -vimrc-compat vi"
502 ${ElseIf} $vim_compat_stat == "vim"
503 StrCpy $1 "$1 -vimrc-compat vim"
504 ${ElseIf} $vim_compat_stat == "defaults"
505 StrCpy $1 "$1 -vimrc-compat defaults"
506 ${Else}
507 StrCpy $1 "$1 -vimrc-compat all"
508 ${EndIf}
509
510 ${If} $vim_keymap_stat == "default"
511 StrCpy $1 "$1 -vimrc-remap no"
512 ${Else}
513 StrCpy $1 "$1 -vimrc-remap win"
514 ${EndIf}
515
516 ${If} $vim_mouse_stat == "default"
517 StrCpy $1 "$1 -vimrc-behave default"
518 ${ElseIf} $vim_mouse_stat == "windows"
519 StrCpy $1 "$1 -vimrc-behave mswin"
520 ${Else}
521 StrCpy $1 "$1 -vimrc-behave unix"
522 ${EndIf}
523
Bram Moolenaar071d4272004-06-13 20:20:40 +0000524SectionEnd
525
526##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100527SectionGroup $(str_group_plugin) id_group_plugin
528 Section "$(str_section_plugin_home)" id_section_pluginhome
529 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000530
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100531 StrCpy $1 "$1 -create-directories home"
532 SectionEnd
533
534 Section "$(str_section_plugin_vim)" id_section_pluginvim
535 SectionIn 3
536
537 StrCpy $1 "$1 -create-directories vim"
538 SectionEnd
539SectionGroupEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000540
541##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100542!ifdef HAVE_VIS_VIM
543Section "$(str_section_vis_vim)" id_section_visvim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000544 SectionIn 3
545
546 SetOutPath $0
547 !insertmacro UpgradeDLL "${VIMSRC}\VisVim\VisVim.dll" "$0\VisVim.dll" "$0"
548 File ${VIMSRC}\VisVim\README_VisVim.txt
549SectionEnd
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100550!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000551
552##########################################################
553!ifdef HAVE_NLS
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100554Section "$(str_section_nls)" id_section_nls
555 SectionIn 1 3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000556
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100557 SetOutPath $0\lang
558 File /r ${VIMRT}\lang\*.*
559 SetOutPath $0\keymap
560 File ${VIMRT}\keymap\README.txt
561 File ${VIMRT}\keymap\*.vim
562 SetOutPath $0
563 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
564 "${GETTEXT}\gettext${BIT}\libintl-8.dll" \
565 "$0\libintl-8.dll" "$0"
566 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
567 "${GETTEXT}\gettext${BIT}\libiconv-2.dll" \
568 "$0\libiconv-2.dll" "$0"
569 !if /FileExists "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll"
570 # Install libgcc_s_sjlj-1.dll only if it is needed.
571 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
572 "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll" \
573 "$0\libgcc_s_sjlj-1.dll" "$0"
574 !endif
575
576 ${If} ${SectionIsSelected} ${id_section_editwith}
577 ${If} ${RunningX64}
578 # Install DLLs for 64-bit gvimext.dll into the GvimExt64 directory.
579 SetOutPath $0\GvimExt64
580 ClearErrors
581 !define LIBRARY_X64
582 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
583 "${GETTEXT}\gettext64\libintl-8.dll" \
584 "$0\GvimExt64\libintl-8.dll" "$0\GvimExt64"
585 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
586 "${GETTEXT}\gettext64\libiconv-2.dll" \
587 "$0\GvimExt64\libiconv-2.dll" "$0\GvimExt64"
588 !undef LIBRARY_X64
589 ${EndIf}
590
591 # Install DLLs for 32-bit gvimext.dll into the GvimExt32 directory.
592 SetOutPath $0\GvimExt32
593 ClearErrors
594 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
595 "${GETTEXT}\gettext32\libintl-8.dll" \
596 "$0\GvimExt32\libintl-8.dll" "$0\GvimExt32"
597 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
598 "${GETTEXT}\gettext32\libiconv-2.dll" \
599 "$0\GvimExt32\libiconv-2.dll" "$0\GvimExt32"
600 !if /FileExists "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll"
601 # Install libgcc_s_sjlj-1.dll only if it is needed.
602 !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
603 "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll" \
604 "$0\GvimExt32\libgcc_s_sjlj-1.dll" "$0\GvimExt32"
605 !endif
606 ${EndIf}
607SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000608!endif
609
610##########################################################
611Section -call_install_exe
612 SetOutPath $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100613 DetailPrint "$(str_msg_registering)"
614 nsExec::Exec "$0\install.exe $1"
615 Pop $3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000616SectionEnd
617
618##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100619!macro SaveSectionSelection section_id reg_value
620 ${If} ${SectionIsSelected} ${section_id}
621 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 1
622 ${Else}
623 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 0
624 ${EndIf}
625!macroend
626
Bram Moolenaar071d4272004-06-13 20:20:40 +0000627Section -post
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100628
629 # Get estimated install size
630 SectionGetSize ${id_section_exe} $3
631 ${If} ${SectionIsSelected} ${id_section_console}
632 SectionGetSize ${id_section_console} $4
633 IntOp $3 $3 + $4
634 ${EndIf}
635 ${If} ${SectionIsSelected} ${id_section_editwith}
636 SectionGetSize ${id_section_editwith} $4
637 IntOp $3 $3 + $4
638 ${EndIf}
639!ifdef HAVE_VIS_VIM
640 ${If} ${SectionIsSelected} ${id_section_visvim}
641 SectionGetSize ${id_section_visvim} $4
642 IntOp $3 $3 + $4
643 ${EndIf}
644!endif
645!ifdef HAVE_NLS
646 ${If} ${SectionIsSelected} ${id_section_nls}
647 SectionGetSize ${id_section_nls} $4
648 IntOp $3 $3 + $4
649 ${EndIf}
650!endif
651
652 # Register EstimatedSize and AllowSilent.
653 # Other information will be set by the install.exe (dosinst.c).
654 ${If} ${RunningX64}
655 SetRegView 64
656 ${EndIf}
657 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "EstimatedSize" $3
658 WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "AllowSilent" 1
659 ${If} ${RunningX64}
660 SetRegView lastused
661 ${EndIf}
662
663 # Store the selections to the registry.
664 ${If} ${RunningX64}
665 SetRegView 64
666 ${EndIf}
667 !insertmacro SaveSectionSelection ${id_section_console} "select_console"
668 !insertmacro SaveSectionSelection ${id_section_batch} "select_batch"
669 !insertmacro SaveSectionSelection ${id_section_desktop} "select_desktop"
670 !insertmacro SaveSectionSelection ${id_section_startmenu} "select_startmenu"
671 !insertmacro SaveSectionSelection ${id_section_editwith} "select_editwith"
672 !insertmacro SaveSectionSelection ${id_section_vimrc} "select_vimrc"
673 !insertmacro SaveSectionSelection ${id_section_pluginhome} "select_pluginhome"
674 !insertmacro SaveSectionSelection ${id_section_pluginvim} "select_pluginvim"
675!ifdef HAVE_VIS_VIM
676 !insertmacro SaveSectionSelection ${id_section_visvim} "select_visvim"
677!endif
678!ifdef HAVE_NLS
679 !insertmacro SaveSectionSelection ${id_section_nls} "select_nls"
680!endif
681 ${If} ${RunningX64}
682 SetRegView lastused
683 ${EndIf}
684
Bram Moolenaar071d4272004-06-13 20:20:40 +0000685 BringToFront
686SectionEnd
687
688##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100689!macro LoadSectionSelection section_id reg_value
690 ClearErrors
691 ReadRegDWORD $3 HKLM "${UNINST_REG_KEY_VIM}" ${reg_value}
692 ${IfNot} ${Errors}
693 ${If} $3 = 1
694 !insertmacro SelectSection ${section_id}
695 ${Else}
696 !insertmacro UnselectSection ${section_id}
697 ${EndIf}
698 ${EndIf}
699!macroend
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200700
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100701Function .onInit
702!ifdef HAVE_MULTI_LANG
703 # Select a language (or read from the registry).
704 !insertmacro MUI_LANGDLL_DISPLAY
705!endif
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200706
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100707 # Check $VIM
708 ReadEnvStr $INSTDIR "VIM"
709
710 call CheckOldVim
711 Pop $3
712 ${If} $3 == ""
713 # No old versions of Vim found. Unselect and hide the section.
714 !insertmacro UnselectSection ${id_section_old_ver}
715 SectionSetInstTypes ${id_section_old_ver} 0
716 SectionSetText ${id_section_old_ver} ""
717 ${Else}
718 ${If} $INSTDIR == ""
719 StrCpy $INSTDIR $3
720 ${EndIf}
721 ${EndIf}
722
723 # If did not find a path: use the default dir.
724 ${If} $INSTDIR == ""
725!ifdef WIN64
726 StrCpy $INSTDIR "$PROGRAMFILES64\Vim"
727!else
728 StrCpy $INSTDIR "$PROGRAMFILES\Vim"
729!endif
730 ${EndIf}
731
732# Load the selections from the registry (if any).
733 ${If} ${RunningX64}
734 SetRegView 64
735 ${EndIf}
736 !insertmacro LoadSectionSelection ${id_section_console} "select_console"
737 !insertmacro LoadSectionSelection ${id_section_batch} "select_batch"
738 !insertmacro LoadSectionSelection ${id_section_desktop} "select_desktop"
739 !insertmacro LoadSectionSelection ${id_section_startmenu} "select_startmenu"
740 !insertmacro LoadSectionSelection ${id_section_editwith} "select_editwith"
741 !insertmacro LoadSectionSelection ${id_section_vimrc} "select_vimrc"
742 !insertmacro LoadSectionSelection ${id_section_pluginhome} "select_pluginhome"
743 !insertmacro LoadSectionSelection ${id_section_pluginvim} "select_pluginvim"
744!ifdef HAVE_VIS_VIM
745 !insertmacro LoadSectionSelection ${id_section_visvim} "select_visvim"
746!endif
747!ifdef HAVE_NLS
748 !insertmacro LoadSectionSelection ${id_section_nls} "select_nls"
749!endif
750 ${If} ${RunningX64}
751 SetRegView lastused
752 ${EndIf}
753
754 # User variables:
755 # $0 - holds the directory the executables are installed to
756 # $1 - holds the parameters to be passed to install.exe. Starts with OLE
757 # registration (since a non-OLE gvim will not complain, and we want to
758 # always register an OLE gvim).
759 # $2 - holds the names to create batch files for
760 StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}"
761 StrCpy $1 "-register-OLE"
762 StrCpy $2 "gvim evim gview gvimdiff vimtutor"
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200763FunctionEnd
764
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100765Function .onInstSuccess
766 WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe
767FunctionEnd
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200768
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100769Function .onInstFailed
770 MessageBox MB_OK|MB_ICONEXCLAMATION "$(str_msg_install_fail)" /SD IDOK
Bram Moolenaarc3fdf7f2017-10-28 18:36:48 +0200771FunctionEnd
772
773##########################################################
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100774Function SetCustom
775 # Display the _vimrc setting dialog using nsDialogs.
776
777 # Check if a _vimrc should be created
778 ${IfNot} ${SectionIsSelected} ${id_section_vimrc}
779 Abort
780 ${EndIf}
781
782 !insertmacro MUI_HEADER_TEXT \
783 $(str_vimrc_page_title) $(str_vimrc_page_subtitle)
784
785 nsDialogs::Create 1018
786 Pop $vim_dialog
787
788 ${If} $vim_dialog == error
789 Abort
790 ${EndIf}
791
792 ${If} ${RunningX64}
793 SetRegView 64
794 ${EndIf}
795
796 GetFunctionAddress $3 ValidateCustom
797 nsDialogs::OnBack $3
798
799
800 # 1st group - Compatibility
801 ${NSD_CreateGroupBox} 0 0 100% 32% $(str_msg_compat_title)
802 Pop $3
803
804 ${NSD_CreateLabel} 5% 10% 35% 8% $(str_msg_compat_desc)
805 Pop $3
806 ${NSD_CreateDropList} 18% 19% 75% 8% ""
807 Pop $vim_nsd_compat
808 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vi)
809 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vim)
810 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_defaults)
811 ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_all)
812
813 # Default selection
814 ${If} $vim_compat_stat == ""
815 ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_compat"
816 ${Else}
817 StrCpy $3 $vim_compat_stat
818 ${EndIf}
819 ${If} $3 == "defaults"
820 StrCpy $4 2
821 ${ElseIf} $3 == "vim"
822 StrCpy $4 1
823 ${ElseIf} $3 == "vi"
824 StrCpy $4 0
825 ${Else} # default
826 StrCpy $4 3
827 ${EndIf}
828 ${NSD_CB_SetSelectionIndex} $vim_nsd_compat $4
829
830
831 # 2nd group - Key remapping
832 ${NSD_CreateGroupBox} 0 35% 100% 31% $(str_msg_keymap_title)
833 Pop $3
834
835 ${NSD_CreateLabel} 5% 45% 90% 8% $(str_msg_keymap_desc)
836 Pop $3
837 ${NSD_CreateDropList} 38% 54% 55% 8% ""
838 Pop $vim_nsd_keymap
839 ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_default)
840 ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_windows)
841
842 # Default selection
843 ${If} $vim_keymap_stat == ""
844 ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_keyremap"
845 ${Else}
846 StrCpy $3 $vim_keymap_stat
847 ${EndIf}
848 ${If} $3 == "windows"
849 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
868 # Default selection
869 ${If} $vim_mouse_stat == ""
870 ReadRegStr $3 HKLM "${UNINST_REG_KEY_VIM}" "vim_mouse"
871 ${Else}
872 StrCpy $3 $vim_mouse_stat
873 ${EndIf}
874 ${If} $3 == "xterm"
875 StrCpy $4 2
876 ${ElseIf} $3 == "windows"
877 StrCpy $4 1
878 ${Else} # default
879 StrCpy $4 0
880 ${EndIf}
881 ${NSD_CB_SetSelectionIndex} $vim_nsd_mouse $4
882
883 ${If} ${RunningX64}
884 SetRegView lastused
885 ${EndIf}
886
887 nsDialogs::Show
888FunctionEnd
889
890Function ValidateCustom
891 ${NSD_CB_GetSelectionIndex} $vim_nsd_compat $3
892 ${If} $3 = 0
893 StrCpy $vim_compat_stat "vi"
894 ${ElseIf} $3 = 1
895 StrCpy $vim_compat_stat "vim"
896 ${ElseIf} $3 = 2
897 StrCpy $vim_compat_stat "defaults"
898 ${Else}
899 StrCpy $vim_compat_stat "all"
900 ${EndIf}
901
902 ${NSD_CB_GetSelectionIndex} $vim_nsd_keymap $3
903 ${If} $3 = 0
904 StrCpy $vim_keymap_stat "default"
905 ${Else}
906 StrCpy $vim_keymap_stat "windows"
907 ${EndIf}
908
909 ${NSD_CB_GetSelectionIndex} $vim_nsd_mouse $3
910 ${If} $3 = 0
911 StrCpy $vim_mouse_stat "default"
912 ${ElseIf} $3 = 1
913 StrCpy $vim_mouse_stat "windows"
914 ${Else}
915 StrCpy $vim_mouse_stat "xterm"
916 ${EndIf}
917FunctionEnd
918
919##########################################################
920# Description for Installer Sections
921
922!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
923 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_old_ver} $(str_desc_old_ver)
924 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_exe} $(str_desc_exe)
925 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_console} $(str_desc_console)
926 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_batch} $(str_desc_batch)
927 !insertmacro MUI_DESCRIPTION_TEXT ${id_group_icons} $(str_desc_icons)
928 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_desktop} $(str_desc_desktop)
929 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_startmenu} $(str_desc_start_menu)
930 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_editwith} $(str_desc_edit_with)
931 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_vimrc} $(str_desc_vim_rc)
932 !insertmacro MUI_DESCRIPTION_TEXT ${id_group_plugin} $(str_desc_plugin)
933 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginhome} $(str_desc_plugin_home)
934 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginvim} $(str_desc_plugin_vim)
935!ifdef HAVE_VIS_VIM
936 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_visvim} $(str_desc_vis_vim)
937!endif
938!ifdef HAVE_NLS
939 !insertmacro MUI_DESCRIPTION_TEXT ${id_section_nls} $(str_desc_nls)
940!endif
941!insertmacro MUI_FUNCTION_DESCRIPTION_END
942
943
944##########################################################
945# Uninstaller Functions and Sections
946
947Function un.onInit
948!ifdef HAVE_MULTI_LANG
949 # Get the language from the registry.
950 !insertmacro MUI_UNGETLANGUAGE
951!endif
952FunctionEnd
953
954Section "un.$(str_unsection_register)" id_unsection_register
955 SectionIn RO
956
Bram Moolenaar071d4272004-06-13 20:20:40 +0000957 # Apparently $INSTDIR is set to the directory where the uninstaller is
958 # created. Thus the "vim61" directory is included in it.
959 StrCpy $0 "$INSTDIR"
960
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100961!ifdef HAVE_VIS_VIM
Bram Moolenaar071d4272004-06-13 20:20:40 +0000962 # If VisVim was installed, unregister the DLL.
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100963 ${If} ${FileExists} "$0\VisVim.dll"
964 ExecWait "regsvr32.exe /u /s $0\VisVim.dll"
965 ${EndIf}
966!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000967
968 # delete the context menu entry and batch files
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100969 DetailPrint "$(str_msg_unregistering)"
970 nsExec::Exec "$0\uninstal.exe -nsis"
971 Pop $3
Bram Moolenaar071d4272004-06-13 20:20:40 +0000972
973 # We may have been put to the background when uninstall did something.
974 BringToFront
975
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100976 # Delete the installer language setting.
977 DeleteRegKey ${MUI_LANGDLL_REGISTRY_ROOT} ${MUI_LANGDLL_REGISTRY_KEY}
978SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +0000979
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100980Section "un.$(str_unsection_exe)" id_unsection_exe
981
982 StrCpy $0 "$INSTDIR"
983
984 # Delete gettext and iconv DLLs
985 ${If} ${FileExists} "$0\libiconv-2.dll"
986 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
987 "$0\libiconv-2.dll"
Bram Moolenaar6199d432017-10-14 19:05:44 +0200988 ${EndIf}
Bram Moolenaaraf610b82018-12-21 16:22:50 +0100989 ${If} ${FileExists} "$0\libintl-8.dll"
990 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
991 "$0\libintl-8.dll"
992 ${EndIf}
993 ${If} ${FileExists} "$0\libgcc_s_sjlj-1.dll"
994 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
995 "$0\libgcc_s_sjlj-1.dll"
996 ${EndIf}
997
998 # Delete other DLLs
999 Delete /REBOOTOK $0\*.dll
1000
1001 # Delete 64-bit GvimExt
1002 ${If} ${RunningX64}
1003 !define LIBRARY_X64
1004 ${If} ${FileExists} "$0\GvimExt64\gvimext.dll"
1005 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1006 "$0\GvimExt64\gvimext.dll"
1007 ${EndIf}
1008 ${If} ${FileExists} "$0\GvimExt64\libiconv-2.dll"
1009 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1010 "$0\GvimExt64\libiconv-2.dll"
1011 ${EndIf}
1012 ${If} ${FileExists} "$0\GvimExt64\libintl-8.dll"
1013 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1014 "$0\GvimExt64\libintl-8.dll"
1015 ${EndIf}
1016 ${If} ${FileExists} "$0\GvimExt64\libwinpthread-1.dll"
1017 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1018 "$0\GvimExt64\libwinpthread-1.dll"
1019 ${EndIf}
1020 !undef LIBRARY_X64
1021 RMDir /r $0\GvimExt64
1022 ${EndIf}
1023
1024 # Delete 32-bit GvimExt
1025 ${If} ${FileExists} "$0\GvimExt32\gvimext.dll"
1026 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1027 "$0\GvimExt32\gvimext.dll"
1028 ${EndIf}
1029 ${If} ${FileExists} "$0\GvimExt32\libiconv-2.dll"
1030 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1031 "$0\GvimExt32\libiconv-2.dll"
1032 ${EndIf}
1033 ${If} ${FileExists} "$0\GvimExt32\libintl-8.dll"
1034 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1035 "$0\GvimExt32\libintl-8.dll"
1036 ${EndIf}
1037 ${If} ${FileExists} "$0\GvimExt32\libgcc_s_sjlj-1.dll"
1038 !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
1039 "$0\GvimExt32\libgcc_s_sjlj-1.dll"
1040 ${EndIf}
1041 RMDir /r $0\GvimExt32
Bram Moolenaar6199d432017-10-14 19:05:44 +02001042
Bram Moolenaar071d4272004-06-13 20:20:40 +00001043 ClearErrors
1044 # Remove everything but *.dll files. Avoids that
1045 # a lot remains when gvimext.dll cannot be deleted.
Bram Moolenaar408b5852006-05-13 10:44:07 +00001046 RMDir /r $0\autoload
Bram Moolenaar071d4272004-06-13 20:20:40 +00001047 RMDir /r $0\colors
1048 RMDir /r $0\compiler
1049 RMDir /r $0\doc
1050 RMDir /r $0\ftplugin
1051 RMDir /r $0\indent
1052 RMDir /r $0\macros
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001053 RMDir /r $0\pack
Bram Moolenaar071d4272004-06-13 20:20:40 +00001054 RMDir /r $0\plugin
Bram Moolenaar408b5852006-05-13 10:44:07 +00001055 RMDir /r $0\spell
Bram Moolenaar071d4272004-06-13 20:20:40 +00001056 RMDir /r $0\syntax
1057 RMDir /r $0\tools
1058 RMDir /r $0\tutor
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001059!ifdef HAVE_VIS_VIM
Bram Moolenaar071d4272004-06-13 20:20:40 +00001060 RMDir /r $0\VisVim
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001061!endif
Bram Moolenaar071d4272004-06-13 20:20:40 +00001062 RMDir /r $0\lang
1063 RMDir /r $0\keymap
1064 Delete $0\*.exe
1065 Delete $0\*.bat
1066 Delete $0\*.vim
1067 Delete $0\*.txt
1068
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001069 ${If} ${Errors}
1070 MessageBox MB_OK|MB_ICONEXCLAMATION $(str_msg_rm_exe_fail) /SD IDOK
1071 ${EndIf}
Bram Moolenaar071d4272004-06-13 20:20:40 +00001072
1073 # No error message if the "vim62" directory can't be removed, the
1074 # gvimext.dll may still be there.
1075 RMDir $0
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001076SectionEnd
Bram Moolenaar071d4272004-06-13 20:20:40 +00001077
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001078# Remove "vimfiles" directory under the specified directory.
1079!macro RemoveVimfiles dir
1080 ${If} ${FileExists} ${dir}\vimfiles
1081 RMDir ${dir}\vimfiles\colors
1082 RMDir ${dir}\vimfiles\compiler
1083 RMDir ${dir}\vimfiles\doc
1084 RMDir ${dir}\vimfiles\ftdetect
1085 RMDir ${dir}\vimfiles\ftplugin
1086 RMDir ${dir}\vimfiles\indent
1087 RMDir ${dir}\vimfiles\keymap
1088 RMDir ${dir}\vimfiles\plugin
1089 RMDir ${dir}\vimfiles\syntax
1090 RMDir ${dir}\vimfiles
1091 ${EndIf}
1092!macroend
1093
1094SectionGroup "un.$(str_ungroup_plugin)" id_ungroup_plugin
1095 Section /o "un.$(str_unsection_plugin_home)" id_unsection_plugin_home
1096 # get the home dir
1097 ReadEnvStr $0 "HOME"
1098 ${If} $0 == ""
1099 ReadEnvStr $0 "HOMEDRIVE"
1100 ReadEnvStr $1 "HOMEPATH"
1101 StrCpy $0 "$0$1"
1102 ${If} $0 == ""
1103 ReadEnvStr $0 "USERPROFILE"
1104 ${EndIf}
1105 ${EndIf}
1106
1107 ${If} $0 != ""
1108 !insertmacro RemoveVimfiles $0
1109 ${EndIf}
1110 SectionEnd
1111
1112 Section "un.$(str_unsection_plugin_vim)" id_unsection_plugin_vim
1113 # get the parent dir of the installation
1114 Push $INSTDIR
1115 Call un.GetParent
1116 Pop $0
1117
1118 # if a plugin dir was created at installation remove it
1119 !insertmacro RemoveVimfiles $0
1120 SectionEnd
1121SectionGroupEnd
1122
1123Section "un.$(str_unsection_rootdir)" id_unsection_rootdir
Bram Moolenaar071d4272004-06-13 20:20:40 +00001124 # get the parent dir of the installation
1125 Push $INSTDIR
1126 Call un.GetParent
1127 Pop $0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001128
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001129 Delete $0\_vimrc
1130 RMDir $0
Bram Moolenaar071d4272004-06-13 20:20:40 +00001131SectionEnd
Bram Moolenaaraf610b82018-12-21 16:22:50 +01001132
1133##########################################################
1134# Description for Uninstaller Sections
1135
1136!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
1137 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_register} $(str_desc_unregister)
1138 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_exe} $(str_desc_rm_exe)
1139 !insertmacro MUI_DESCRIPTION_TEXT ${id_ungroup_plugin} $(str_desc_rm_plugin)
1140 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_home} $(str_desc_rm_plugin_home)
1141 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_vim} $(str_desc_rm_plugin_vim)
1142 !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_rootdir} $(str_desc_rm_rootdir)
1143!insertmacro MUI_UNFUNCTION_DESCRIPTION_END