nsis: Fix indentation and alignment issues in gvim.nsi

related: #18440

Signed-off-by: RestorerZ <restorer@mail2k.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
RestorerZ
2025-09-29 19:46:23 +00:00
committed by Christian Brabandt
parent 05e44e978f
commit f9feda2d6d

View File

@ -1,6 +1,7 @@
# NSIS file to create a self-installing exe for Vim.
# It requires NSIS version 3.0 or later.
# Last Change: 2025 Feb 24
# Last Change: 2025-08-30
#
Unicode true
@ -102,7 +103,7 @@ ${StrRep}
IfFileExists `${_b}` `0` +3
;if path is not a directory, continue to confirm exists
IfFileExists `${_b}\*.*` +2 0
StrCpy $_LOGICLIB_TEMP "1" ;file exists
StrCpy $_LOGICLIB_TEMP "1" ;file exists
;now we have a definitive value - the file exists or it does not
StrCmp $_LOGICLIB_TEMP "1" `${_t}` `${_f}`
!macroend
@ -146,9 +147,9 @@ RequestExecutionLevel highest
!endif
!if ${WIN64}
!define BIT 64
!define BIT 64
!else
!define BIT 32
!define BIT 32
!endif
##########################################################
@ -253,8 +254,10 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Vim"
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "The Vim Project"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Vim"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright (C) 1996"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Vi Improved - A Text Editor"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VER_MAJOR}.${VER_MINOR}.${PATCHLEVEL}.0"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" \
"Vi Improved - A Text Editor"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" \
"${VER_MAJOR}.${VER_MINOR}.${PATCHLEVEL}.0"
VIProductVersion "${VER_MAJOR}.${VER_MINOR}.${PATCHLEVEL}.0"
# Global variables
@ -266,10 +269,9 @@ Var vim_compat_stat
Var vim_keymap_stat
Var vim_mouse_stat
!if ${HAVE_NLS}
Var lng_usr
Var lng_usr
!endif
# Reserve files
ReserveFile ${VIMSRC}\installw32.exe
@ -435,9 +437,9 @@ Section "$(str_section_exe)" id_section_exe
SetOutPath $0
File /oname=gvim.exe ${VIMSRC}\gvim_ole.exe
!if /FileExists "${VIMSRC}\vim${BIT}.dll"
!if /FileExists "${VIMSRC}\vim${BIT}.dll"
File ${VIMSRC}\vim${BIT}.dll
!endif
!endif
File /oname=install.exe ${VIMSRC}\installw32.exe
File /oname=uninstall.exe ${VIMSRC}\uninstallw32.exe
File ${VIMSRC}\vimrun.exe
@ -449,18 +451,18 @@ Section "$(str_section_exe)" id_section_exe
File ..\uninstall.txt
File ${VIMRT}\*.vim
!if /FileExists "${VIMTOOLS}\diff.exe"
!if /FileExists "${VIMTOOLS}\diff.exe"
File ${VIMTOOLS}\diff.exe
!endif
!if /FileExists "${VIMTOOLS}\winpty${BIT}.dll"
!endif
!if /FileExists "${VIMTOOLS}\winpty${BIT}.dll"
File ${VIMTOOLS}\winpty${BIT}.dll
!endif
!if /FileExists "${VIMTOOLS}\winpty-agent.exe"
!endif
!if /FileExists "${VIMTOOLS}\winpty-agent.exe"
File ${VIMTOOLS}\winpty-agent.exe
!endif
!if /FileExists "${VIMTOOLS}\libsodium.dll"
!endif
!if /FileExists "${VIMTOOLS}\libsodium.dll"
File ${VIMTOOLS}\libsodium.dll
!endif
!endif
SetOutPath $0\colors
File /r ${VIMRT}\colors\*.*
@ -561,8 +563,7 @@ Section "$(str_section_edit_with)" id_section_editwith
!define LIBRARY_SHELL_EXTENSION
!define LIBRARY_X64
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
"${VIMSRC}\GvimExt\gvimext64.dll" \
"$0\GvimExt64\gvimext.dll" "$0"
"${VIMSRC}\GvimExt\gvimext64.dll" "$0\GvimExt64\gvimext.dll" "$0"
!undef LIBRARY_X64
!undef LIBRARY_SHELL_EXTENSION
${EndIf}
@ -572,8 +573,7 @@ Section "$(str_section_edit_with)" id_section_editwith
ClearErrors
!define LIBRARY_SHELL_EXTENSION
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
"${VIMSRC}\GvimExt\gvimext.dll" \
"$0\GvimExt32\gvimext.dll" "$0"
"${VIMSRC}\GvimExt\gvimext.dll" "$0\GvimExt32\gvimext.dll" "$0"
!undef LIBRARY_SHELL_EXTENSION
# We don't have a separate entry for the "Open With..." menu, assume
@ -620,64 +620,59 @@ Section "$(str_section_vim_rc)" id_section_vimrc
${Else}
StrCpy $1 "$1 -vimrc-behave unix"
${EndIf}
SectionEnd
##########################################################
SectionGroup $(str_group_plugin) id_group_plugin
Section "$(str_section_plugin_home)" id_section_pluginhome
SectionIn 1 3
# use ShellExecAsUser below instead
# StrCpy $1 "$1 -create-directories home"
SectionEnd
Section "$(str_section_plugin_vim)" id_section_pluginvim
SectionIn 3
StrCpy $1 "$1 -create-directories vim"
SectionEnd
SectionGroupEnd
##########################################################
!if ${HAVE_NLS}
Section "$(str_section_nls)" id_section_nls
Section "$(str_section_nls)" id_section_nls
SectionIn 1 3
SetOutPath $INSTDIR
!if /FileExists "..\lang\README.*.txt"
!if /FileExists "..\lang\README.*.txt"
File ..\lang\README.*.txt
CopyFiles /SILENT /FILESONLY $INSTDIR\README.$lng_usr.txt \
$INSTDIR\vim${VER_MAJOR}${VER_MINOR}\README.$lng_usr.txt
Delete $INSTDIR\README.*.txt
!endif
!if /FileExists "..\lang\LICENSE.??.txt"
!endif
!if /FileExists "..\lang\LICENSE.??.txt"
File ..\lang\LICENSE.??.txt
!if /FileExists "..\lang\LICENSE.??_??.txt"
!if /FileExists "..\lang\LICENSE.??_??.txt"
File ..\lang\LICENSE.??_??.txt
!endif
!endif
CopyFiles /SILENT /FILESONLY $INSTDIR\LICENSE.$lng_usr.txt \
$INSTDIR\vim${VER_MAJOR}${VER_MINOR}\LICENSE.$lng_usr.txt
Delete $INSTDIR\LICENSE.*.txt
!endif
!endif
SetOutPath $0\lang
File /r /x Makefile ${VIMRT}\lang\*.*
SetOutPath $0
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
"${GETTEXT}\gettext${BIT}\libintl-8.dll" \
"$0\libintl-8.dll" "$0"
"${GETTEXT}\gettext${BIT}\libintl-8.dll" "$0\libintl-8.dll" "$0"
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
"${GETTEXT}\gettext${BIT}\libiconv-2.dll" \
"$0\libiconv-2.dll" "$0"
!if ${INCLUDE_LIBGCC}
!if /FileExists "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll"
"${GETTEXT}\gettext${BIT}\libiconv-2.dll" "$0\libiconv-2.dll" "$0"
!if ${INCLUDE_LIBGCC}
!if /FileExists "${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll"
# Install libgcc_s_sjlj-1.dll only if it is needed.
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
"${GETTEXT}\gettext${BIT}\libgcc_s_sjlj-1.dll" \
"$0\libgcc_s_sjlj-1.dll" "$0"
!endif
!endif
!endif
!endif
${If} ${SectionIsSelected} ${id_section_editwith}
${If} ${RunningX64}
@ -703,16 +698,16 @@ Section "$(str_section_nls)" id_section_nls
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
"${GETTEXT}\gettext32\libiconv-2.dll" \
"$0\GvimExt32\libiconv-2.dll" "$0\GvimExt32"
!if ${INCLUDE_LIBGCC}
!if /FileExists "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll"
!if ${INCLUDE_LIBGCC}
!if /FileExists "${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll"
# Install libgcc_s_sjlj-1.dll only if it is needed.
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED \
"${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll" \
"$0\GvimExt32\libgcc_s_sjlj-1.dll" "$0\GvimExt32"
!endif
!endif
!endif
!endif
${EndIf}
SectionEnd
SectionEnd
!endif
##########################################################
@ -726,7 +721,9 @@ Section -call_install_exe
ReadEnvStr $3 "COMSPEC"
Call GetHomeDir
Pop $4
ShellExecAsUser::ShellExecAsUser "" "$3" '/c "cd /d "$4" & mkdir vimfiles & cd vimfiles & mkdir colors compiler doc ftdetect ftplugin indent keymap plugin syntax"' SW_HIDE
ShellExecAsUser::ShellExecAsUser "" "$3" '/c "cd /d "$4" & mkdir vimfiles \
& cd vimfiles & mkdir colors compiler doc ftdetect ftplugin indent \
keymap plugin syntax"' SW_HIDE
${EndIf}
SectionEnd
@ -740,7 +737,6 @@ SectionEnd
!macroend
Section -post
# Get estimated install size
SectionGetSize ${id_section_exe} $3
${If} ${SectionIsSelected} ${id_section_console}
@ -751,12 +747,12 @@ Section -post
SectionGetSize ${id_section_editwith} $4
IntOp $3 $3 + $4
${EndIf}
!if ${HAVE_NLS}
!if ${HAVE_NLS}
${If} ${SectionIsSelected} ${id_section_nls}
SectionGetSize ${id_section_nls} $4
IntOp $3 $3 + $4
${EndIf}
!endif
!endif
# Register EstimatedSize and AllowSilent.
# Other information will be set by the install.exe (dosinst.c).
@ -779,11 +775,12 @@ Section -post
!insertmacro SaveSectionSelection ${id_section_startmenu} "select_startmenu"
!insertmacro SaveSectionSelection ${id_section_editwith} "select_editwith"
!insertmacro SaveSectionSelection ${id_section_vimrc} "select_vimrc"
!insertmacro SaveSectionSelection ${id_section_pluginhome} "select_pluginhome"
!insertmacro SaveSectionSelection ${id_section_pluginhome} \
"select_pluginhome"
!insertmacro SaveSectionSelection ${id_section_pluginvim} "select_pluginvim"
!if ${HAVE_NLS}
!if ${HAVE_NLS}
!insertmacro SaveSectionSelection ${id_section_nls} "select_nls"
!endif
!endif
${If} ${RunningX64}
SetRegView lastused
${EndIf}
@ -814,14 +811,15 @@ SectionEnd
!macroend
Function .onInit
!if ${HAVE_MULTI_LANG}
!if ${HAVE_MULTI_LANG}
# Select a language (or read from the registry).
!insertmacro MUI_LANGDLL_DISPLAY
!endif
!endif
!if ${HAVE_NLS}
!if ${HAVE_NLS}
ClearErrors
System::Call 'kernel32::GetUserDefaultLocaleName(t.r19, *i${NSIS_MAX_STRLEN})'
System::Call \
'kernel32::GetUserDefaultLocaleName(t.r19, *i${NSIS_MAX_STRLEN})'
StrCmp $R9 "zh-cn" coincide 0
StrCmp $R9 "zh-tw" coincide 0
StrCmp $R9 "pt-br" 0 part
@ -832,7 +830,7 @@ Function .onInit
part:
StrCpy $lng_usr $R9 2
done:
!endif
!endif
${If} $INSTDIR == ${DEFAULT_INSTDIR}
# Check $VIM
@ -865,11 +863,12 @@ Function .onInit
!insertmacro LoadSectionSelection ${id_section_startmenu} "select_startmenu"
!insertmacro LoadSectionSelection ${id_section_editwith} "select_editwith"
!insertmacro LoadSectionSelection ${id_section_vimrc} "select_vimrc"
!insertmacro LoadSectionSelection ${id_section_pluginhome} "select_pluginhome"
!insertmacro LoadSectionSelection ${id_section_pluginhome} \
"select_pluginhome"
!insertmacro LoadSectionSelection ${id_section_pluginvim} "select_pluginvim"
!if ${HAVE_NLS}
!if ${HAVE_NLS}
!insertmacro LoadSectionSelection ${id_section_nls} "select_nls"
!endif
!endif
# Load the default _vimrc settings from the registry (if any).
!insertmacro LoadDefaultVimrc $vim_compat_stat "vim_compat" "all"
!insertmacro LoadDefaultVimrc $vim_keymap_stat "vim_keyremap" "default"
@ -923,7 +922,6 @@ Function SetCustom
GetFunctionAddress $3 ValidateCustom
nsDialogs::OnBack $3
# 1st group - Compatibility
${NSD_CreateGroupBox} 0u 0u 296u 44u $(str_msg_compat_title)
Pop $3
@ -948,7 +946,6 @@ Function SetCustom
${EndIf}
${NSD_CB_SetSelectionIndex} $vim_nsd_compat $4
# 2nd group - Key remapping
${NSD_CreateGroupBox} 0u 48u 296u 44u $(str_msg_keymap_title)
Pop $3
@ -967,7 +964,6 @@ Function SetCustom
${EndIf}
${NSD_CB_SetSelectionIndex} $vim_nsd_keymap $4
# 3rd group - Mouse behavior
${NSD_CreateGroupBox} 0u 95u 296u 44u $(str_msg_mouse_title)
Pop $3
@ -1035,15 +1031,19 @@ FunctionEnd
!insertmacro MUI_DESCRIPTION_TEXT ${id_section_batch} $(str_desc_batch)
!insertmacro MUI_DESCRIPTION_TEXT ${id_group_icons} $(str_desc_icons)
!insertmacro MUI_DESCRIPTION_TEXT ${id_section_desktop} $(str_desc_desktop)
!insertmacro MUI_DESCRIPTION_TEXT ${id_section_startmenu} $(str_desc_start_menu)
!insertmacro MUI_DESCRIPTION_TEXT ${id_section_editwith} $(str_desc_edit_with)
!insertmacro MUI_DESCRIPTION_TEXT ${id_section_startmenu} \
$(str_desc_start_menu)
!insertmacro MUI_DESCRIPTION_TEXT ${id_section_editwith} \
$(str_desc_edit_with)
!insertmacro MUI_DESCRIPTION_TEXT ${id_section_vimrc} $(str_desc_vim_rc)
!insertmacro MUI_DESCRIPTION_TEXT ${id_group_plugin} $(str_desc_plugin)
!insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginhome} $(str_desc_plugin_home)
!insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginvim} $(str_desc_plugin_vim)
!if ${HAVE_NLS}
!insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginhome} \
$(str_desc_plugin_home)
!insertmacro MUI_DESCRIPTION_TEXT ${id_section_pluginvim} \
$(str_desc_plugin_vim)
!if ${HAVE_NLS}
!insertmacro MUI_DESCRIPTION_TEXT ${id_section_nls} $(str_desc_nls)
!endif
!endif
!insertmacro MUI_FUNCTION_DESCRIPTION_END
@ -1051,10 +1051,10 @@ FunctionEnd
# Uninstaller Functions and Sections
Function un.onInit
!if ${HAVE_MULTI_LANG}
!if ${HAVE_MULTI_LANG}
# Get the language from the registry.
!insertmacro MUI_UNGETLANGUAGE
!endif
!endif
FunctionEnd
Section "un.$(str_unsection_register)" id_unsection_register
@ -1077,7 +1077,6 @@ Section "un.$(str_unsection_register)" id_unsection_register
SectionEnd
Section "un.$(str_unsection_exe)" id_unsection_exe
StrCpy $0 "$INSTDIR"
# Delete gettext and iconv DLLs
@ -1218,7 +1217,7 @@ SectionGroup "un.$(str_ungroup_plugin)" id_ungroup_plugin
SectionGroupEnd
Section "un.$(str_unsection_rootdir)" id_unsection_rootdir
# get the parent dir of the installation
# get the parent dir of the installation
Push $INSTDIR
Call un.GetParent
Pop $0
@ -1233,10 +1232,16 @@ SectionEnd
# Description for Uninstaller Sections
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_register} $(str_desc_unregister)
!insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_register} \
$(str_desc_unregister)
!insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_exe} $(str_desc_rm_exe)
!insertmacro MUI_DESCRIPTION_TEXT ${id_ungroup_plugin} $(str_desc_rm_plugin)
!insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_home} $(str_desc_rm_plugin_home)
!insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_vim} $(str_desc_rm_plugin_vim)
!insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_rootdir} $(str_desc_rm_rootdir)
!insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_home} \
$(str_desc_rm_plugin_home)
!insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_plugin_vim} \
$(str_desc_rm_plugin_vim)
!insertmacro MUI_DESCRIPTION_TEXT ${id_unsection_rootdir} \
$(str_desc_rm_rootdir)
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END
# vi:set ts=8 sw=2 sts=2 tw=79 wm=0 ft=nsis: