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 | 74a2331 | 2024-03-28 09:19:44 +0000 | [diff] [blame] | 3 | # Last Change: 2024 Mar 20 |
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 |
Restorer | 74a2331 | 2024-03-28 09:19:44 +0000 | [diff] [blame] | 160 | !define MUI_FINISHPAGE_SHOWREADME |
| 161 | !define MUI_FINISHPAGE_SHOWREADME_TEXT $(str_show_readme) |
| 162 | !define MUI_FINISHPAGE_SHOWREADME_FUNCTION LaunchApplication |
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 |
Restorer | 74a2331 | 2024-03-28 09:19:44 +0000 | [diff] [blame] | 186 | !insertmacro MUI_PAGE_LICENSE $(page_lic_file) |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 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 |
Restorer | 74a2331 | 2024-03-28 09:19:44 +0000 | [diff] [blame] | 368 | ShellExecAsUser::ShellExecAsUser "" "$0\gvim.exe" '-R "$0\$(vim_readme_file)"' |
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 |
RestorerZ | 49f1e19 | 2024-04-09 23:04:44 +0200 | [diff] [blame] | 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 | |
Restorer | 74a2331 | 2024-03-28 09:19:44 +0000 | [diff] [blame] | 618 | #; FIXME: When adding new translations, do not forget to make changes here. |
| 619 | SetOutPath $0 |
| 620 | !if /FileExists ..\README.dax.txt |
| 621 | ${If} $Language = ${LANG_DANISH} |
| 622 | File ..\README.dax.txt |
| 623 | ${EndIf} |
| 624 | !endif |
| 625 | !if /FileExists ..\README.nlx.txt |
| 626 | ${If} $Language = ${LANG_DUTCH} |
| 627 | File ..\README.nlx.txt |
| 628 | ${EndIf} |
| 629 | !endif |
| 630 | !if /FileExists ..\README.dex.txt |
| 631 | ${If} $Language = ${LANG_GERMAN} |
| 632 | File ..\README.dex.txt |
| 633 | ${EndIf} |
| 634 | !endif |
| 635 | !if /FileExists ..\README.itx.txt |
| 636 | ${If} $Language = ${LANG_ITALIAN} |
| 637 | File ..\README.itx.txt |
| 638 | ${EndIf} |
| 639 | !endif |
| 640 | !if /FileExists ..\README.jax.txt |
| 641 | ${If} $Language = ${LANG_JAPANESE} |
| 642 | File ..\README.jax.txt |
| 643 | ${EndIf} |
| 644 | !endif |
| 645 | !if /FileExists ..\README.rux.txt |
| 646 | ${If} $Language = ${LANG_RUSSIAN} |
| 647 | File ..\README.rux.txt |
| 648 | ${EndIf} |
| 649 | !endif |
| 650 | !if /FileExists ..\README.srx.txt |
| 651 | ${If} $Language = ${LANG_SERBIAN} |
| 652 | File ..\README.srx.txt |
| 653 | ${EndIf} |
| 654 | !endif |
| 655 | !if /FileExists ..\README.cnx.txt |
| 656 | ${If} $Language = ${LANG_SIMPCHINESE} |
| 657 | File ..\README.cnx.txt |
| 658 | ${EndIf} |
| 659 | !endif |
| 660 | !if /FileExists ..\README.twx.txt |
| 661 | ${If} $Language = ${LANG_TRADCHINESE} |
| 662 | File ..\README.twx.txt |
| 663 | ${EndIf} |
| 664 | !endif |
| 665 | !if /FileExists ..\README.trx.txt |
| 666 | ${OrIf} $Language = ${LANG_TURKISH} |
| 667 | File ..\README.trx.txt |
| 668 | ${EndIf} |
| 669 | !endif |
| 670 | #; FIXME: When adding new translations, do not forget to make changes here. |
| 671 | SetOutPath $0\doc |
| 672 | !if /FileExists "${VIMRT}\doc\uganda.dax" |
| 673 | ${If} $Language = ${LANG_DANISH} |
| 674 | File ${VIMRT}\doc\uganda.dax |
| 675 | ${EndIf} |
| 676 | !endif |
| 677 | !if /FileExists "${VIMRT}\doc\uganda.nlx" |
| 678 | ${If} $Language = ${LANG_DUTCH} |
| 679 | File ${VIMRT}\doc\uganda.nlx |
| 680 | ${EndIf} |
| 681 | !endif |
| 682 | !if /FileExists "${VIMRT}\doc\uganda.dex" |
| 683 | ${If} $Language = ${LANG_GERMAN} |
| 684 | File ${VIMRT}\doc\uganda.dex |
| 685 | ${EndIf} |
| 686 | !endif |
| 687 | !if /FileExists "${VIMRT}\doc\uganda.itx" |
| 688 | ${If} $Language = ${LANG_ITALIAN} |
| 689 | File ${VIMRT}\doc\uganda.itx |
| 690 | ${EndIf} |
| 691 | !endif |
| 692 | !if /FileExists "${VIMRT}\doc\uganda.jax" |
| 693 | ${If} $Language = ${LANG_JAPANESE} |
| 694 | File ${VIMRT}\doc\uganda.jax |
| 695 | ${EndIf} |
| 696 | !endif |
| 697 | !if /FileExists "${VIMRT}\doc\uganda.rux" |
| 698 | ${If} $Language = ${LANG_RUSSIAN} |
| 699 | File ${VIMRT}\doc\uganda.rux |
| 700 | ${EndIf} |
| 701 | !endif |
| 702 | !if /FileExists "${VIMRT}\doc\uganda.srx" |
| 703 | ${If} $Language = ${LANG_SERBIAN} |
| 704 | File ${VIMRT}\doc\uganda.srx |
| 705 | ${EndIf} |
| 706 | !endif |
| 707 | !if /FileExists "${VIMRT}\doc\uganda.cnx" |
| 708 | ${If} $Language = ${LANG_SIMPCHINESE} |
| 709 | File ${VIMRT}\doc\uganda.cnx |
| 710 | ${EndIf} |
| 711 | !endif |
| 712 | !if /FileExists "${VIMRT}\doc\uganda.twx" |
| 713 | ${If} $Language = ${LANG_TRADCHINESE} |
| 714 | File ${VIMRT}\doc\uganda.twx |
| 715 | ${EndIf} |
| 716 | !endif |
| 717 | !if /FileExists "${VIMRT}\doc\uganda.trx" |
| 718 | ${If} $Language = ${LANG_TURKISH} |
| 719 | File ${VIMRT}\doc\uganda.trx |
| 720 | ${EndIf} |
| 721 | !endif |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 722 | SetOutPath $0\lang |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 723 | File /r /x Makefile ${VIMRT}\lang\*.* |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 724 | SetOutPath $0 |
| 725 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 726 | "${GETTEXT}\gettext${BIT}\libintl-8.dll" \ |
| 727 | "$0\libintl-8.dll" "$0" |
| 728 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 729 | "${GETTEXT}\gettext${BIT}\libiconv-2.dll" \ |
| 730 | "$0\libiconv-2.dll" "$0" |
RestorerZ | 49f1e19 | 2024-04-09 23:04:44 +0200 | [diff] [blame] | 731 | # Install libgcc_s_sjlj-1.dll only if it is needed. |
| 732 | # !if /FileExists "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll" |
| 733 | # !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 734 | # "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll" \ |
| 735 | # "$0\libgcc_s_sjlj-1.dll" "$0" |
| 736 | # !endif |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 737 | |
| 738 | ${If} ${SectionIsSelected} ${id_section_editwith} |
| 739 | ${If} ${RunningX64} |
| 740 | # Install DLLs for 64-bit gvimext.dll into the GvimExt64 directory. |
| 741 | SetOutPath $0\GvimExt64 |
| 742 | ClearErrors |
| 743 | !define LIBRARY_X64 |
| 744 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 745 | "${GETTEXT}\gettext64\libintl-8.dll" \ |
| 746 | "$0\GvimExt64\libintl-8.dll" "$0\GvimExt64" |
| 747 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 748 | "${GETTEXT}\gettext64\libiconv-2.dll" \ |
| 749 | "$0\GvimExt64\libiconv-2.dll" "$0\GvimExt64" |
| 750 | !undef LIBRARY_X64 |
| 751 | ${EndIf} |
| 752 | |
| 753 | # Install DLLs for 32-bit gvimext.dll into the GvimExt32 directory. |
| 754 | SetOutPath $0\GvimExt32 |
| 755 | ClearErrors |
| 756 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 757 | "${GETTEXT}\gettext32\libintl-8.dll" \ |
| 758 | "$0\GvimExt32\libintl-8.dll" "$0\GvimExt32" |
| 759 | !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 760 | "${GETTEXT}\gettext32\libiconv-2.dll" \ |
| 761 | "$0\GvimExt32\libiconv-2.dll" "$0\GvimExt32" |
RestorerZ | 49f1e19 | 2024-04-09 23:04:44 +0200 | [diff] [blame] | 762 | # Install libgcc_s_sjlj-1.dll only if it is needed. |
| 763 | # !if /FileExists "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll" |
| 764 | # !insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 765 | # "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll" \ |
| 766 | # "$0\GvimExt32\libgcc_s_sjlj-1.dll" "$0\GvimExt32" |
| 767 | # !endif |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 768 | ${EndIf} |
| 769 | SectionEnd |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 770 | !endif |
| 771 | |
| 772 | ########################################################## |
| 773 | Section -call_install_exe |
| 774 | SetOutPath $0 |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 775 | DetailPrint "$(str_msg_registering)" |
| 776 | nsExec::Exec "$0\install.exe $1" |
| 777 | Pop $3 |
Christopher Plewright | eea0a00 | 2023-02-17 20:04:51 +0000 | [diff] [blame] | 778 | |
| 779 | ${If} ${SectionIsSelected} ${id_section_pluginhome} |
| 780 | ReadEnvStr $3 "COMSPEC" |
| 781 | Call GetHomeDir |
| 782 | Pop $4 |
| 783 | ShellExecAsUser::ShellExecAsUser "" "$3" '/c "cd /d "$4" & mkdir vimfiles & cd vimfiles & mkdir colors compiler doc ftdetect ftplugin indent keymap plugin syntax"' SW_HIDE |
| 784 | ${EndIf} |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 785 | SectionEnd |
| 786 | |
| 787 | ########################################################## |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 788 | !macro SaveSectionSelection section_id reg_value |
| 789 | ${If} ${SectionIsSelected} ${section_id} |
| 790 | WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 1 |
| 791 | ${Else} |
| 792 | WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} 0 |
| 793 | ${EndIf} |
| 794 | !macroend |
| 795 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 796 | Section -post |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 797 | |
| 798 | # Get estimated install size |
| 799 | SectionGetSize ${id_section_exe} $3 |
| 800 | ${If} ${SectionIsSelected} ${id_section_console} |
| 801 | SectionGetSize ${id_section_console} $4 |
| 802 | IntOp $3 $3 + $4 |
| 803 | ${EndIf} |
| 804 | ${If} ${SectionIsSelected} ${id_section_editwith} |
| 805 | SectionGetSize ${id_section_editwith} $4 |
| 806 | IntOp $3 $3 + $4 |
| 807 | ${EndIf} |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 808 | !if ${HAVE_NLS} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 809 | ${If} ${SectionIsSelected} ${id_section_nls} |
| 810 | SectionGetSize ${id_section_nls} $4 |
| 811 | IntOp $3 $3 + $4 |
| 812 | ${EndIf} |
| 813 | !endif |
| 814 | |
| 815 | # Register EstimatedSize and AllowSilent. |
| 816 | # Other information will be set by the install.exe (dosinst.c). |
| 817 | ${If} ${RunningX64} |
| 818 | SetRegView 64 |
| 819 | ${EndIf} |
| 820 | WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "EstimatedSize" $3 |
| 821 | WriteRegDWORD HKLM "${UNINST_REG_KEY_VIM}" "AllowSilent" 1 |
| 822 | ${If} ${RunningX64} |
| 823 | SetRegView lastused |
| 824 | ${EndIf} |
| 825 | |
| 826 | # Store the selections to the registry. |
| 827 | ${If} ${RunningX64} |
| 828 | SetRegView 64 |
| 829 | ${EndIf} |
| 830 | !insertmacro SaveSectionSelection ${id_section_console} "select_console" |
| 831 | !insertmacro SaveSectionSelection ${id_section_batch} "select_batch" |
| 832 | !insertmacro SaveSectionSelection ${id_section_desktop} "select_desktop" |
| 833 | !insertmacro SaveSectionSelection ${id_section_startmenu} "select_startmenu" |
| 834 | !insertmacro SaveSectionSelection ${id_section_editwith} "select_editwith" |
| 835 | !insertmacro SaveSectionSelection ${id_section_vimrc} "select_vimrc" |
| 836 | !insertmacro SaveSectionSelection ${id_section_pluginhome} "select_pluginhome" |
| 837 | !insertmacro SaveSectionSelection ${id_section_pluginvim} "select_pluginvim" |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 838 | !if ${HAVE_NLS} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 839 | !insertmacro SaveSectionSelection ${id_section_nls} "select_nls" |
| 840 | !endif |
| 841 | ${If} ${RunningX64} |
| 842 | SetRegView lastused |
| 843 | ${EndIf} |
| 844 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 845 | BringToFront |
| 846 | SectionEnd |
| 847 | |
| 848 | ########################################################## |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 849 | !macro LoadSectionSelection section_id reg_value |
| 850 | ClearErrors |
| 851 | ReadRegDWORD $3 HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} |
| 852 | ${IfNot} ${Errors} |
| 853 | ${If} $3 = 1 |
| 854 | !insertmacro SelectSection ${section_id} |
| 855 | ${Else} |
| 856 | !insertmacro UnselectSection ${section_id} |
| 857 | ${EndIf} |
| 858 | ${EndIf} |
| 859 | !macroend |
Bram Moolenaar | c3fdf7f | 2017-10-28 18:36:48 +0200 | [diff] [blame] | 860 | |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 861 | !macro LoadDefaultVimrc out_var reg_value default_value |
| 862 | ClearErrors |
| 863 | ReadRegStr ${out_var} HKLM "${UNINST_REG_KEY_VIM}" ${reg_value} |
| 864 | ${If} ${Errors} |
| 865 | ${OrIf} ${out_var} == "" |
| 866 | StrCpy ${out_var} ${default_value} |
| 867 | ${EndIf} |
| 868 | !macroend |
| 869 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 870 | Function .onInit |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 871 | !if ${HAVE_MULTI_LANG} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 872 | # Select a language (or read from the registry). |
| 873 | !insertmacro MUI_LANGDLL_DISPLAY |
| 874 | !endif |
Bram Moolenaar | c3fdf7f | 2017-10-28 18:36:48 +0200 | [diff] [blame] | 875 | |
Christian Brabandt | 7d60384 | 2021-07-24 21:19:42 +0200 | [diff] [blame] | 876 | ${If} $INSTDIR == ${DEFAULT_INSTDIR} |
| 877 | # Check $VIM |
| 878 | ReadEnvStr $3 "VIM" |
| 879 | ${If} $3 != "" |
| 880 | StrCpy $INSTDIR $3 |
| 881 | ${EndIf} |
| 882 | ${EndIf} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 883 | |
| 884 | call CheckOldVim |
| 885 | Pop $3 |
| 886 | ${If} $3 == "" |
| 887 | # No old versions of Vim found. Unselect and hide the section. |
| 888 | !insertmacro UnselectSection ${id_section_old_ver} |
| 889 | SectionSetInstTypes ${id_section_old_ver} 0 |
| 890 | SectionSetText ${id_section_old_ver} "" |
| 891 | ${Else} |
Christian Brabandt | 7d60384 | 2021-07-24 21:19:42 +0200 | [diff] [blame] | 892 | ${If} $INSTDIR == ${DEFAULT_INSTDIR} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 893 | StrCpy $INSTDIR $3 |
| 894 | ${EndIf} |
| 895 | ${EndIf} |
| 896 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 897 | ${If} ${RunningX64} |
| 898 | SetRegView 64 |
| 899 | ${EndIf} |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 900 | # Load the selections from the registry (if any). |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 901 | !insertmacro LoadSectionSelection ${id_section_console} "select_console" |
| 902 | !insertmacro LoadSectionSelection ${id_section_batch} "select_batch" |
| 903 | !insertmacro LoadSectionSelection ${id_section_desktop} "select_desktop" |
| 904 | !insertmacro LoadSectionSelection ${id_section_startmenu} "select_startmenu" |
| 905 | !insertmacro LoadSectionSelection ${id_section_editwith} "select_editwith" |
| 906 | !insertmacro LoadSectionSelection ${id_section_vimrc} "select_vimrc" |
| 907 | !insertmacro LoadSectionSelection ${id_section_pluginhome} "select_pluginhome" |
| 908 | !insertmacro LoadSectionSelection ${id_section_pluginvim} "select_pluginvim" |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 909 | !if ${HAVE_NLS} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 910 | !insertmacro LoadSectionSelection ${id_section_nls} "select_nls" |
| 911 | !endif |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 912 | # Load the default _vimrc settings from the registry (if any). |
| 913 | !insertmacro LoadDefaultVimrc $vim_compat_stat "vim_compat" "all" |
| 914 | !insertmacro LoadDefaultVimrc $vim_keymap_stat "vim_keyremap" "default" |
| 915 | !insertmacro LoadDefaultVimrc $vim_mouse_stat "vim_mouse" "default" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 916 | ${If} ${RunningX64} |
| 917 | SetRegView lastused |
| 918 | ${EndIf} |
| 919 | |
| 920 | # User variables: |
| 921 | # $0 - holds the directory the executables are installed to |
| 922 | # $1 - holds the parameters to be passed to install.exe. Starts with OLE |
| 923 | # registration (since a non-OLE gvim will not complain, and we want to |
| 924 | # always register an OLE gvim). |
| 925 | # $2 - holds the names to create batch files for |
| 926 | StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" |
| 927 | StrCpy $1 "-register-OLE" |
| 928 | StrCpy $2 "gvim evim gview gvimdiff vimtutor" |
Bram Moolenaar | c3fdf7f | 2017-10-28 18:36:48 +0200 | [diff] [blame] | 929 | FunctionEnd |
| 930 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 931 | Function .onInstSuccess |
| 932 | WriteUninstaller vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe |
| 933 | FunctionEnd |
Bram Moolenaar | c3fdf7f | 2017-10-28 18:36:48 +0200 | [diff] [blame] | 934 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 935 | Function .onInstFailed |
| 936 | MessageBox MB_OK|MB_ICONEXCLAMATION "$(str_msg_install_fail)" /SD IDOK |
Bram Moolenaar | c3fdf7f | 2017-10-28 18:36:48 +0200 | [diff] [blame] | 937 | FunctionEnd |
| 938 | |
| 939 | ########################################################## |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 940 | Function SetCustom |
| 941 | # Display the _vimrc setting dialog using nsDialogs. |
| 942 | |
| 943 | # Check if a _vimrc should be created |
| 944 | ${IfNot} ${SectionIsSelected} ${id_section_vimrc} |
| 945 | Abort |
| 946 | ${EndIf} |
| 947 | |
| 948 | !insertmacro MUI_HEADER_TEXT \ |
| 949 | $(str_vimrc_page_title) $(str_vimrc_page_subtitle) |
| 950 | |
| 951 | nsDialogs::Create 1018 |
| 952 | Pop $vim_dialog |
| 953 | |
| 954 | ${If} $vim_dialog == error |
| 955 | Abort |
| 956 | ${EndIf} |
| 957 | |
| 958 | ${If} ${RunningX64} |
| 959 | SetRegView 64 |
| 960 | ${EndIf} |
| 961 | |
| 962 | GetFunctionAddress $3 ValidateCustom |
| 963 | nsDialogs::OnBack $3 |
| 964 | |
| 965 | |
| 966 | # 1st group - Compatibility |
Restorer | 6dcf59b | 2024-03-25 15:38:37 +0000 | [diff] [blame] | 967 | ${NSD_CreateGroupBox} 0u 0u 296u 44u $(str_msg_compat_title) |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 968 | Pop $3 |
| 969 | |
Restorer | 6dcf59b | 2024-03-25 15:38:37 +0000 | [diff] [blame] | 970 | ${NSD_CreateLabel} 16u 14u 269u 10u $(str_msg_compat_desc) |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 971 | Pop $3 |
Restorer | 6dcf59b | 2024-03-25 15:38:37 +0000 | [diff] [blame] | 972 | ${NSD_CreateDropList} 42u 26u 237u 13u "" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 973 | Pop $vim_nsd_compat |
| 974 | ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vi) |
| 975 | ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_vim) |
| 976 | ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_defaults) |
| 977 | ${NSD_CB_AddString} $vim_nsd_compat $(str_msg_compat_all) |
| 978 | |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 979 | ${If} $vim_compat_stat == "defaults" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 980 | StrCpy $4 2 |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 981 | ${ElseIf} $vim_compat_stat == "vim" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 982 | StrCpy $4 1 |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 983 | ${ElseIf} $vim_compat_stat == "vi" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 984 | StrCpy $4 0 |
| 985 | ${Else} # default |
| 986 | StrCpy $4 3 |
| 987 | ${EndIf} |
| 988 | ${NSD_CB_SetSelectionIndex} $vim_nsd_compat $4 |
| 989 | |
| 990 | |
| 991 | # 2nd group - Key remapping |
Restorer | 6dcf59b | 2024-03-25 15:38:37 +0000 | [diff] [blame] | 992 | ${NSD_CreateGroupBox} 0u 48u 296u 44u $(str_msg_keymap_title) |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 993 | Pop $3 |
| 994 | |
Restorer | 6dcf59b | 2024-03-25 15:38:37 +0000 | [diff] [blame] | 995 | ${NSD_CreateLabel} 16u 62u 269u 10u $(str_msg_keymap_desc) |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 996 | Pop $3 |
Restorer | 6dcf59b | 2024-03-25 15:38:37 +0000 | [diff] [blame] | 997 | ${NSD_CreateDropList} 42u 74u 236u 13u "" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 998 | Pop $vim_nsd_keymap |
| 999 | ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_default) |
| 1000 | ${NSD_CB_AddString} $vim_nsd_keymap $(str_msg_keymap_windows) |
| 1001 | |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 1002 | ${If} $vim_keymap_stat == "windows" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1003 | StrCpy $4 1 |
| 1004 | ${Else} # default |
| 1005 | StrCpy $4 0 |
| 1006 | ${EndIf} |
| 1007 | ${NSD_CB_SetSelectionIndex} $vim_nsd_keymap $4 |
| 1008 | |
| 1009 | |
| 1010 | # 3rd group - Mouse behavior |
Restorer | 6dcf59b | 2024-03-25 15:38:37 +0000 | [diff] [blame] | 1011 | ${NSD_CreateGroupBox} 0u 95u 296u 44u $(str_msg_mouse_title) |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1012 | Pop $3 |
| 1013 | |
Restorer | 6dcf59b | 2024-03-25 15:38:37 +0000 | [diff] [blame] | 1014 | ${NSD_CreateLabel} 16u 108u 269u 10u $(str_msg_mouse_desc) |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1015 | Pop $3 |
Restorer | 6dcf59b | 2024-03-25 15:38:37 +0000 | [diff] [blame] | 1016 | ${NSD_CreateDropList} 42u 121u 237u 13u "" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1017 | Pop $vim_nsd_mouse |
| 1018 | ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_default) |
| 1019 | ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_windows) |
| 1020 | ${NSD_CB_AddString} $vim_nsd_mouse $(str_msg_mouse_unix) |
| 1021 | |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 1022 | ${If} $vim_mouse_stat == "xterm" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1023 | StrCpy $4 2 |
Bram Moolenaar | ceb56dd | 2020-07-14 22:24:40 +0200 | [diff] [blame] | 1024 | ${ElseIf} $vim_mouse_stat == "windows" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1025 | StrCpy $4 1 |
| 1026 | ${Else} # default |
| 1027 | StrCpy $4 0 |
| 1028 | ${EndIf} |
| 1029 | ${NSD_CB_SetSelectionIndex} $vim_nsd_mouse $4 |
| 1030 | |
| 1031 | ${If} ${RunningX64} |
| 1032 | SetRegView lastused |
| 1033 | ${EndIf} |
| 1034 | |
| 1035 | nsDialogs::Show |
| 1036 | FunctionEnd |
| 1037 | |
| 1038 | Function ValidateCustom |
| 1039 | ${NSD_CB_GetSelectionIndex} $vim_nsd_compat $3 |
| 1040 | ${If} $3 = 0 |
| 1041 | StrCpy $vim_compat_stat "vi" |
| 1042 | ${ElseIf} $3 = 1 |
| 1043 | StrCpy $vim_compat_stat "vim" |
| 1044 | ${ElseIf} $3 = 2 |
| 1045 | StrCpy $vim_compat_stat "defaults" |
| 1046 | ${Else} |
| 1047 | StrCpy $vim_compat_stat "all" |
| 1048 | ${EndIf} |
| 1049 | |
| 1050 | ${NSD_CB_GetSelectionIndex} $vim_nsd_keymap $3 |
| 1051 | ${If} $3 = 0 |
| 1052 | StrCpy $vim_keymap_stat "default" |
| 1053 | ${Else} |
| 1054 | StrCpy $vim_keymap_stat "windows" |
| 1055 | ${EndIf} |
| 1056 | |
| 1057 | ${NSD_CB_GetSelectionIndex} $vim_nsd_mouse $3 |
| 1058 | ${If} $3 = 0 |
| 1059 | StrCpy $vim_mouse_stat "default" |
| 1060 | ${ElseIf} $3 = 1 |
| 1061 | StrCpy $vim_mouse_stat "windows" |
| 1062 | ${Else} |
| 1063 | StrCpy $vim_mouse_stat "xterm" |
| 1064 | ${EndIf} |
| 1065 | FunctionEnd |
| 1066 | |
| 1067 | ########################################################## |
| 1068 | # Description for Installer Sections |
| 1069 | |
| 1070 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN |
| 1071 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_old_ver} $(str_desc_old_ver) |
| 1072 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_exe} $(str_desc_exe) |
| 1073 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_console} $(str_desc_console) |
| 1074 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_batch} $(str_desc_batch) |
| 1075 | !insertmacro MUI_DESCRIPTION_TEXT ${id_group_icons} $(str_desc_icons) |
| 1076 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_desktop} $(str_desc_desktop) |
| 1077 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_startmenu} $(str_desc_start_menu) |
| 1078 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_editwith} $(str_desc_edit_with) |
| 1079 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_vimrc} $(str_desc_vim_rc) |
| 1080 | !insertmacro MUI_DESCRIPTION_TEXT ${id_group_plugin} $(str_desc_plugin) |
| 1081 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginhome} $(str_desc_plugin_home) |
| 1082 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginvim} $(str_desc_plugin_vim) |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 1083 | !if ${HAVE_NLS} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1084 | !insertmacro MUI_DESCRIPTION_TEXT ${id_section_nls} $(str_desc_nls) |
| 1085 | !endif |
| 1086 | !insertmacro MUI_FUNCTION_DESCRIPTION_END |
| 1087 | |
| 1088 | |
| 1089 | ########################################################## |
| 1090 | # Uninstaller Functions and Sections |
| 1091 | |
| 1092 | Function un.onInit |
Restorer | 51c94b6 | 2024-03-24 09:41:18 +0000 | [diff] [blame] | 1093 | !if ${HAVE_MULTI_LANG} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1094 | # Get the language from the registry. |
| 1095 | !insertmacro MUI_UNGETLANGUAGE |
| 1096 | !endif |
| 1097 | FunctionEnd |
| 1098 | |
| 1099 | Section "un.$(str_unsection_register)" id_unsection_register |
| 1100 | SectionIn RO |
| 1101 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1102 | # Apparently $INSTDIR is set to the directory where the uninstaller is |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 1103 | # created. Thus the "vim91" directory is included in it. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1104 | StrCpy $0 "$INSTDIR" |
| 1105 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1106 | # delete the context menu entry and batch files |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1107 | DetailPrint "$(str_msg_unregistering)" |
Bram Moolenaar | 30e8e73 | 2019-09-27 13:08:36 +0200 | [diff] [blame] | 1108 | nsExec::Exec "$0\uninstall.exe -nsis" |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1109 | Pop $3 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1110 | |
| 1111 | # We may have been put to the background when uninstall did something. |
| 1112 | BringToFront |
| 1113 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1114 | # Delete the installer language setting. |
| 1115 | DeleteRegKey ${MUI_LANGDLL_REGISTRY_ROOT} ${MUI_LANGDLL_REGISTRY_KEY} |
| 1116 | SectionEnd |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1117 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1118 | Section "un.$(str_unsection_exe)" id_unsection_exe |
| 1119 | |
| 1120 | StrCpy $0 "$INSTDIR" |
| 1121 | |
| 1122 | # Delete gettext and iconv DLLs |
| 1123 | ${If} ${FileExists} "$0\libiconv-2.dll" |
| 1124 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1125 | "$0\libiconv-2.dll" |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 1126 | ${EndIf} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1127 | ${If} ${FileExists} "$0\libintl-8.dll" |
| 1128 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1129 | "$0\libintl-8.dll" |
| 1130 | ${EndIf} |
| 1131 | ${If} ${FileExists} "$0\libgcc_s_sjlj-1.dll" |
| 1132 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1133 | "$0\libgcc_s_sjlj-1.dll" |
| 1134 | ${EndIf} |
| 1135 | |
| 1136 | # Delete other DLLs |
| 1137 | Delete /REBOOTOK $0\*.dll |
| 1138 | |
| 1139 | # Delete 64-bit GvimExt |
| 1140 | ${If} ${RunningX64} |
| 1141 | !define LIBRARY_X64 |
| 1142 | ${If} ${FileExists} "$0\GvimExt64\gvimext.dll" |
| 1143 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1144 | "$0\GvimExt64\gvimext.dll" |
| 1145 | ${EndIf} |
| 1146 | ${If} ${FileExists} "$0\GvimExt64\libiconv-2.dll" |
| 1147 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1148 | "$0\GvimExt64\libiconv-2.dll" |
| 1149 | ${EndIf} |
| 1150 | ${If} ${FileExists} "$0\GvimExt64\libintl-8.dll" |
| 1151 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1152 | "$0\GvimExt64\libintl-8.dll" |
| 1153 | ${EndIf} |
| 1154 | ${If} ${FileExists} "$0\GvimExt64\libwinpthread-1.dll" |
| 1155 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1156 | "$0\GvimExt64\libwinpthread-1.dll" |
| 1157 | ${EndIf} |
| 1158 | !undef LIBRARY_X64 |
| 1159 | RMDir /r $0\GvimExt64 |
| 1160 | ${EndIf} |
| 1161 | |
| 1162 | # Delete 32-bit GvimExt |
| 1163 | ${If} ${FileExists} "$0\GvimExt32\gvimext.dll" |
| 1164 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1165 | "$0\GvimExt32\gvimext.dll" |
| 1166 | ${EndIf} |
| 1167 | ${If} ${FileExists} "$0\GvimExt32\libiconv-2.dll" |
| 1168 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1169 | "$0\GvimExt32\libiconv-2.dll" |
| 1170 | ${EndIf} |
| 1171 | ${If} ${FileExists} "$0\GvimExt32\libintl-8.dll" |
| 1172 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1173 | "$0\GvimExt32\libintl-8.dll" |
| 1174 | ${EndIf} |
| 1175 | ${If} ${FileExists} "$0\GvimExt32\libgcc_s_sjlj-1.dll" |
| 1176 | !insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \ |
| 1177 | "$0\GvimExt32\libgcc_s_sjlj-1.dll" |
| 1178 | ${EndIf} |
| 1179 | RMDir /r $0\GvimExt32 |
Bram Moolenaar | 6199d43 | 2017-10-14 19:05:44 +0200 | [diff] [blame] | 1180 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1181 | ClearErrors |
| 1182 | # Remove everything but *.dll files. Avoids that |
| 1183 | # a lot remains when gvimext.dll cannot be deleted. |
Bram Moolenaar | 408b585 | 2006-05-13 10:44:07 +0000 | [diff] [blame] | 1184 | RMDir /r $0\autoload |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1185 | RMDir /r $0\colors |
| 1186 | RMDir /r $0\compiler |
| 1187 | RMDir /r $0\doc |
| 1188 | RMDir /r $0\ftplugin |
Bram Moolenaar | 44433da | 2022-05-06 18:08:52 +0100 | [diff] [blame] | 1189 | RMDir /r $0\import |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1190 | RMDir /r $0\indent |
| 1191 | RMDir /r $0\macros |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1192 | RMDir /r $0\pack |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1193 | RMDir /r $0\plugin |
Bram Moolenaar | 408b585 | 2006-05-13 10:44:07 +0000 | [diff] [blame] | 1194 | RMDir /r $0\spell |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1195 | RMDir /r $0\syntax |
| 1196 | RMDir /r $0\tools |
| 1197 | RMDir /r $0\tutor |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1198 | RMDir /r $0\lang |
| 1199 | RMDir /r $0\keymap |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 1200 | RMDir /r $0\bitmaps |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1201 | Delete $0\*.exe |
| 1202 | Delete $0\*.bat |
| 1203 | Delete $0\*.vim |
| 1204 | Delete $0\*.txt |
| 1205 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1206 | ${If} ${Errors} |
| 1207 | MessageBox MB_OK|MB_ICONEXCLAMATION $(str_msg_rm_exe_fail) /SD IDOK |
| 1208 | ${EndIf} |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1209 | |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 1210 | # No error message if the "vim91" directory can't be removed, the |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1211 | # gvimext.dll may still be there. |
| 1212 | RMDir $0 |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1213 | SectionEnd |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1214 | |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1215 | # Remove "vimfiles" directory under the specified directory. |
| 1216 | !macro RemoveVimfiles dir |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 1217 | ${If} ${FileExists} ${dir}\_viminfo |
| 1218 | Delete ${dir}\_viminfo |
| 1219 | ${EndIf} |
| 1220 | ${If} ${DirExists} ${dir}\vimfiles |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1221 | RMDir ${dir}\vimfiles\colors |
| 1222 | RMDir ${dir}\vimfiles\compiler |
| 1223 | RMDir ${dir}\vimfiles\doc |
| 1224 | RMDir ${dir}\vimfiles\ftdetect |
| 1225 | RMDir ${dir}\vimfiles\ftplugin |
| 1226 | RMDir ${dir}\vimfiles\indent |
| 1227 | RMDir ${dir}\vimfiles\keymap |
| 1228 | RMDir ${dir}\vimfiles\plugin |
| 1229 | RMDir ${dir}\vimfiles\syntax |
RestorerZ | 2680a07 | 2024-03-20 20:15:51 +0100 | [diff] [blame] | 1230 | ${If} ${FileExists} ${dir}\vimfiles\.netrwhist* |
| 1231 | Delete ${dir}\vimfiles\.netrwhist* |
| 1232 | ${EndIf} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1233 | RMDir ${dir}\vimfiles |
| 1234 | ${EndIf} |
| 1235 | !macroend |
| 1236 | |
| 1237 | SectionGroup "un.$(str_ungroup_plugin)" id_ungroup_plugin |
| 1238 | Section /o "un.$(str_unsection_plugin_home)" id_unsection_plugin_home |
| 1239 | # get the home dir |
Christopher Plewright | eea0a00 | 2023-02-17 20:04:51 +0000 | [diff] [blame] | 1240 | Call un.GetHomeDir |
| 1241 | Pop $0 |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1242 | |
| 1243 | ${If} $0 != "" |
| 1244 | !insertmacro RemoveVimfiles $0 |
| 1245 | ${EndIf} |
| 1246 | SectionEnd |
| 1247 | |
| 1248 | Section "un.$(str_unsection_plugin_vim)" id_unsection_plugin_vim |
| 1249 | # get the parent dir of the installation |
| 1250 | Push $INSTDIR |
| 1251 | Call un.GetParent |
| 1252 | Pop $0 |
| 1253 | |
| 1254 | # if a plugin dir was created at installation remove it |
| 1255 | !insertmacro RemoveVimfiles $0 |
| 1256 | SectionEnd |
| 1257 | SectionGroupEnd |
| 1258 | |
| 1259 | Section "un.$(str_unsection_rootdir)" id_unsection_rootdir |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1260 | # get the parent dir of the installation |
| 1261 | Push $INSTDIR |
| 1262 | Call un.GetParent |
| 1263 | Pop $0 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1264 | |
Bram Moolenaar | a8d22e3 | 2019-04-12 21:29:33 +0200 | [diff] [blame] | 1265 | ${IfNot} ${Silent} |
| 1266 | Delete $0\_vimrc |
| 1267 | ${Endif} |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1268 | RMDir $0 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1269 | SectionEnd |
Bram Moolenaar | af610b8 | 2018-12-21 16:22:50 +0100 | [diff] [blame] | 1270 | |
| 1271 | ########################################################## |
| 1272 | # Description for Uninstaller Sections |
| 1273 | |
| 1274 | !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN |
| 1275 | !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_register} $(str_desc_unregister) |
| 1276 | !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_exe} $(str_desc_rm_exe) |
| 1277 | !insertmacro MUI_DESCRIPTION_TEXT ${id_ungroup_plugin} $(str_desc_rm_plugin) |
| 1278 | !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_home} $(str_desc_rm_plugin_home) |
| 1279 | !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_vim} $(str_desc_rm_plugin_vim) |
| 1280 | !insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_rootdir} $(str_desc_rm_rootdir) |
| 1281 | !insertmacro MUI_UNFUNCTION_DESCRIPTION_END |