Sublime Text Alternatives The most popular alternative is Atom, which is both free and Open Source. If that doesn't suit you, our users have ranked more than 100 alternatives to Sublime Text so hopefully you can find a suitable replacement. Sublime Text 3 may be downloaded from the Sublime Text 3 page. This is the recommended version of Sublime Text to use, and is available for Windows, OS X and Linux. The latest version of Sublime Text 1.x is Sublime Text 1.4. It's also available as a portable version, to run off a USB key.
Original author(s) | Jon Skinner |
---|---|
Developer(s) | Sublime HQ |
Initial release | January 18, 2008; 13 years ago |
Stable release | 3.2.2 Build 3211 / October 1, 2019; 17 months ago[1] |
Written in | C++, Python |
Operating system | Linux 32/64-bit, macOS 10.6 or later (version 2), 10.7 or later (version 3), Microsoft Windows 32/64-bit |
Type | Source code editor, debugger |
License | Proprietary[2] |
Website | www.sublimetext.com |
Sublime Text is a sharewarecross-platformsource code editor with a Pythonapplication programming interface (API). It natively supports many programming languages and markup languages, and functions can be added by users with plugins, typically community-built and maintained under free-software licenses.
Sublime editor free download. Objeck Objeck is an open-source programming language inspired by Java and influenced by UML and Scheme.
Features[edit]
The following is a list of features of Sublime Text:[3]
- 'Goto Anything,' quick navigation to files, symbols, or lines
- 'Command palette' uses adaptive matching for quick keyboard invocation of arbitrary commands
- Simultaneous editing: simultaneously make the same interactive changes to multiple selected areas
- Python-based plugin API
- Project-specific preferences
- Extensive customizability via JSON settings files, including project-specific and platform-specific settings
- Cross-platform (Windows, macOS, and Linux) and Supportive Plugins for cross-platform
- Compatible with many language grammars from TextMate
Version 2[edit]
Sublime Text 2.0.2 was released on 8 July 2013. Changes from the first version of the software as promoted by Skinner on the official Sublime blog include Retina display support and 'Quick Skip Next' functionality.'[4]
Interface Guide[edit]
The interface of Sublime Text 2
Themes
- Sublime Text contains 23 different visual themes, with the option to download additional themes and configure custom themes via third-party plugins
- The minimap feature shows a reduced overview of the entire file in the top-right corner of the screen. The portion of the file visible in the main editor pane is highlighted and clicking or dragging in this view scrolls the editor through the file.[5]
Panels, groups and screen modes
- The program offers a number of screen modes including panels that can show up to four files at once as well as full screen and distraction free modes which only show one file without any of the additional menus around it
Features[edit]
Column selection and multi-select editing
This feature allows users to select entire columns at once or place more than one cursor in text, which allows for simultaneous editing. All cursors then behave as if each of them was the only one in the text. Commands like move by character, move by line, text selection, move by words, move by subwords (CamelCase, hyphen or underscore delimited), move to beginning/end of line, etc., affect all cursors independently, allowing one to edit slightly complex repetitive structures quickly without the need to use macros or regex.[6]
Auto completion
Sublime Text will offer to complete entries as the user is typing depending on the language being used. It also auto-completes variables created by the user.
Syntax highlight and high contrast display
The dark background on Sublime Text is intended to reduce eyestrain and increase the amount of contrast with the text. Syntax highlighting also makes syntaxes of the language easier to read.[citation needed]
In-editor code building
This feature allows users to run code for certain languages from within the editor, which eliminates the need to switch out to the command line and back again. Dosdude1 macos high sierra patcher. This function can also be set to build the code automatically every time the file is saved.[clarification needed]
Snippets
This feature allows users to save blocks of frequently used code and assign keywords to them. The user can then type the keyword and press tab to paste the block of code whenever they require it.
Goto anything
This feature is a tool that allows users to switch between open, recent or project files and also navigate to symbols within them.[7][clarification needed]
Other features
Sublime Text has a number of features in addition to these including:[8]
- Auto-save, which attempts to prevent users from losing their work
- Customizable key assignments, a navigational tool which allows users to assign hotkeys to their choice of options in both the menus and the toolbar
- Find as you type, begins to look for the text being entered as the user types without requiring a separate dialog box
- Spell check function corrects as you type
- Macros
- Repeat the last action
- A wide selection of editing commands, including indenting and unindenting, paragraph reformatting and line joining
Package manager[edit]
Package Control is a third-party package manager for Sublime Text which allows the user to find, install, upgrade and remove plug-ins, usually without restarting Sublime Text. The package manager keeps installed packages up-to-date with an auto-upgrade feature and downloads packages from GitHub, BitBucket and a custom JSON-encoded channel/repository system. It also handles updating packages cloned from GitHub and BitBucket via Git and Hg, as well as providing commands for enabling and disabling packages. The package manager also includes a command to bundle any package directory into a .sublime-package file.[9]
Notable third-party packages include:
- SublimeCodeIntel – Features include Jump to Symbol Definition, Function Call Tool-Tips.[10]
- Sublime Goto Documentation – Opens relevant documentation for the highlighted function
- LSP - Support for the Language Server Protocol
- Bracket Highlighter – Enhances the basic highlights Sublime Text provides for bracket pairs
- Sublime dpaste – Sends selected text to the dpaste.com service
- SublimeLinter – Code linting (validation) for JavaScript, Perl, PHP, Python, Ruby, and others
- Side Bar Enhancements – Enhancements to the Sublime Text 2 sidebar with new options for deleting, opening, moving, creating, editing, and finding files
- ColorSublime – Expands the number of Themes available from the standard 22 to over 250 community-submitted color schemes[11]
- WordPress – Adds autocompletion and Snippets for the blogging platform WordPress
- Git – Integrates Git functionality into Sublime Text
Version 3[edit]
PHP Hello World on Sublime Text 3
Version 3 entered beta on 29 January 2013. At first available only for registered users who had purchased Sublime Text 2, on 28 June 2013 it became available to the general public. However, the very latest development builds still required a registration code.[12] Sublime Text 3 was officially released on 13 September 2017.[13][14]In May 2018 it was followed by version 3.1[15] and by version 3.2 in March 2019.[16]
Two of the main features that Sublime Text 3 adds include symbol indexing and pane management. Symbol Indexing allows Sublime Text to scan files and build an index to facilitate the features Goto Definition and Goto Symbol in Project. Pane Management allows users to move between panes via hotkeys.[17]
Sublime Merge[edit]
Sublime HQ also offers Sublime Merge, a Git GUI and merging tool, released in 2018.[18]
See also[edit]
References[edit]
- ^https://www.sublimetext.com/3
- ^'Sublime Text EULA'. Sublime HQ Pty Ltd.
- ^'Sublime Text'. Sublime HQ Pty Ltd. Retrieved 14 March 2014.
- ^'Sublime Blog'. Retrieved 11 April 2015.
- ^'Interface'. 1stwebdesigner. Retrieved 13 November 2012.
- ^'Features'. makeuseof.com. Retrieved 13 November 2012.
- ^'Features'. thewebdesignbay.com. Archived from the original on 8 November 2012. Retrieved 13 November 2012.
- ^'Features'. 1stwebdesigner. Retrieved 13 November 2012.
- ^'Package Control'. wbond.net. Retrieved 9 September 2013.
- ^'Package Manager'. rockettheme.com. Archived from the original on 23 November 2012. Retrieved 26 November 2012.
- ^'Colorsublime'. Colorsublime.com. Retrieved 11 April 2015.
- ^'Sublime Text 3 Dev Builds'. Retrieved 9 September 2013.
- ^Skinner, Jon. 'Sublime Text 3.0'. Retrieved 13 September 2017.
- ^Brinkmann, Martin (15 September 2017). 'Sublime Text 3.0 is out'. gHacks Tech News. Retrieved 26 January 2020.
- ^Sublime Text 3.1 Released, Sublime HQ Pty Ltd, 7 May 2018
- ^Sublime Text 3.2, Sublime HQ Pty Ltd, 13 March 2019
- ^'Sublime Text 3 Beta'. Sublime Blog. Retrieved 11 January 2014.
- ^Booker, Logan (22 September 2018). 'Sublime Merge Is A Slick Git Front-End From The Makers Of Sublime Text'. Australia: Lifehacker. Retrieved 26 January 2020.
Further reading[edit]
Peleg, Dan (2013). Mastering Sublime Text. Birmingham, UK: Packt Publishing. ISBN978-1-84969-842-9.
Bos, Wes (2014). Sublime Text Power User: A Complete Guide.
External links[edit]
- Official website
Retrieved from 'https://en.wikipedia.org/w/index.php?title=Sublime_Text&oldid=1009583738'
New instructions: https://chromium.googlesource.com/chromium/src/+/master/docs/sublime_ide.mdContents- 9 Example plugin
Contents
- 9 Example plugin
What is Sublime Text?
It's a fast, powerful and easily extensible code editor. Check out some of the demos on the site for a quick visual demonstration.
- Project support.
- Theme support.
- Works on Mac, Windows and Linux.
- No need to close and re-open during a
gclient sync
. - Supports many of the great editing features found in popular IDE's like Visual Studio, Eclipse and SlickEdit.
- Doesn't go to lunch while you're typing.
- The UI and keyboard shortcuts are pretty standard (e.g. saving a file is still Ctrl+S on Windows).
- It's inexpensive and you can evaluate it (fully functional) for free.
Installing Sublime Text 2
Download and install from here: http://www.sublimetext.com/
Help and general documentation is available here: http://www.sublimetext.com/docs/2/
Assuming you have access to the right repositories, you can also install Sublime via apt-get on Linux.
Preferences
Sublime configuration is done via JSON files. So the UI for configuring the text editor is simply a text editor. Same goes for project files, key bindings etc.
To modify the default preferences, go to the Preferences menu and select Settings-Default. Note that if you would rather like to make these settings user specific, select Settings - User as this applies there as well. The difference is that the default settings file already contains many settings that you might want to modify.
Here are some settings that you might want to change (look these variables up in the settings file and modify their value, you should not have to add them):
'tab_size': 2,
'ensure_newline_at_eof_on_save': true,
The settings take effect as soon as you save the file.
If you've got a big monitor and are used to viewing more than one source file at a time, you can use the View->Layout feature to split the view up into columns and/or rows and look at multiple files at the same time. There's also the Shift+F11, distraction free view that allows you to see nothing but code! ?8-D Sublime also supports dragging tabs out into new windows as Chrome supports, so that might be useful as well.
One thing to be aware of when editing these JSON files is that Sublime's JSON parser is slightly stricter than what you might be used to from editing e.g. GYP files. In particular Sublime does not like it if you end a collection with a comma. This is legal: {'foo', 'bar'} but not this: {'foo', 'bar', }. You have been warned.
Project files
Like configuration files, project files are just user editable JSON files.
Here's a very simple project file that was created for WebRTC and should be saved in the parent folder of the trunk folder (name it webrtc.sublime-project). It's as bare bones as it gets, so when you open this project file, you'll probably see all sorts of files that you aren't interested in.
'folders':
{
}
}
Here is a slightly more advanced example that has exclusions to reduce clutter. This one was made for Chrome on a Windows machine and has some Visual Studio specific excludes. Save this file in the same directory as your .gclient file and use the .sublime-project extension (e.g. chrome.sublime-project) and then open it up in Sublime.
'folders':
{
'name': 'src',
'*.vcproj',
'*.sln',
'*.gitmodules',
],
'build',
'third_party',
'Debug',
]
]
Navigating the project
Here are some basic ways to get you started browsing the source code.
- 'Goto Anything' or Ctrl+P is how you can quickly open a file or go to a definition of a type such as a class. Just press Ctrl+P and start typing.
- Open source/header file: If you're in a header file, press Alt+O to open up the corresponding source file and vice versa. For more similar features check out the Goto->Switch File submenu.
- 'Go to definition': Right click a symbol and select 'Navigate to Definition'. A more powerful way to navigate symbols is by using the Ctags extension and use the Ctrl+T,Ctrl+T shortcut. See the section about source code indexing below.
Enable source code indexing
For a fast way to look up symbols, we recommend installing the CTags plugin. we also recommend installing Sublime's Package Control package manager, so let's start with that.
- Install the Sublime Package Control package: https://packagecontrol.io/installation
- Install Exuberant Ctags and make sure that ctags is in your path: http://ctags.sourceforge.net/
- On linux you should be able to just do: sudo apt-get install ctags
- Install the Ctags plugin: Ctrl+Shift+P and type 'Package Control: Install Package'
Once installed, you'll get an entry in the context menu when you right click the top level folder(s) in your project that allow you to build the Ctags database. If you're working in a Chrome project however, do not do that at this point, since it will index much more than you actually want. Instead, do one of:
- Create a batch file (e.g. ctags_builder.bat) that you can run either manually or automatically after you do a gclient sync:This takes a couple of minutes to run, but you can work while it is indexing.
ctags --languages=C++ --exclude=third_party --exclude=.git --exclude=build --exclude=out -R -f .tmp_tags & ctags --languages=C++ -a -R -f .tmp_tags third_partyplatformsdk_win8 & ctags --languages=C++ -a -R -f .tmp_tags third_partyWebKit & move /Y .tmp_tags .tags
- Edit the CTags.sublime-settings file for the ctags plugin so that it runs ctags with the above parameters. Note: the above is a batch file - don't simply copy all of it verbatim and paste it into the CTags settings file :-)
Once installed, you can quickly look up symbols with Ctrl+t, Ctrl+t etc. More information here: https://github.com/SublimeText/CTags
One more hint - Edit your .gitignore file (under %USERPROFILE% or ~/) so that git ignores the .tags file. You don't want to commit it. :)
If you don't have a .gitignore in your profile directory, you can tell git about it with this command:
Windows: git config --global core.excludesfile %USERPROFILE%.gitignore
Mac, Linux: git config --global core.excludesfile ~/.gitignoreBuilding with ninja
Assuming that you've got ninja properly configured and that you already have a project file as described above, here's how to build Chrome using ninja from within Sublime. For any other target, just replace the target name.
Go to Tools->Build System->New build system and save this as a new build system:
'cmd': ['ninja', '-C', 'outDebug', 'chrome.exe'],
'file_regex': '^[./]*([a-z]?:?[w./]+)[(:]([0-9]+)[):,]([0-9]+)?[:)]?(.*)$'
file_regex explained for easier tweaking in future:
Aims to capture the following error formats while respecting Sublime's perl-like group matching:
1. d:srcchromesrcbasethreadingsequenced_worker_pool.cc(670): error C2653: 'Foo': is not a class or namespace name
2. ././base/threading/sequenced_worker_pool.cc:670:26: error: use of undeclared identifier 'Foo'
3. ././base/process/memory_win.cc(18,26): error: use of undeclared identifier 'Foo'
4. ./.src/heap/item-parallel-job.h(145,31): error: expected ';' in 'for' statement specifier
'file_regex': '^[./]*([a-z]?:?[w.-/]+)[(:]([0-9]+)[):,]([0-9]+)?[:)]?(.*)$'
Is Sublime Text Open Source
(0) Cut relative paths (which typically are relative to the out dir and targeting src/ which is already the 'working_dir')
(2) Match the rest of the file
(3) File name is followed by open bracket or colon before line number
(5) Line # is either followed by close bracket (no column group) or comma/colon
(7) If (6) is non-empty there will be a closed bracket or another colon (but can't put it inside brackets as the 'column filename group' only wants digits).
(8) Everything else until EOL is the error message.
On Linux and Mac, fix the targets up appropriately, fwd slash instead of backslash, no .exe, etc
Linux example:
// Pass -j1024 if (and only if!) building with GOMA.
'cmd': ['ninja', '-C', 'out/Debug', 'blink', '-j1024'],
// Ninja/GN build errors are build-dir relative, however file_regexp
// is expected to produce project-relative paths, ignore the leading
// ././(file_path):(line_number):(column):(error_message)
'file_regex': '^././([^:n]*):([0-9]+):?([0-9]+)?:? (.*)$'
or to avoid making ninja in the path or environment variables:
{
'cmd': ['/usr/local/google/home/MYUSERNAME/git/depot_tools/ninja', '-j', '150', '-C', '.', 'chrome', 'content_shell', 'blink_tests'],
'working_dir': '${project_path}/src/out/Release',
'file_regex': '([^:n]*):([0-9]+):?([0-9]+)?:? (.*)$',
[
'cmd': ['/usr/local/google/home/MYUSERNAME/git/depot_tools/ninja', '-j', '150', '-C', '.', 'chrome', 'content_shell', 'blink_tests'],
'working_dir': '${project_path}/src/out/Debug',
'file_regex': '([^:n]*):([0-9]+):?([0-9]+)?:? (.*)$'
]
Further build system documentation or older documentation (as of Nov 2014 older is more complete).
This will make hitting Ctrl-B build chrome.exe (really quickly, thanks to ninja), F4 will navigate to the next build error, etc. If you're using Goma, you can play with something like: 'cmd': ['ninja', '-j', '200', '-C', 'outDebug', 'chrome.exe'],.
You can also add build variants so that you can also have quick access to building other targets like unit_tests or browser_tests. You build description file could look like this:
Example plugin
Sublime has a Python console window and supports Python plugins. So if there's something you feel is missing, you can simply add it.
Here's an example plugin (Tools->New Plugin) that runs cpplint (assuming depot_tools is in the path) for the current file and prints the output to Sublime's console window (Ctrl+`):
import subprocess
class RunLintCommand(sublime_plugin.TextCommand):
command = ['cpplint.bat', self.view.file_name()]
stdout=subprocess.PIPE,
print process.communicate()[1]
Or, in Sublime Text 3:
import subprocess
class RunLintCommand(sublime_plugin.TextCommand):
print('AMI: %s' % self.view.file_name())
command = ['/home/fischman/src/depot_tools/cpplint.py', self.view.file_name()]
process = subprocess.Popen(command, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if error:
Save this file as run_lint.py (Sublime will suggest the right location when you save the plugin - PackagesUser).
Note that here's an interesting thing in how Sublime works. CamelCaps are converted to lower_case_with_undescore format. Note also that although the documentation currently has information about 'runCommand' member method for the view object, this too is now subject to that convention.
Taking this a step further, you can create a keybinding for your new plugin. Here's an example for how you could add a binding to your User key bindings (Preferences->Key Bindings - User):
{
}
Now, when you hit Ctrl+Shift+L, cpplint will be run for the currently active view. Here's an example output from the console window:
D:srccgitsrccontentbrowserbrowsing_instance.cc:69: Add #include <string> for string [build/include_what_you_use] [4]
Done processing D:srccgitsrccontentbrowserbrowsing_instance.cc
As a side note, if you run into problems with the documentation as I did above, it's useful to just use Python's ability to dump all properties of an object with the dir() function:
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__len__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'add_regions', 'begin_edit', 'buffer_id', 'classify', 'command_history', 'em_width', 'encoding', 'end_edit', 'erase', 'erase_regions', 'erase_status', 'extract_completions', 'extract_scope', .. <snip>
Compile current file using Ninja
Sublime Is Open Source
As a more complex plug in example, look at the attached python file: compile_current_file.py. This plugin will compile the current file with Ninja, so will start by making sure that all this file's project depends on has been built before, and then build only that file.
First, it confirms that the file is indeed part of the current project (by making sure it's under the <project_root> folder, which is taken from the self.view.window().folders() array, the first one seems to always be the project folder when one is loaded). Then it looks for the file in all the .ninja build files under the <project_root>out<target_build>, where <target_build> must be specified as an argument to the compile_current_file command. Using the proper target for this file compilation, it starts Ninja from a background thread and send the results to the output.exec panel (the same one used by the build system of Sublime Text 2). So you can use key bindings like these two, to build the current file in either Debug or Release mode:
{ 'keys': ['ctrl+f7'], 'command': 'compile_current_file', 'args': {'target_build': 'Debug'} },
{ 'keys': ['ctrl+shift+f7'], 'command': 'compile_current_file', 'args': {'target_build': 'Release'} },
If you are having trouble with this plugin, you can set the python logging level to DEBUG in the console and see some debug output.
Format selection (or area around cursor) using clang-format
Copy buildtools/clang_format/scripts/clang-format-sublime.py to ~/.config/sublime-text-3/Packages/User/ (or -2 if still on ST2) and add something like this to Preferences->Key Bindings - User:
'keys': ['ctrl+shift+c'], 'command': 'clang_format',
Miscellaneous tips
- To synchronize the project sidebar with the currently open file, right click in the text editor and select 'Reveal in Side Bar'. Alternatively you can install the SyncedSideBar sublime package (via the Package Manager) to have this happen automatically like in Eclipse.
- If you're used to hitting a key combination to trigger a build (e.g. Ctrl+Shift+B in Visual Studio) and would like to continue to do so, add this to your Preferences->Key Bindings - User file:
- { 'keys': ['ctrl+shift+b'], 'command': 'show_panel', 'args': {'panel': 'output.exec'} }
- Install the Open-Include plugin (Ctrl+Shift+P, type:'Install Package', type:'Open Include'). Then just put your cursor inside an #include path, hit Alt+D and voila, you're there.
- If you want to take that a step further, add an entry to the right-click context menu by creating a text file named 'context.sublime-menu' under '%APPDATA%Sublime Text 2PackagesUser' with the following content:
[ { 'command': 'open_include', 'caption': 'Open Include' } ]
Assuming you've installed Package Control already (https://packagecontrol.io/installation) you can easily install more packages via:
- Open Command Palette (Ctrl-Shift-P)
- Type 'Package Control: Install Package' (note: given ST's string match is amazing you can just type something like 'instp' and it will find it :-)).
- Case Conversion (automatically swap casing of selected text -- works marvel with multi-select -- go from a kConstantNames to ENUM_NAMES in seconds)
- CTags (see detailed setup info above).
- Git
- Open-Include
- Text Pastry (insert incremental number sequences with multi-select, etc.)
- Wrap Plus (auto-wrap a comment block to 80 columns with Alt-Q)