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