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