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