Sublime Text Completions: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(Redirected page to Sublime Text)
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Description ==
#REDIRECT [[Sublime Text]]
 
A powerful syntax completion for [http://www.sublimetext.com/ Sublime Text], supporting a large array of commands, macros and plugins that come bundled with NSIS 2.46.
 
Also included are snippets for scaffolding different types of empty scripts and to insert code blocks. You can extend these completions for third-party plug-ins using the [https://github.com/idleberg/NSIS-Sublime-Text-Addons add-ons pack].
 
All packages have been tested and approved for Sublime Text versions 2 and 3 (beta).
 
== Features ==
* all inbuilt NSIS commands, variables, defines and constants
* Plugins:
** AdvSplash
** Banner
** BgImage
** Dialer
** InstallOptions
** LangDLL
** Math
** nsDialogs
** nsExec
** NSISdl
** Splash
** StartMenu
** System
** UserInfo
** VPatch
* Macros:
** FileFunc
** WordFunc
** LogicLib
** Memento
** Modern
** Sections
** WinMessages
** WinVer
** x64
* Includes, Graphics, UIs
* Scaffolding Snippets
** Basic Script
** InstallOptions Script
** MUI2 Script
** nsDialogs Script
** nsDialogs MUI2 Script
** Translate MUI2
* Code Snippets
** insert help dialog
** insert illegal file name characters define
** insert language dialog
** insert messageboxes
** insert version information
** insert UAC init macro
 
== Installation ==
 
=== Package Control ===
 
The easiest way to install the package is to use [http://wbond.net/sublime_packages/package_control Package Control]:
 
1. Make sure you already have [http://wbond.net/sublime_packages/package_control Package Control] installed<br/>
2. Open the Command Palette ('''Ctrl+Shift+P''' on Windows and Linux, '''⇧⌘P''' on OS X)<br/>
3. Choose ''Install Package'' from the command palette<br/>
4. Select ''NSIS Autocomplete and Snippets'' and press '''Enter'''
 
With [http://wbond.net/sublime_packages/package_control/settings auto_upgrade] enabled, Package Control will keep all installed packages up-to-date!
 
=== Windows Installer ===
 
The following script will download and install the packages.
 
<highlight-nsis>; https://github.com/idleberg/NSIS-Sublime-Text
 
; Includes ---------------------------------
!include MUI2.nsh
 
; Settings ---------------------------------
Name "NSIS-Sublime-Text-Bundle"
OutFile "NSIS-Sublime-Text-Bundle.exe"
RequestExecutionLevel user
InstallDir "$APPDATA\Sublime Text 2\Packages"
 
; Pages ------------------------------------
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
 
; Languages --------------------------------
!insertmacro MUI_LANGUAGE "English"
 
; Sections ---------------------------------
Section "Basic Completions" NSIS-Sublime-Text
 
  InetLoad::load "https://github.com/idleberg/NSIS-Sublime-Text/archive/master.zip" "$PLUGINSDIR\NSIS-Sublime-Text.zip"
  ZipDLL::extractall "$PLUGINSDIR\NSIS-Sublime-Text.zip" "$INSTDIR"
  Rename /REBOOTOK "$INSTDIR\NSIS-Sublime-Text-master" "$INSTDIR\NSIS-Sublime-Text"
 
SectionEnd
 
Section "Plug-in Completions" NSIS-Sublime-Text-Addons
 
  InetLoad::load "https://github.com/idleberg/NSIS-Sublime-Text-Addons/archive/master.zip" "$PLUGINSDIR\NSIS-Sublime-Text-Addons.zip"
  ZipDLL::extractall "$PLUGINSDIR\NSIS-Sublime-Text-Addons.zip" "$INSTDIR"
  Rename /REBOOTOK "$INSTDIR\NSIS-Sublime-Text-Addons-master" "$INSTDIR\NSIS-Sublime-Addons-Menu"
 
SectionEnd
 
Section "Context Menu" NSIS-Sublime-Text-Menu
 
  InetLoad::load "https://github.com/idleberg/NSIS-Sublime-Text-Menu/archive/master.zip" "$PLUGINSDIR\NSIS-Sublime-Text-Menu.zip"
  ZipDLL::extractall "$PLUGINSDIR\NSIS-Sublime-Text-Menu.zip" "$INSTDIR"
  Rename /REBOOTOK "$INSTDIR\NSIS-Sublime-Text-Menu-master" "$INSTDIR\NSIS-Sublime-Text-Menu"
 
SectionEnd
 
; Descriptions -----------------------------
LangString DESC_NSIS-Sublime-Text ${LANG_English} "Adds autocompletion (and snippets) for NSIS commands and bundled plug-ins"
LangString DESC_NSIS-Sublime-Text-Addons ${LANG_English} "Adds autocompletion for several third party plug-ins"
LangString DESC_NSIS-Sublime-Text-Menu ${LANG_English} "Adds context menu to look up NSIS commands"
 
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${NSIS-Sublime-Text} $(DESC_NSIS-Sublime-Text)
!insertmacro MUI_DESCRIPTION_TEXT ${NSIS-Sublime-Text-Addons} $(DESC_NSIS-Sublime-Text-Addons)
!insertmacro MUI_DESCRIPTION_TEXT ${NSIS-Sublime-Text-Menu} $(DESC_NSIS-Sublime-Text-Menu)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
 
; Functions --------------------------------
Function .onInit
InitPluginsDir
FunctionEnd
</highlight-nsis>
 
=== Manual Installation ===
 
* Download the files using the GitHub .zip download option
* Unzip the files to your Sublime Text 2 '''''Packages\User''''' directory
 
== Usage ==
 
=== Completion ===
Start typing any command and use the tab key to complete the the command. Since Sublime Text supports fuzzy search out of the box, you can for instance type ''reexa'' and press enter to complete to:
 
<highlight-nsis>RequestExecutionLevel admin</highlight-nsis>
 
Commands such as ''Section'', ''Functions'', ''PageEx'', ''!macro'', ''${If}'' will automatically be closed on completion.
 
=== Snippets ===
There are currently different kinds snippets included. To generate empty scripts, start typing ''scaff'' (or "scaffold") and choose the desired script type from the pop-up. To insert code-blocks, start typing ''do'' and make a selection.
 
You could for instance type "do''ync''" to insert the following:
<highlight-nsis>MessageBox MB_YESNOCANCEL "message"</highlight-nsis>
 
== Links ==
 
* [https://github.com/idleberg/NSIS-Sublime-Text Basic Package] (Github)
* [https://github.com/idleberg/NSIS-Sublime-Text-Addons Add-ons Package] (Github)
* [https://github.com/idleberg/NSIS-Sublime-Text-Menu Context Menu Package] (Github)
 
[[Category:Development Environments]]

Latest revision as of 20:51, 9 November 2013

Redirect to: