Sublime Text Completions: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
Line 47: Line 47:
=== Windows Installer ===
=== Windows Installer ===


To build yourself an installer, download installer.nsi from the scripts folder and compile it.
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 "More 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 ===
=== Manual Installation ===

Revision as of 15:05, 18 May 2013

Description

A powerful syntax completion for Sublime Text, supporting a large array of commands, macros and plugins that come bundled with NSIS v2.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 add-ons pack.

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.nsh
    • WordFunc.nsh
    • LogicLib.nsh
    • Memento.nsh
    • Modern.nsh
    • Sections.nsh
    • WinMessages.nsh
    • WinVer.nsh
    • x64.nsh
  • Includes, Graphics, UIs
  • Snippets
    • Basic Script
    • MUI2 Script
    • nsDialogs Scripts

Installation

Package Control

The easiest way to install the package is to use Package Control.

Windows Installer

The following script will download and install the packages.

; 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 "More 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

Manual Installation

  • Download the files using the GitHub .zip download option
  • Unzip the files 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 mbyn and press enter to complete a MessageBox command with MB_YESNO buttons. Commands such as Section, Functions, PageEx, !macro, ${If} will automatically be closed on completion.

Snippets

There are currently different kinds of scaffolding snippets included, each of them will produce an empty script file. You can activate these by typing scaff in the editor.

Link