Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | # NSIS file to create a self-installing exe for Vim. |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 2 | # It requires NSIS version 3.0 or later. |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 3 | # Last Change: 2024 Mar 18 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 4 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 5 | Unicode true |
| 6 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 7 | # 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 Moolenaar | ba46075 | 2013-07-04 22:35:01 +0200 | [diff] [blame] | 10 | # Location of gvim_ole.exe, vimw32.exe, GvimExt/*, etc. |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 11 | !ifndef VIMSRC |
| 12 | !define VIMSRC "..\src" |
| 13 | !endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 14 | |
| 15 | # Location of runtime files |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 16 | !ifndef VIMRT |
| 17 | !define VIMRT ".." |
| 18 | !endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 19 | |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 20 | # Location of extra tools: diff.exe, winpty{32|64}.dll, winpty-agent.exe, etc. |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 21 | !ifndef VIMTOOLS |
| 22 | !define VIMTOOLS ..\.. |
| 23 | !endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 24 | |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 25 | # 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 | |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 32 | # If you have UPX, use the switch /DHAVE_UPX=1 on the command line makensis.exe. |
| 33 | # This property will be set to 1. Get it at https://upx.github.io/ |
| 34 | !ifndef HAVE_UPX |
| 35 | !define HAVE_UPX 0 |
| 36 | !endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 37 | |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 38 | # If you do not want to add Native Language Support, use the switch /DHAVE_NLS=0 |
| 39 | # in the command line makensis.exe. This property will be set to 0. |
| 40 | !ifndef HAVE_NLS |
| 41 | !define HAVE_NLS 1 |
| 42 | !endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 43 | |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 44 | # To create an English-only the installer, use the switch /DHAVE_MULTI_LANG=0 on |
| 45 | # the command line makensis.exe. This property will be set to 0. |
| 46 | !ifndef HAVE_MULTI_LANG |
| 47 | !define HAVE_MULTI_LANG 1 |
| 48 | !endif |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 49 | |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 50 | # if you want to create a 64-bit the installer, use the switch /DWIN64=1 on |
| 51 | # the command line makensis.exe. This property will be set to 1. |
| 52 | !ifndef WIN64 |
| 53 | !define WIN64 0 |
| 54 | !endif |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 55 | |
Bram Moolenaar | 6c7b444 | 2016-01-02 15:44:32 +0100 | [diff] [blame] | 56 | !include gvim_version.nsh # for version number |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 57 | |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 58 | # Definition of Patch for Vim. |
Bram Moolenaar | 9d59152 | 2019-05-26 20:49:42 +0200 | [diff] [blame] | 59 | !ifndef PATCHLEVEL |
| 60 | !define PATCHLEVEL 0 |
| 61 | !endif |
| 62 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 63 | # ----------- No configurable settings below this line ----------- |
| 64 | |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 65 | !include "Library.nsh" # for DLL install |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 66 | !include "LogicLib.nsh" |
| 67 | !include "MUI2.nsh" |
| 68 | !include "nsDialogs.nsh" |
| 69 | !include "Sections.nsh" |
| 70 | !include "x64.nsh" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 71 | |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 72 | # See https://nsis.sourceforge.io/LogicLib |
| 73 | ;FileExists is already part of LogicLib, but returns true for directories |
| 74 | ;as well as files |
| 75 | !macro _FileExists2 _a _b _t _f |
| 76 | !insertmacro _LOGICLIB_TEMP |
| 77 | StrCpy $_LOGICLIB_TEMP "0" |
| 78 | ;if path is not blank, continue to next check |
| 79 | StrCmp `${_b}` `` +4 0 |
| 80 | ;if path exists, continue to next check (IfFileExists returns true if this |
| 81 | ;is a directory) |
| 82 | IfFileExists `${_b}` `0` +3 |
| 83 | ;if path is not a directory, continue to confirm exists |
| 84 | IfFileExists `${_b}\*.*` +2 0 |
| 85 | StrCpy $_LOGICLIB_TEMP "1" ;file exists |
| 86 | ;now we have a definitive value - the file exists or it does not |
| 87 | StrCmp $_LOGICLIB_TEMP "1" `${_t}` `${_f}` |
| 88 | !macroend |
| 89 | !undef FileExists |
| 90 | !define FileExists `"" FileExists2` |
| 91 | !macro _DirExists _a _b _t _f |
| 92 | !insertmacro _LOGICLIB_TEMP |
| 93 | StrCpy $_LOGICLIB_TEMP "0" |
| 94 | ;if path is not blank, continue to next check |
| 95 | StrCmp `${_b}` `` +3 0 |
| 96 | ;if directory exists, continue to confirm exists |
| 97 | IfFileExists `${_b}\*.*` 0 +2 |
| 98 | StrCpy $_LOGICLIB_TEMP "1" |
| 99 | StrCmp $_LOGICLIB_TEMP "1" `${_t}` `${_f}` |
| 100 | !macroend |
| 101 | !define DirExists `"" DirExists` |
| 102 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 103 | !define PRODUCT "Vim ${VER_MAJOR}.${VER_MINOR}" |
| 104 | !define UNINST_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall" |
| 105 | !define UNINST_REG_KEY_VIM "${UNINST_REG_KEY}\${PRODUCT}" |
| 106 | |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 107 | !if ${WIN64} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 108 | Name "${PRODUCT} (x64)" |
| 109 | !else |
| 110 | Name "${PRODUCT}" |
| 111 | !endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 112 | OutFile gvim${VER_MAJOR}${VER_MINOR}.exe |
| 113 | CRCCheck force |
Bram Moolenaar | 286eacd | 2016-01-16 18:05:50 +0100 | [diff] [blame] | 114 | SetCompressor /SOLID lzma |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 115 | SetCompressorDictSize 64 |
| 116 | ManifestDPIAware true |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 117 | SetDatablockOptimize on |
Bram Moolenaar | 442b422 | 2010-05-24 21:34:22 +0200 | [diff] [blame] | 118 | RequestExecutionLevel highest |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 119 | |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 120 | !if ${HAVE_UPX} |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 121 | !packhdr temp.dat "upx --best --compress-icons=1 temp.dat" |
| 122 | !endif |
| 123 | |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 124 | !if ${WIN64} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 125 | !define BIT 64 |
| 126 | !else |
| 127 | !define BIT 32 |
| 128 | !endif |
| 129 | |
| 130 | ########################################################## |
| 131 | # MUI2 settings |
| 132 | |
| 133 | !define MUI_ABORTWARNING |
| 134 | !define MUI_UNABORTWARNING |
| 135 | |
| 136 | !define MUI_ICON "icons\vim_16c.ico" |
| 137 | !define MUI_UNICON "icons\vim_uninst_16c.ico" |
| 138 | |
| 139 | # Show all languages, despite user's codepage: |
| 140 | !define MUI_LANGDLL_ALLLANGUAGES |
| 141 | !define MUI_LANGDLL_REGISTRY_ROOT "HKCU" |
| 142 | !define MUI_LANGDLL_REGISTRY_KEY "Software\Vim" |
| 143 | !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" |
| 144 | |
| 145 | !define MUI_WELCOMEFINISHPAGE_BITMAP "icons\welcome.bmp" |
| 146 | !define MUI_UNWELCOMEFINISHPAGE_BITMAP "icons\uninstall.bmp" |
| 147 | !define MUI_HEADERIMAGE |
| 148 | !define MUI_HEADERIMAGE_BITMAP "icons\header.bmp" |
| 149 | !define MUI_HEADERIMAGE_UNBITMAP "icons\un_header.bmp" |
| 150 | |
| 151 | !define MUI_WELCOMEFINISHPAGE_BITMAP_STRETCH "AspectFitHeight" |
| 152 | !define MUI_UNWELCOMEFINISHPAGE_BITMAP_STRETCH "AspectFitHeight" |
| 153 | !define MUI_HEADERIMAGE_BITMAP_STRETCH "AspectFitHeight" |
| 154 | !define MUI_HEADERIMAGE_UNBITMAP_STRETCH "AspectFitHeight" |
| 155 | |
| 156 | !define MUI_COMPONENTSPAGE_SMALLDESC |
| 157 | !define MUI_LICENSEPAGE_CHECKBOX |
Bram Moolenaar | 4a22897 | 2021-05-01 22:41:39 +0200 | [diff] [blame] | 158 | !define MUI_FINISHPAGE_RUN |
| 159 | !define MUI_FINISHPAGE_RUN_FUNCTION LaunchApplication |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 160 | !define MUI_FINISHPAGE_RUN_TEXT $(str_show_readme) |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 161 | |
| 162 | # This adds '\Vim' to the user choice automagically. The actual value is |
| 163 | # obtained below with CheckOldVim. |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 164 | !if ${WIN64} |
Christian Brabandt | 7d60384 | 2021-07-24 21:19:42 +0200 | [diff] [blame] | 165 | !define DEFAULT_INSTDIR "$PROGRAMFILES64\Vim" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 166 | !else |
Christian Brabandt | 7d60384 | 2021-07-24 21:19:42 +0200 | [diff] [blame] | 167 | !define DEFAULT_INSTDIR "$PROGRAMFILES\Vim" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 168 | !endif |
Christian Brabandt | 7d60384 | 2021-07-24 21:19:42 +0200 | [diff] [blame] | 169 | InstallDir ${DEFAULT_INSTDIR} |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 170 | |
| 171 | # Types of installs we can perform: |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 172 | InstType $(str_type_typical) |
| 173 | InstType $(str_type_minimal) |
| 174 | InstType $(str_type_full) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 175 | |
| 176 | SilentInstall normal |
| 177 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 178 | # General custom functions for MUI2: |
| 179 | #!define MUI_CUSTOMFUNCTION_ABORT VimOnUserAbort |
| 180 | #!define MUI_CUSTOMFUNCTION_UNABORT un.VimOnUserAbort |
| 181 | |
| 182 | # Installer pages |
| 183 | !insertmacro MUI_PAGE_WELCOME |
| 184 | !insertmacro MUI_PAGE_LICENSE "${VIMRT}\doc\uganda.nsis.txt" |
| 185 | !insertmacro MUI_PAGE_COMPONENTS |
| 186 | Page custom SetCustom ValidateCustom |
| 187 | #!define MUI_PAGE_CUSTOMFUNCTION_LEAVE VimFinalCheck |
| 188 | !insertmacro MUI_PAGE_DIRECTORY |
| 189 | !insertmacro MUI_PAGE_INSTFILES |
| 190 | !define MUI_FINISHPAGE_NOREBOOTSUPPORT |
| 191 | !insertmacro MUI_PAGE_FINISH |
| 192 | |
| 193 | # Uninstaller pages: |
| 194 | !insertmacro MUI_UNPAGE_CONFIRM |
| 195 | #!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.VimCheckRunning |
| 196 | !insertmacro MUI_UNPAGE_COMPONENTS |
| 197 | !insertmacro MUI_UNPAGE_INSTFILES |
| 198 | !define MUI_FINISHPAGE_NOREBOOTSUPPORT |
| 199 | !insertmacro MUI_UNPAGE_FINISH |
| 200 | |
| 201 | ########################################################## |
| 202 | # Languages Files |
| 203 | |
| 204 | !insertmacro MUI_RESERVEFILE_LANGDLL |
| 205 | !include "lang\english.nsi" |
| 206 | |
| 207 | # Include support for other languages: |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 208 | !if ${HAVE_MULTI_LANG} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 209 | !include "lang\danish.nsi" |
| 210 | !include "lang\dutch.nsi" |
| 211 | !include "lang\german.nsi" |
Christos Longros | c62dacb | 2024-03-06 20:53:02 +0100 | [diff] [blame] | 212 | !include "lang\greek.nsi" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 213 | !include "lang\italian.nsi" |
| 214 | !include "lang\japanese.nsi" |
Bram Moolenaar | 809fcec | 2020-09-20 21:43:03 +0200 | [diff] [blame] | 215 | !include "lang\russian.nsi" |
Ivan Pešić | e105192 | 2024-03-05 23:34:00 +0400 | [diff] [blame] | 216 | !include "lang\serbian.nsi" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 217 | !include "lang\simpchinese.nsi" |
| 218 | !include "lang\tradchinese.nsi" |
Bram Moolenaar | 1a928c2 | 2020-01-18 16:10:40 +0100 | [diff] [blame] | 219 | !include "lang\turkish.nsi" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 220 | !endif |
| 221 | |
Bram Moolenaar | dabfde0 | 2019-05-17 12:37:27 +0200 | [diff] [blame] | 222 | ########################################################## |
| 223 | # Version resources |
| 224 | |
| 225 | VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Vim" |
| 226 | VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Vim Developers" |
| 227 | VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Vim" |
| 228 | VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright (C) 1996" |
| 229 | VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Vi Improved - A Text Editor" |
Bram Moolenaar | 9d59152 | 2019-05-26 20:49:42 +0200 | [diff] [blame] | 230 | VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VER_MAJOR}.${VER_MINOR}.${PATCHLEVEL}.0" |
| 231 | VIProductVersion "${VER_MAJOR}.${VER_MINOR}.${PATCHLEVEL}.0" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 232 | |
| 233 | # Global variables |
| 234 | Var vim_dialog |
| 235 | Var vim_nsd_compat |
| 236 | Var vim_nsd_keymap |
| 237 | Var vim_nsd_mouse |
| 238 | Var vim_compat_stat |
| 239 | Var vim_keymap_stat |
| 240 | Var vim_mouse_stat |
| 241 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 242 | |
Bram Moolenaar | 5d42474 | 2018-02-04 19:11:30 +0100 | [diff] [blame] | 243 | # Reserve files |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 244 | ReserveFile ${VIMSRC}\installw32.exe |
Bram Moolenaar | 5d42474 | 2018-02-04 19:11:30 +0100 | [diff] [blame] | 245 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 246 | ########################################################## |
| 247 | # Functions |
| 248 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 249 | # Get parent directory |
| 250 | # Share this function both on installer and uninstaller |
| 251 | !macro GetParent un |
| 252 | Function ${un}GetParent |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 253 | Exch $0 ; old $0 is on top of stack |
| 254 | Push $1 |
| 255 | Push $2 |
| 256 | StrCpy $1 -1 |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 257 | ${Do} |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 258 | StrCpy $2 $0 1 $1 |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 259 | ${If} $2 == "" |
| 260 | ${OrIf} $2 == "\" |
| 261 | ${ExitDo} |
| 262 | ${EndIf} |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 263 | IntOp $1 $1 - 1 |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 264 | ${Loop} |
| 265 | StrCpy $0 $0 $1 |
| 266 | Pop $2 |
| 267 | Pop $1 |
| 268 | Exch $0 ; put $0 on top of stack, restore $0 to original value |
| 269 | FunctionEnd |
| 270 | !macroend |
| 271 | |
| 272 | !insertmacro GetParent "" |
| 273 | !insertmacro GetParent "un." |
| 274 | |
Christopher Plewright | eea0a00 | 2023-02-17 20:04:51 +0000 | [diff] [blame] | 275 | # Get home directory |
| 276 | !macro GetHomeDir un |
| 277 | Function ${un}GetHomeDir |
| 278 | Push $0 |
| 279 | Push $1 |
| 280 | ReadEnvStr $0 "HOME" |
| 281 | ${If} $0 == "" |
| 282 | ReadEnvStr $0 "HOMEDRIVE" |
| 283 | ReadEnvStr $1 "HOMEPATH" |
| 284 | StrCpy $0 "$0$1" |
| 285 | ${If} $0 == "" |
| 286 | ReadEnvStr $0 "USERPROFILE" |
| 287 | ${EndIf} |
| 288 | ${EndIf} |
| 289 | Pop $1 |
| 290 | Exch $0 # put $0 on top of stack, restore $0 to original value |
| 291 | FunctionEnd |
| 292 | !macroend |
| 293 | |
| 294 | !insertmacro GetHomeDir "" |
| 295 | !insertmacro GetHomeDir "un." |
| 296 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 297 | # Check if Vim is already installed. |
| 298 | # return: Installed directory. If not found, it will be empty. |
| 299 | Function CheckOldVim |
| 300 | Push $0 |
| 301 | Push $R0 |
| 302 | Push $R1 |
| 303 | Push $R2 |
| 304 | |
| 305 | ${If} ${RunningX64} |
| 306 | SetRegView 64 |
| 307 | ${EndIf} |
| 308 | |
| 309 | ClearErrors |
| 310 | StrCpy $0 "" # Installed directory |
| 311 | StrCpy $R0 0 # Sub-key index |
| 312 | StrCpy $R1 "" # Sub-key |
| 313 | ${Do} |
| 314 | # Eumerate the sub-key: |
| 315 | EnumRegKey $R1 HKLM ${UNINST_REG_KEY} $R0 |
| 316 | |
| 317 | # Stop if no more sub-key: |
| 318 | ${If} ${Errors} |
| 319 | ${OrIf} $R1 == "" |
| 320 | ${ExitDo} |
| 321 | ${EndIf} |
| 322 | |
| 323 | # Move to the next sub-key: |
| 324 | IntOp $R0 $R0 + 1 |
| 325 | |
| 326 | # Check if the key is Vim uninstall key or not: |
| 327 | StrCpy $R2 $R1 4 |
| 328 | ${If} $R2 S!= "Vim " |
| 329 | ${Continue} |
| 330 | ${EndIf} |
| 331 | |
| 332 | # Verifies required sub-keys: |
| 333 | ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "DisplayName" |
| 334 | ${If} ${Errors} |
| 335 | ${OrIf} $R2 == "" |
| 336 | ${Continue} |
| 337 | ${EndIf} |
| 338 | |
| 339 | ReadRegStr $R2 HKLM "${UNINST_REG_KEY}\$R1" "UninstallString" |
| 340 | ${If} ${Errors} |
| 341 | ${OrIf} $R2 == "" |
| 342 | ${Continue} |
| 343 | ${EndIf} |
| 344 | |
| 345 | # Found |
| 346 | Push $R2 |
| 347 | call GetParent |
| 348 | call GetParent |
| 349 | Pop $0 # Vim directory |
| 350 | ${ExitDo} |
| 351 | |
| 352 | ${Loop} |
| 353 | |
| 354 | ${If} ${RunningX64} |
| 355 | SetRegView lastused |
| 356 | ${EndIf} |
| 357 | |
| 358 | Pop $R2 |
| 359 | Pop $R1 |
| 360 | Pop $R0 |
| 361 | Exch $0 # put $0 on top of stack, restore $0 to original value |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 362 | FunctionEnd |
| 363 | |
Bram Moolenaar | 4a22897 | 2021-05-01 22:41:39 +0200 | [diff] [blame] | 364 | Function LaunchApplication |
| 365 | SetOutPath $0 |
Bram Moolenaar | 5f628a1 | 2021-05-02 13:59:46 +0200 | [diff] [blame] | 366 | ShellExecAsUser::ShellExecAsUser "" "$0\gvim.exe" '-R "$0\README.txt"' |
Bram Moolenaar | 4a22897 | 2021-05-01 22:41:39 +0200 | [diff] [blame] | 367 | FunctionEnd |
| 368 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 369 | ########################################################## |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 370 | Section "$(str_section_old_ver)" id_section_old_ver |
| 371 | SectionIn 1 2 3 RO |
| 372 | |
| 373 | # run the install program to check for already installed versions |
| 374 | SetOutPath $TEMP |
| 375 | File /oname=install.exe ${VIMSRC}\installw32.exe |
| 376 | DetailPrint "$(str_msg_uninstalling)" |
| 377 | ${Do} |
| 378 | nsExec::Exec "$TEMP\install.exe -uninstall-check" |
| 379 | Pop $3 |
| 380 | |
| 381 | call CheckOldVim |
| 382 | Pop $3 |
| 383 | ${If} $3 == "" |
| 384 | ${ExitDo} |
| 385 | ${Else} |
| 386 | # It seems that the old version is still remaining. |
| 387 | # TODO: Should we show a warning and run the uninstaller again? |
| 388 | |
| 389 | ${ExitDo} # Just ignore for now. |
| 390 | ${EndIf} |
| 391 | ${Loop} |
| 392 | Delete $TEMP\install.exe |
| 393 | Delete $TEMP\vimini.ini # install.exe creates this, but we don't need it. |
| 394 | |
| 395 | # We may have been put to the background when uninstall did something. |
| 396 | BringToFront |
| 397 | SectionEnd |
| 398 | |
| 399 | ########################################################## |
| 400 | Section "$(str_section_exe)" id_section_exe |
Bram Moolenaar | 49150a4 | 2017-09-17 21:00:03 +0200 | [diff] [blame] | 401 | SectionIn 1 2 3 RO |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 402 | |
| 403 | # we need also this here if the user changes the instdir |
| 404 | StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" |
| 405 | |
| 406 | SetOutPath $0 |
| 407 | File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe |
Bram Moolenaar | afde13b | 2019-04-28 19:46:49 +0200 | [diff] [blame] | 408 | !if /FileExists "${VIMSRC}\vim${BIT}.dll" |
| 409 | File ${VIMSRC}\vim${BIT}.dll |
| 410 | !endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 411 | File /oname=install.exe ${VIMSRC}\installw32.exe |
Bram Moolenaar | 30e8e73 | 2019-09-27 13:08:36 +0200 | [diff] [blame] | 412 | File /oname=uninstall.exe ${VIMSRC}\uninstallw32.exe |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 413 | File ${VIMSRC}\vimrun.exe |
Bram Moolenaar | fec246d | 2016-08-28 18:47:14 +0200 | [diff] [blame] | 414 | File /oname=tee.exe ${VIMSRC}\teew32.exe |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 415 | File /oname=xxd.exe ${VIMSRC}\xxdw32.exe |
Bram Moolenaar | 1916673 | 2018-12-21 17:59:33 +0100 | [diff] [blame] | 416 | File ..\vimtutor.bat |
| 417 | File ..\README.txt |
Bram Moolenaar | 30e8e73 | 2019-09-27 13:08:36 +0200 | [diff] [blame] | 418 | File ..\uninstall.txt |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 419 | File ${VIMRT}\*.vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 420 | |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 421 | !if /FileExists "${VIMTOOLS}\diff.exe" |
Bram Moolenaar | 98ebd2b | 2017-08-19 13:29:19 +0200 | [diff] [blame] | 422 | File ${VIMTOOLS}\diff.exe |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 423 | !endif |
| 424 | !if /FileExists "${VIMTOOLS}\winpty${BIT}.dll" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 425 | File ${VIMTOOLS}\winpty${BIT}.dll |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 426 | !endif |
| 427 | !if /FileExists "${VIMTOOLS}\winpty-agent.exe" |
Bram Moolenaar | 98ebd2b | 2017-08-19 13:29:19 +0200 | [diff] [blame] | 428 | File ${VIMTOOLS}\winpty-agent.exe |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 429 | !endif |
| 430 | !if /FileExists "${VIMTOOLS}\libsodium.dll" |
| 431 | File ${VIMTOOLS}\libsodium.dll |
| 432 | !endif |
Bram Moolenaar | 98ebd2b | 2017-08-19 13:29:19 +0200 | [diff] [blame] | 433 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 434 | SetOutPath $0\colors |
K.Takata | 44b9abb | 2022-08-24 18:08:00 +0100 | [diff] [blame] | 435 | File /r ${VIMRT}\colors\*.* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 436 | |
| 437 | SetOutPath $0\compiler |
| 438 | File ${VIMRT}\compiler\*.* |
| 439 | |
| 440 | SetOutPath $0\doc |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 441 | File /x uganda.nsis.txt ${VIMRT}\doc\*.txt |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 442 | File ${VIMRT}\doc\tags |
| 443 | |
| 444 | SetOutPath $0\ftplugin |
| 445 | File ${VIMRT}\ftplugin\*.* |
| 446 | |
| 447 | SetOutPath $0\indent |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 448 | File ${VIMRT}\indent\README.txt |
| 449 | File ${VIMRT}\indent\*.vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 450 | |
Ken Takata | 1a9aba8 | 2024-01-16 17:14:29 +0100 | [diff] [blame] | 451 | SetOutPath $0\keymap |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 452 | File ${VIMRT}\keymap\README.txt |
| 453 | File ${VIMRT}\keymap\*.vim |
Ken Takata | 1a9aba8 | 2024-01-16 17:14:29 +0100 | [diff] [blame] | 454 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 455 | SetOutPath $0\macros |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 456 | File /r /x *.info ${VIMRT}\macros\*.* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 457 | |
Bram Moolenaar | 6a95c88 | 2019-03-26 23:02:46 +0100 | [diff] [blame] | 458 | SetOutPath $0\pack |
| 459 | File /r ${VIMRT}\pack\*.* |
Bram Moolenaar | 38623c8 | 2018-05-10 21:24:35 +0200 | [diff] [blame] | 460 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 461 | SetOutPath $0\plugin |
| 462 | File ${VIMRT}\plugin\*.* |
| 463 | |
Bram Moolenaar | 7fcab2a | 2006-03-25 21:46:12 +0000 | [diff] [blame] | 464 | SetOutPath $0\autoload |
K.Takata | 44b9abb | 2022-08-24 18:08:00 +0100 | [diff] [blame] | 465 | File /r ${VIMRT}\autoload\*.* |
Bram Moolenaar | 18144c8 | 2006-04-12 21:52:12 +0000 | [diff] [blame] | 466 | |
Bram Moolenaar | 44433da | 2022-05-06 18:08:52 +0100 | [diff] [blame] | 467 | SetOutPath $0\import\dist |
| 468 | File ${VIMRT}\import\dist\*.* |
| 469 | |
Christian Brabandt | 176711f | 2022-03-11 15:24:11 +0000 | [diff] [blame] | 470 | SetOutPath $0\bitmaps |
| 471 | File ${VIMSRC}\vim.ico |
| 472 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 473 | SetOutPath $0\syntax |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 474 | File /r /x testdir /x generator /x Makefile ${VIMRT}\syntax\*.* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 475 | |
Bram Moolenaar | c01140a | 2006-03-24 22:21:52 +0000 | [diff] [blame] | 476 | SetOutPath $0\spell |
| 477 | File ${VIMRT}\spell\*.txt |
| 478 | File ${VIMRT}\spell\*.vim |
| 479 | File ${VIMRT}\spell\*.spl |
| 480 | File ${VIMRT}\spell\*.sug |
| 481 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 482 | SetOutPath $0\tools |
| 483 | File ${VIMRT}\tools\*.* |
| 484 | |
| 485 | SetOutPath $0\tutor |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 486 | File /x Makefile /x *.info ${VIMRT}\tutor\*.* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 487 | SectionEnd |
| 488 | |
| 489 | ########################################################## |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 490 | Section "$(str_section_console)" id_section_console |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 491 | SectionIn 1 3 |
| 492 | |
| 493 | SetOutPath $0 |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 494 | File /oname=vim.exe ${VIMSRC}\vimw32.exe |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 495 | StrCpy $2 "$2 vim view vimdiff" |
| 496 | SectionEnd |
| 497 | |
| 498 | ########################################################## |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 499 | Section "$(str_section_batch)" id_section_batch |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 500 | SectionIn 3 |
| 501 | |
| 502 | StrCpy $1 "$1 -create-batfiles $2" |
| 503 | SectionEnd |
| 504 | |
| 505 | ########################################################## |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 506 | SectionGroup $(str_group_icons) id_group_icons |
| 507 | Section "$(str_section_desktop)" id_section_desktop |
| 508 | SectionIn 1 3 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 509 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 510 | StrCpy $1 "$1 -install-icons" |
| 511 | SectionEnd |
| 512 | |
| 513 | Section "$(str_section_start_menu)" id_section_startmenu |
| 514 | SectionIn 1 3 |
| 515 | |
| 516 | StrCpy $1 "$1 -add-start-menu" |
| 517 | SectionEnd |
| 518 | SectionGroupEnd |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 519 | |
| 520 | ########################################################## |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 521 | Section "$(str_section_edit_with)" id_section_editwith |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 522 | SectionIn 1 3 |
| 523 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 524 | SetOutPath $0 |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 525 | |
Bram Moolenaar | 442b422 | 2010-05-24 21:34:22 +0200 | [diff] [blame] | 526 | ${If} ${RunningX64} |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 527 | # Install 64-bit gvimext.dll into the GvimExt64 directory. |
| 528 | SetOutPath $0\GvimExt64 |
| 529 | ClearErrors |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 530 | !define LIBRARY_SHELL_EXTENSION |
| 531 | !define LIBRARY_X64 |
| 532 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 533 | "${VIMSRC}\GvimExt\gvimext64.dll" \ |
| 534 | "$0\GvimExt64\gvimext.dll" "$0" |
| 535 | !undef LIBRARY_X64 |
| 536 | !undef LIBRARY_SHELL_EXTENSION |
Bram Moolenaar | 442b422 | 2010-05-24 21:34:22 +0200 | [diff] [blame] | 537 | ${EndIf} |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 538 | |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 539 | # Install 32-bit gvimext.dll into the GvimExt32 directory. |
| 540 | SetOutPath $0\GvimExt32 |
| 541 | ClearErrors |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 542 | !define LIBRARY_SHELL_EXTENSION |
| 543 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 544 | "${VIMSRC}\GvimExt\gvimext.dll" \ |
| 545 | "$0\GvimExt32\gvimext.dll" "$0" |
| 546 | !undef LIBRARY_SHELL_EXTENSION |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 547 | |
| 548 | # We don't have a separate entry for the "Open With..." menu, assume |
| 549 | # the user wants either both or none. |
| 550 | StrCpy $1 "$1 -install-popup -install-openwith" |
| 551 | SectionEnd |
| 552 | |
| 553 | ########################################################## |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 554 | Section "$(str_section_vim_rc)" id_section_vimrc |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 555 | SectionIn 1 3 |
| 556 | |
| 557 | StrCpy $1 "$1 -create-vimrc" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 558 | |
| 559 | ${If} ${RunningX64} |
| 560 | SetRegView 64 |
| 561 | ${EndIf} |
| 562 | WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_compat" "$vim_compat_stat" |
| 563 | WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_keyremap" "$vim_keymap_stat" |
| 564 | WriteRegStr HKLM "${UNINST_REG_KEY_VIM}" "vim_mouse" "$vim_mouse_stat" |
| 565 | ${If} ${RunningX64} |
| 566 | SetRegView lastused |
| 567 | ${EndIf} |
| 568 | |
| 569 | ${If} $vim_compat_stat == "vi" |
| 570 | StrCpy $1 "$1 -vimrc-compat vi" |
| 571 | ${ElseIf} $vim_compat_stat == "vim" |
| 572 | StrCpy $1 "$1 -vimrc-compat vim" |
| 573 | ${ElseIf} $vim_compat_stat == "defaults" |
| 574 | StrCpy $1 "$1 -vimrc-compat defaults" |
| 575 | ${Else} |
| 576 | StrCpy $1 "$1 -vimrc-compat all" |
| 577 | ${EndIf} |
| 578 | |
| 579 | ${If} $vim_keymap_stat == "default" |
| 580 | StrCpy $1 "$1 -vimrc-remap no" |
| 581 | ${Else} |
| 582 | StrCpy $1 "$1 -vimrc-remap win" |
| 583 | ${EndIf} |
| 584 | |
| 585 | ${If} $vim_mouse_stat == "default" |
| 586 | StrCpy $1 "$1 -vimrc-behave default" |
| 587 | ${ElseIf} $vim_mouse_stat == "windows" |
| 588 | StrCpy $1 "$1 -vimrc-behave mswin" |
| 589 | ${Else} |
| 590 | StrCpy $1 "$1 -vimrc-behave unix" |
| 591 | ${EndIf} |
| 592 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 593 | SectionEnd |
| 594 | |
| 595 | ########################################################## |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 596 | SectionGroup $(str_group_plugin) id_group_plugin |
| 597 | Section "$(str_section_plugin_home)" id_section_pluginhome |
| 598 | SectionIn 1 3 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 599 | |
Christopher Plewright | eea0a00 | 2023-02-17 20:04:51 +0000 | [diff] [blame] | 600 | # use ShellExecAsUser below instead |
| 601 | # StrCpy $1 "$1 -create-directories home" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 602 | SectionEnd |
| 603 | |
| 604 | Section "$(str_section_plugin_vim)" id_section_pluginvim |
| 605 | SectionIn 3 |
| 606 | |
| 607 | StrCpy $1 "$1 -create-directories vim" |
| 608 | SectionEnd |
| 609 | SectionGroupEnd |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 610 | |
| 611 | ########################################################## |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 612 | !if ${HAVE_NLS} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 613 | Section "$(str_section_nls)" id_section_nls |
| 614 | SectionIn 1 3 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 615 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 616 | SetOutPath $0\lang |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 617 | File /r /x Makefile ${VIMRT}\lang\*.* |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 618 | SetOutPath $0 |
| 619 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 620 | "${GETTEXT}\gettext${BIT}\libintl-8.dll" \ |
| 621 | "$0\libintl-8.dll" "$0" |
| 622 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 623 | "${GETTEXT}\gettext${BIT}\libiconv-2.dll" \ |
| 624 | "$0\libiconv-2.dll" "$0" |
| 625 | !if /FileExists "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll" |
| 626 | # Install libgcc_s_sjlj-1.dll only if it is needed. |
| 627 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 628 | "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll" \ |
| 629 | "$0\libgcc_s_sjlj-1.dll" "$0" |
| 630 | !endif |
| 631 | |
| 632 | ${If} ${SectionIsSelected} ${id_section_editwith} |
| 633 | ${If} ${RunningX64} |
| 634 | # Install DLLs for 64-bit gvimext.dll into the GvimExt64 directory. |
| 635 | SetOutPath $0\GvimExt64 |
| 636 | ClearErrors |
| 637 | !define LIBRARY_X64 |
| 638 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 639 | "${GETTEXT}\gettext64\libintl-8.dll" \ |
| 640 | "$0\GvimExt64\libintl-8.dll" "$0\GvimExt64" |
| 641 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 642 | "${GETTEXT}\gettext64\libiconv-2.dll" \ |
| 643 | "$0\GvimExt64\libiconv-2.dll" "$0\GvimExt64" |
| 644 | !undef LIBRARY_X64 |
| 645 | ${EndIf} |
| 646 | |
| 647 | # Install DLLs for 32-bit gvimext.dll into the GvimExt32 directory. |
| 648 | SetOutPath $0\GvimExt32 |
| 649 | ClearErrors |
| 650 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 651 | "${GETTEXT}\gettext32\libintl-8.dll" \ |
| 652 | "$0\GvimExt32\libintl-8.dll" "$0\GvimExt32" |
| 653 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 654 | "${GETTEXT}\gettext32\libiconv-2.dll" \ |
| 655 | "$0\GvimExt32\libiconv-2.dll" "$0\GvimExt32" |
| 656 | !if /FileExists "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll" |
| 657 | # Install libgcc_s_sjlj-1.dll only if it is needed. |
| 658 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 659 | "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll" \ |
| 660 | "$0\GvimExt32\libgcc_s_sjlj-1.dll" "$0\GvimExt32" |
| 661 | !endif |
| 662 | ${EndIf} |
| 663 | SectionEnd |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 664 | !endif |
| 665 | |
| 666 | ########################################################## |
| 667 | Section -call_install_exe |
| 668 | SetOutPath $0 |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 669 | DetailPrint "$(str_msg_registering)" |
| 670 | nsExec::Exec "$0\install.exe $1" |
| 671 | Pop $3 |
Christopher Plewright | eea0a00 | 2023-02-17 20:04:51 +0000 | [diff] [blame] | 672 | |
| 673 | ${If} ${SectionIsSelected} ${id_section_pluginhome} |
| 674 | ReadEnvStr $3 "COMSPEC" |
| 675 | Call GetHomeDir |
| 676 | Pop $4 |
| 677 | ShellExecAsUser::ShellExecAsUser "" "$3" '/c "cd /d "$4" & mkdir vimfiles & cd vimfiles & mkdir colors compiler doc ftdetect ftplugin indent keymap plugin syntax"' SW_HIDE |
| 678 | ${EndIf} |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 679 | SectionEnd |
| 680 | |
| 681 | ########################################################## |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 682 | !macro SaveSectionSelection section_id reg_value |
| 683 | ${If} ${SectionIsSelected} ${section_id} |
| 684 | WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 1 |
| 685 | ${Else} |
| 686 | WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 0 |
| 687 | ${EndIf} |
| 688 | !macroend |
| 689 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 690 | Section -post |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 691 | |
| 692 | # Get estimated install size |
| 693 | SectionGetSize ${id_section_exe} $3 |
| 694 | ${If} ${SectionIsSelected} ${id_section_console} |
| 695 | SectionGetSize ${id_section_console} $4 |
| 696 | IntOp $3 $3 + $4 |
| 697 | ${EndIf} |
| 698 | ${If} ${SectionIsSelected} ${id_section_editwith} |
| 699 | SectionGetSize ${id_section_editwith} $4 |
| 700 | IntOp $3 $3 + $4 |
| 701 | ${EndIf} |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 702 | !if ${HAVE_NLS} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 703 | ${If} ${SectionIsSelected} ${id_section_nls} |
| 704 | SectionGetSize ${id_section_nls} $4 |
| 705 | IntOp $3 $3 + $4 |
| 706 | ${EndIf} |
| 707 | !endif |
| 708 | |
| 709 | # Register EstimatedSize and AllowSilent. |
| 710 | # Other information will be set by the install.exe (dosinst.c). |
| 711 | ${If} ${RunningX64} |
| 712 | SetRegView 64 |
| 713 | ${EndIf} |
| 714 | WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "EstimatedSize" $3 |
| 715 | WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "AllowSilent" 1 |
| 716 | ${If} ${RunningX64} |
| 717 | SetRegView lastused |
| 718 | ${EndIf} |
| 719 | |
| 720 | # Store the selections to the registry. |
| 721 | ${If} ${RunningX64} |
| 722 | SetRegView 64 |
| 723 | ${EndIf} |
| 724 | !insertmacro SaveSectionSelection ${id_section_console} "select_console" |
| 725 | !insertmacro SaveSectionSelection ${id_section_batch} "select_batch" |
| 726 | !insertmacro SaveSectionSelection ${id_section_desktop} "select_desktop" |
| 727 | !insertmacro SaveSectionSelection ${id_section_startmenu} "select_startmenu" |
| 728 | !insertmacro SaveSectionSelection ${id_section_editwith} "select_editwith" |
| 729 | !insertmacro SaveSectionSelection ${id_section_vimrc} "select_vimrc" |
| 730 | !insertmacro SaveSectionSelection ${id_section_pluginhome} "select_pluginhome" |
| 731 | !insertmacro SaveSectionSelection ${id_section_pluginvim} "select_pluginvim" |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 732 | !if ${HAVE_NLS} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 733 | !insertmacro SaveSectionSelection ${id_section_nls} "select_nls" |
| 734 | !endif |
| 735 | ${If} ${RunningX64} |
| 736 | SetRegView lastused |
| 737 | ${EndIf} |
| 738 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 739 | BringToFront |
| 740 | SectionEnd |
| 741 | |
| 742 | ########################################################## |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 743 | !macro LoadSectionSelection section_id reg_value |
| 744 | ClearErrors |
| 745 | ReadRegDWORD $3 HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} |
| 746 | ${IfNot} ${Errors} |
| 747 | ${If} $3 = 1 |
| 748 | !insertmacro SelectSection ${section_id} |
| 749 | ${Else} |
| 750 | !insertmacro UnselectSection ${section_id} |
| 751 | ${EndIf} |
| 752 | ${EndIf} |
| 753 | !macroend |
Bram Moolenaar | c3fdf7f | 2017-10-28 18:36:48 +0200 | [diff] [blame] | 754 | |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 755 | !macro LoadDefaultVimrc out_var reg_value default_value |
| 756 | ClearErrors |
| 757 | ReadRegStr ${out_var} HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} |
| 758 | ${If} ${Errors} |
| 759 | ${OrIf} ${out_var} == "" |
| 760 | StrCpy ${out_var} ${default_value} |
| 761 | ${EndIf} |
| 762 | !macroend |
| 763 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 764 | Function .onInit |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 765 | !if ${HAVE_MULTI_LANG} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 766 | # Select a language (or read from the registry). |
| 767 | !insertmacro MUI_LANGDLL_DISPLAY |
| 768 | !endif |
Bram Moolenaar | c3fdf7f | 2017-10-28 18:36:48 +0200 | [diff] [blame] | 769 | |
Christian Brabandt | 7d60384 | 2021-07-24 21:19:42 +0200 | [diff] [blame] | 770 | ${If} $INSTDIR == ${DEFAULT_INSTDIR} |
| 771 | # Check $VIM |
| 772 | ReadEnvStr $3 "VIM" |
| 773 | ${If} $3 != "" |
| 774 | StrCpy $INSTDIR $3 |
| 775 | ${EndIf} |
| 776 | ${EndIf} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 777 | |
| 778 | call CheckOldVim |
| 779 | Pop $3 |
| 780 | ${If} $3 == "" |
| 781 | # No old versions of Vim found. Unselect and hide the section. |
| 782 | !insertmacro UnselectSection ${id_section_old_ver} |
| 783 | SectionSetInstTypes ${id_section_old_ver} 0 |
| 784 | SectionSetText ${id_section_old_ver} "" |
| 785 | ${Else} |
Christian Brabandt | 7d60384 | 2021-07-24 21:19:42 +0200 | [diff] [blame] | 786 | ${If} $INSTDIR == ${DEFAULT_INSTDIR} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 787 | StrCpy $INSTDIR $3 |
| 788 | ${EndIf} |
| 789 | ${EndIf} |
| 790 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 791 | ${If} ${RunningX64} |
| 792 | SetRegView 64 |
| 793 | ${EndIf} |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 794 | # Load the selections from the registry (if any). |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 795 | !insertmacro LoadSectionSelection ${id_section_console} "select_console" |
| 796 | !insertmacro LoadSectionSelection ${id_section_batch} "select_batch" |
| 797 | !insertmacro LoadSectionSelection ${id_section_desktop} "select_desktop" |
| 798 | !insertmacro LoadSectionSelection ${id_section_startmenu} "select_startmenu" |
| 799 | !insertmacro LoadSectionSelection ${id_section_editwith} "select_editwith" |
| 800 | !insertmacro LoadSectionSelection ${id_section_vimrc} "select_vimrc" |
| 801 | !insertmacro LoadSectionSelection ${id_section_pluginhome} "select_pluginhome" |
| 802 | !insertmacro LoadSectionSelection ${id_section_pluginvim} "select_pluginvim" |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 803 | !if ${HAVE_NLS} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 804 | !insertmacro LoadSectionSelection ${id_section_nls} "select_nls" |
| 805 | !endif |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 806 | # Load the default _vimrc settings from the registry (if any). |
| 807 | !insertmacro LoadDefaultVimrc $vim_compat_stat "vim_compat" "all" |
| 808 | !insertmacro LoadDefaultVimrc $vim_keymap_stat "vim_keyremap" "default" |
| 809 | !insertmacro LoadDefaultVimrc $vim_mouse_stat "vim_mouse" "default" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 810 | ${If} ${RunningX64} |
| 811 | SetRegView lastused |
| 812 | ${EndIf} |
| 813 | |
| 814 | # User variables: |
| 815 | # $0 - holds the directory the executables are installed to |
| 816 | # $1 - holds the parameters to be passed to install.exe. Starts with OLE |
| 817 | # registration (since a non-OLE gvim will not complain, and we want to |
| 818 | # always register an OLE gvim). |
| 819 | # $2 - holds the names to create batch files for |
| 820 | StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" |
| 821 | StrCpy $1 "-register-OLE" |
| 822 | StrCpy $2 "gvim evim gview gvimdiff vimtutor" |
Bram Moolenaar | c3fdf7f | 2017-10-28 18:36:48 +0200 | [diff] [blame] | 823 | FunctionEnd |
| 824 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 825 | Function .onInstSuccess |
| 826 | WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe |
| 827 | FunctionEnd |
Bram Moolenaar | c3fdf7f | 2017-10-28 18:36:48 +0200 | [diff] [blame] | 828 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 829 | Function .onInstFailed |
| 830 | MessageBox MB_OK|MB_ICONEXCLAMATION "$(str_msg_install_fail)" /SD IDOK |
Bram Moolenaar | c3fdf7f | 2017-10-28 18:36:48 +0200 | [diff] [blame] | 831 | FunctionEnd |
| 832 | |
| 833 | ########################################################## |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 834 | Function SetCustom |
| 835 | # Display the _vimrc setting dialog using nsDialogs. |
| 836 | |
| 837 | # Check if a _vimrc should be created |
| 838 | ${IfNot} ${SectionIsSelected} ${id_section_vimrc} |
| 839 | Abort |
| 840 | ${EndIf} |
| 841 | |
| 842 | !insertmacro MUI_HEADER_TEXT \ |
| 843 | $(str_vimrc_page_title) $(str_vimrc_page_subtitle) |
| 844 | |
| 845 | nsDialogs::Create 1018 |
| 846 | Pop $vim_dialog |
| 847 | |
| 848 | ${If} $vim_dialog == error |
| 849 | Abort |
| 850 | ${EndIf} |
| 851 | |
| 852 | ${If} ${RunningX64} |
| 853 | SetRegView 64 |
| 854 | ${EndIf} |
| 855 | |
| 856 | GetFunctionAddress $3 ValidateCustom |
| 857 | nsDialogs::OnBack $3 |
| 858 | |
| 859 | |
| 860 | # 1st group - Compatibility |
| 861 | ${NSD_CreateGroupBox} 0 0 100% 32% $(str_msg_compat_title) |
| 862 | Pop $3 |
| 863 | |
| 864 | ${NSD_CreateLabel} 5% 10% 35% 8% $(str_msg_compat_desc) |
| 865 | Pop $3 |
| 866 | ${NSD_CreateDropList} 18% 19% 75% 8% "" |
| 867 | Pop $vim_nsd_compat |
| 868 | ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vi) |
| 869 | ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vim) |
| 870 | ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_defaults) |
| 871 | ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_all) |
| 872 | |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 873 | ${If} $vim_compat_stat == "defaults" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 874 | StrCpy $4 2 |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 875 | ${ElseIf} $vim_compat_stat == "vim" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 876 | StrCpy $4 1 |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 877 | ${ElseIf} $vim_compat_stat == "vi" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 878 | StrCpy $4 0 |
| 879 | ${Else} # default |
| 880 | StrCpy $4 3 |
| 881 | ${EndIf} |
| 882 | ${NSD_CB_SetSelectionIndex} $vim_nsd_compat $4 |
| 883 | |
| 884 | |
| 885 | # 2nd group - Key remapping |
| 886 | ${NSD_CreateGroupBox} 0 35% 100% 31% $(str_msg_keymap_title) |
| 887 | Pop $3 |
| 888 | |
| 889 | ${NSD_CreateLabel} 5% 45% 90% 8% $(str_msg_keymap_desc) |
| 890 | Pop $3 |
| 891 | ${NSD_CreateDropList} 38% 54% 55% 8% "" |
| 892 | Pop $vim_nsd_keymap |
| 893 | ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_default) |
| 894 | ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_windows) |
| 895 | |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 896 | ${If} $vim_keymap_stat == "windows" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 897 | StrCpy $4 1 |
| 898 | ${Else} # default |
| 899 | StrCpy $4 0 |
| 900 | ${EndIf} |
| 901 | ${NSD_CB_SetSelectionIndex} $vim_nsd_keymap $4 |
| 902 | |
| 903 | |
| 904 | # 3rd group - Mouse behavior |
| 905 | ${NSD_CreateGroupBox} 0 69% 100% 31% $(str_msg_mouse_title) |
| 906 | Pop $3 |
| 907 | |
| 908 | ${NSD_CreateLabel} 5% 79% 90% 8% $(str_msg_mouse_desc) |
| 909 | Pop $3 |
| 910 | ${NSD_CreateDropList} 23% 87% 70% 8% "" |
| 911 | Pop $vim_nsd_mouse |
| 912 | ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_default) |
| 913 | ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_windows) |
| 914 | ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_unix) |
| 915 | |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 916 | ${If} $vim_mouse_stat == "xterm" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 917 | StrCpy $4 2 |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 918 | ${ElseIf} $vim_mouse_stat == "windows" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 919 | StrCpy $4 1 |
| 920 | ${Else} # default |
| 921 | StrCpy $4 0 |
| 922 | ${EndIf} |
| 923 | ${NSD_CB_SetSelectionIndex} $vim_nsd_mouse $4 |
| 924 | |
| 925 | ${If} ${RunningX64} |
| 926 | SetRegView lastused |
| 927 | ${EndIf} |
| 928 | |
| 929 | nsDialogs::Show |
| 930 | FunctionEnd |
| 931 | |
| 932 | Function ValidateCustom |
| 933 | ${NSD_CB_GetSelectionIndex} $vim_nsd_compat $3 |
| 934 | ${If} $3 = 0 |
| 935 | StrCpy $vim_compat_stat "vi" |
| 936 | ${ElseIf} $3 = 1 |
| 937 | StrCpy $vim_compat_stat "vim" |
| 938 | ${ElseIf} $3 = 2 |
| 939 | StrCpy $vim_compat_stat "defaults" |
| 940 | ${Else} |
| 941 | StrCpy $vim_compat_stat "all" |
| 942 | ${EndIf} |
| 943 | |
| 944 | ${NSD_CB_GetSelectionIndex} $vim_nsd_keymap $3 |
| 945 | ${If} $3 = 0 |
| 946 | StrCpy $vim_keymap_stat "default" |
| 947 | ${Else} |
| 948 | StrCpy $vim_keymap_stat "windows" |
| 949 | ${EndIf} |
| 950 | |
| 951 | ${NSD_CB_GetSelectionIndex} $vim_nsd_mouse $3 |
| 952 | ${If} $3 = 0 |
| 953 | StrCpy $vim_mouse_stat "default" |
| 954 | ${ElseIf} $3 = 1 |
| 955 | StrCpy $vim_mouse_stat "windows" |
| 956 | ${Else} |
| 957 | StrCpy $vim_mouse_stat "xterm" |
| 958 | ${EndIf} |
| 959 | FunctionEnd |
| 960 | |
| 961 | ########################################################## |
| 962 | # Description for Installer Sections |
| 963 | |
| 964 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN |
| 965 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_old_ver} $(str_desc_old_ver) |
| 966 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_exe} $(str_desc_exe) |
| 967 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_console} $(str_desc_console) |
| 968 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_batch} $(str_desc_batch) |
| 969 | !insertmacro MUI_DESCRIPTION_TEXT ${id_group_icons} $(str_desc_icons) |
| 970 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_desktop} $(str_desc_desktop) |
| 971 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_startmenu} $(str_desc_start_menu) |
| 972 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_editwith} $(str_desc_edit_with) |
| 973 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_vimrc} $(str_desc_vim_rc) |
| 974 | !insertmacro MUI_DESCRIPTION_TEXT ${id_group_plugin} $(str_desc_plugin) |
| 975 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginhome} $(str_desc_plugin_home) |
| 976 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginvim} $(str_desc_plugin_vim) |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 977 | !if ${HAVE_NLS} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 978 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_nls} $(str_desc_nls) |
| 979 | !endif |
| 980 | !insertmacro MUI_FUNCTION_DESCRIPTION_END |
| 981 | |
| 982 | |
| 983 | ########################################################## |
| 984 | # Uninstaller Functions and Sections |
| 985 | |
| 986 | Function un.onInit |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 987 | !if ${HAVE_MULTI_LANG} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 988 | # Get the language from the registry. |
| 989 | !insertmacro MUI_UNGETLANGUAGE |
| 990 | !endif |
| 991 | FunctionEnd |
| 992 | |
| 993 | Section "un.$(str_unsection_register)" id_unsection_register |
| 994 | SectionIn RO |
| 995 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 996 | # Apparently $INSTDIR is set to the directory where the uninstaller is |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 997 | # created. Thus the "vim91" directory is included in it. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 998 | StrCpy $0 "$INSTDIR" |
| 999 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1000 | # delete the context menu entry and batch files |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1001 | DetailPrint "$(str_msg_unregistering)" |
Bram Moolenaar | 30e8e73 | 2019-09-27 13:08:36 +0200 | [diff] [blame] | 1002 | nsExec::Exec "$0\uninstall.exe -nsis" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1003 | Pop $3 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1004 | |
| 1005 | # We may have been put to the background when uninstall did something. |
| 1006 | BringToFront |
| 1007 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1008 | # Delete the installer language setting. |
| 1009 | DeleteRegKey ${MUI_LANGDLL_REGISTRY_ROOT} ${MUI_LANGDLL_REGISTRY_KEY} |
| 1010 | SectionEnd |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1011 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1012 | Section "un.$(str_unsection_exe)" id_unsection_exe |
| 1013 | |
| 1014 | StrCpy $0 "$INSTDIR" |
| 1015 | |
| 1016 | # Delete gettext and iconv DLLs |
| 1017 | ${If} ${FileExists} "$0\libiconv-2.dll" |
| 1018 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1019 | "$0\libiconv-2.dll" |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 1020 | ${EndIf} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1021 | ${If} ${FileExists} "$0\libintl-8.dll" |
| 1022 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1023 | "$0\libintl-8.dll" |
| 1024 | ${EndIf} |
| 1025 | ${If} ${FileExists} "$0\libgcc_s_sjlj-1.dll" |
| 1026 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1027 | "$0\libgcc_s_sjlj-1.dll" |
| 1028 | ${EndIf} |
| 1029 | |
| 1030 | # Delete other DLLs |
| 1031 | Delete /REBOOTOK $0\*.dll |
| 1032 | |
| 1033 | # Delete 64-bit GvimExt |
| 1034 | ${If} ${RunningX64} |
| 1035 | !define LIBRARY_X64 |
| 1036 | ${If} ${FileExists} "$0\GvimExt64\gvimext.dll" |
| 1037 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1038 | "$0\GvimExt64\gvimext.dll" |
| 1039 | ${EndIf} |
| 1040 | ${If} ${FileExists} "$0\GvimExt64\libiconv-2.dll" |
| 1041 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1042 | "$0\GvimExt64\libiconv-2.dll" |
| 1043 | ${EndIf} |
| 1044 | ${If} ${FileExists} "$0\GvimExt64\libintl-8.dll" |
| 1045 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1046 | "$0\GvimExt64\libintl-8.dll" |
| 1047 | ${EndIf} |
| 1048 | ${If} ${FileExists} "$0\GvimExt64\libwinpthread-1.dll" |
| 1049 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1050 | "$0\GvimExt64\libwinpthread-1.dll" |
| 1051 | ${EndIf} |
| 1052 | !undef LIBRARY_X64 |
| 1053 | RMDir /r $0\GvimExt64 |
| 1054 | ${EndIf} |
| 1055 | |
| 1056 | # Delete 32-bit GvimExt |
| 1057 | ${If} ${FileExists} "$0\GvimExt32\gvimext.dll" |
| 1058 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1059 | "$0\GvimExt32\gvimext.dll" |
| 1060 | ${EndIf} |
| 1061 | ${If} ${FileExists} "$0\GvimExt32\libiconv-2.dll" |
| 1062 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1063 | "$0\GvimExt32\libiconv-2.dll" |
| 1064 | ${EndIf} |
| 1065 | ${If} ${FileExists} "$0\GvimExt32\libintl-8.dll" |
| 1066 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1067 | "$0\GvimExt32\libintl-8.dll" |
| 1068 | ${EndIf} |
| 1069 | ${If} ${FileExists} "$0\GvimExt32\libgcc_s_sjlj-1.dll" |
| 1070 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1071 | "$0\GvimExt32\libgcc_s_sjlj-1.dll" |
| 1072 | ${EndIf} |
| 1073 | RMDir /r $0\GvimExt32 |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 1074 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1075 | ClearErrors |
| 1076 | # Remove everything but *.dll files. Avoids that |
| 1077 | # a lot remains when gvimext.dll cannot be deleted. |
Bram Moolenaar | 408b585 | 2006-05-13 10:44:07 +0000 | [diff] [blame] | 1078 | RMDir /r $0\autoload |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1079 | RMDir /r $0\colors |
| 1080 | RMDir /r $0\compiler |
| 1081 | RMDir /r $0\doc |
| 1082 | RMDir /r $0\ftplugin |
Bram Moolenaar | 44433da | 2022-05-06 18:08:52 +0100 | [diff] [blame] | 1083 | RMDir /r $0\import |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1084 | RMDir /r $0\indent |
| 1085 | RMDir /r $0\macros |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1086 | RMDir /r $0\pack |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1087 | RMDir /r $0\plugin |
Bram Moolenaar | 408b585 | 2006-05-13 10:44:07 +0000 | [diff] [blame] | 1088 | RMDir /r $0\spell |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1089 | RMDir /r $0\syntax |
| 1090 | RMDir /r $0\tools |
| 1091 | RMDir /r $0\tutor |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1092 | RMDir /r $0\lang |
| 1093 | RMDir /r $0\keymap |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 1094 | RMDir /r $0\bitmaps |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1095 | Delete $0\*.exe |
| 1096 | Delete $0\*.bat |
| 1097 | Delete $0\*.vim |
| 1098 | Delete $0\*.txt |
| 1099 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1100 | ${If} ${Errors} |
| 1101 | MessageBox MB_OK|MB_ICONEXCLAMATION $(str_msg_rm_exe_fail) /SD IDOK |
| 1102 | ${EndIf} |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1103 | |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 1104 | # No error message if the "vim91" directory can't be removed, the |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1105 | # gvimext.dll may still be there. |
| 1106 | RMDir $0 |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1107 | SectionEnd |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1108 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1109 | # Remove "vimfiles" directory under the specified directory. |
| 1110 | !macro RemoveVimfiles dir |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 1111 | ${If} ${FileExists} ${dir}\_viminfo |
| 1112 | Delete ${dir}\_viminfo |
| 1113 | ${EndIf} |
| 1114 | ${If} ${DirExists} ${dir}\vimfiles |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1115 | RMDir ${dir}\vimfiles\colors |
| 1116 | RMDir ${dir}\vimfiles\compiler |
| 1117 | RMDir ${dir}\vimfiles\doc |
| 1118 | RMDir ${dir}\vimfiles\ftdetect |
| 1119 | RMDir ${dir}\vimfiles\ftplugin |
| 1120 | RMDir ${dir}\vimfiles\indent |
| 1121 | RMDir ${dir}\vimfiles\keymap |
| 1122 | RMDir ${dir}\vimfiles\plugin |
| 1123 | RMDir ${dir}\vimfiles\syntax |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 1124 | ${If} ${FileExists} ${dir}\vimfiles\.netrwhist* |
| 1125 | Delete ${dir}\vimfiles\.netrwhist* |
| 1126 | ${EndIf} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1127 | RMDir ${dir}\vimfiles |
| 1128 | ${EndIf} |
| 1129 | !macroend |
| 1130 | |
| 1131 | SectionGroup "un.$(str_ungroup_plugin)" id_ungroup_plugin |
| 1132 | Section /o "un.$(str_unsection_plugin_home)" id_unsection_plugin_home |
| 1133 | # get the home dir |
Christopher Plewright | eea0a00 | 2023-02-17 20:04:51 +0000 | [diff] [blame] | 1134 | Call un.GetHomeDir |
| 1135 | Pop $0 |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1136 | |
| 1137 | ${If} $0 != "" |
| 1138 | !insertmacro RemoveVimfiles $0 |
| 1139 | ${EndIf} |
| 1140 | SectionEnd |
| 1141 | |
| 1142 | Section "un.$(str_unsection_plugin_vim)" id_unsection_plugin_vim |
| 1143 | # get the parent dir of the installation |
| 1144 | Push $INSTDIR |
| 1145 | Call un.GetParent |
| 1146 | Pop $0 |
| 1147 | |
| 1148 | # if a plugin dir was created at installation remove it |
| 1149 | !insertmacro RemoveVimfiles $0 |
| 1150 | SectionEnd |
| 1151 | SectionGroupEnd |
| 1152 | |
| 1153 | Section "un.$(str_unsection_rootdir)" id_unsection_rootdir |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1154 | # get the parent dir of the installation |
| 1155 | Push $INSTDIR |
| 1156 | Call un.GetParent |
| 1157 | Pop $0 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1158 | |
Bram Moolenaar | a8d22e3 | 2019-04-12 21:29:33 +0200 | [diff] [blame] | 1159 | ${IfNot} ${Silent} |
| 1160 | Delete $0\_vimrc |
| 1161 | ${Endif} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1162 | RMDir $0 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1163 | SectionEnd |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1164 | |
| 1165 | ########################################################## |
| 1166 | # Description for Uninstaller Sections |
| 1167 | |
| 1168 | !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN |
| 1169 | !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_register} $(str_desc_unregister) |
| 1170 | !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_exe} $(str_desc_rm_exe) |
| 1171 | !insertmacro MUI_DESCRIPTION_TEXT ${id_ungroup_plugin} $(str_desc_rm_plugin) |
| 1172 | !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_home} $(str_desc_rm_plugin_home) |
| 1173 | !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_vim} $(str_desc_rm_plugin_vim) |
| 1174 | !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_rootdir} $(str_desc_rm_rootdir) |
| 1175 | !insertmacro MUI_UNFUNCTION_DESCRIPTION_END |