Sublime Text: Difference between revisions
Line 340: | Line 340: | ||
* Press F6 to enable spell check | * Press F6 to enable spell check | ||
adapted from the github repo for SublimeText/Dictionaries | adapted from the github repo for SublimeText/Dictionaries | ||
== Sublime Preferences == | |||
=== File Indexing === | |||
Some of the core features in Sublime Text 3 are {{FormFCT|9|blue|Goto Definition}} and {{FormFCT|9|blue|Goto Symbol}} in Project <ref>[https://www.sublimetext.com/blog/articles/file-indexing SublimeText Blog], Articles File-Indexing.</ref>. | |||
Both of these work by indexing the files in the current project to determine where each symbol is defined. | |||
<br>To see when files are being indexed, you can enter {{FormFCT|9|blue|sublime.log_indexing(True)}} in {{FormFCT|9|green|Sublime Text's console}}. | |||
This will trigger Sublime Text to start logging relevant information whenever it indexes files. | |||
In the latest version 4107 this in the background working mechanism has been extended causing the complete editor to become terrible slow. | |||
<br>So what to do? | |||
* First of all, disable file indexing: | |||
** {{FormFCT|9|blue|index_files: false}}. | |||
* File indexing works by applying syntax highlighting rules to each file, and then extracting everything that looks like a symbol. <br>The syntax highlighting rules are ''regex based'', and some combinations of rules and files can cause the parsing to take a long time. <br>See the log-file what's going on, and then consider adding the files to the {{FormFCT|9|blue|index_exclude_patterns}} setting. | |||
* Various events can cause the index itself to become corrupted, and when this happens, Sublime Text will do the indexing work, but be unable to write the results to disk, so it'll start again in the near future. <br>The next build of Sublime Text will handle this situation more gracefully, but in the mean time you can check this for yourself: if the index is corrupted, there will be a log message in the console (accessible from the View/Show Console menu), which indicates which directory needs to be deleted to reset the index. | |||
== See also == | == See also == |
Revision as of 15:46, 8 June 2021
Sublime Text is a sophisticated text editor for code, markup and prose [1][2]. You'll love the slick user interface, extraordinary features and amazing performance. First of all Sublime Text is multi-platform, so available for OS X, Windows and Linux.
Keyboard shortcuts
One very important shortcut for OSX is the one is the ⌘ + ⇧ + . which shows the normal hidden files in a directory (i.e. .bashrc) [3].
The keyboard shortcuts for OSX are base on the Websites:
- Docs Sublime Text Info, Keyboard Shortcuts for OSX.
|
|
|
Descriptions
Command Palette The Command Palette holds infrequently used functionality, like sorting, changing the syntax and changing the indentation settings.
With just a few keystrokes, you can search for what you want, without ever having to navigate through the menus or remember obscure key bindings.
|
Goto Anything Use Goto Anything to open files with only a few keystrokes, and instantly jump to symbols, lines or words.
These shortcuts can be combined, so tp@rf may take you to a function read_file within a file text_parser.py.
|
Split Editing Get the most out of your wide screen monitor with split editing support. Edit files side by side, or edit two locations in the one file. You can edit with as many rows and columns as you wish.
|
Multiple Selections Make ten changes at the same time, not one change ten times. Multiple selections allow you to interactively change many lines at once, rename variables with ease, and manipulate files faster than ever.
|
Distraction Free Mode When you need to focus, Distraction Free Mode is there to help you out. Distraction Free Mode is full screen, chrome free editing, with nothing but your text in the center of the screen.
|
Instant Project Switch Projects in Sublime Text capture the full contents of the workspace, including modified and unsaved files. You can switch between projects in a manner similar to Goto Anything, and the switch is instant, with no save prompts - all your modifications will be restored next time the project is opened. |
Goto Definitions Using information from syntax definitions, Sublime Text automatically generates a project-wide index of every class, method and function. This index powers Goto Definition, which is exposed in three different ways:
Symbol indexing can be customized on a per-syntax basis via configuration files, allowing users to tailor the feature to their needs. |
Git Integration
Sublime Text's Git integration includes the following components:
- Side Bar
- Status Bar
- Diff Markers
- Sublime Merge Integration
- Settings
For the full description go to: https://www.sublimetext.com/docs/3/git_integration.html
Side Bar
Files and folders displayed in the side bar will include a status badge along the right-hand edge, when modified. This includes files and folder in the Folders section of the side bar, along with files in the Open Files section. Ignored files and folders are de-emphasized in the side bar by reducing the opacity of the name.
When the mouse pauses over a status badge, a tool tip will be displayed indicating the status of the file, or in the case of a folder, the status of the contained files and folders.
Status Badge Key
The following table indicates the meaning of each badge. Please note that the color of the badges will be slightly different as they adapt to the closest hue in the active color scheme.
- ⚪ Untracked, white circle
- 🔵 Modified, blue circle
- 🔴 Missing, red circle
- ➼ Staged Addition, Green heavy wedge tailed rightwards arrow.
- ➼ Staged Modification
- ➼ Staged Deletion
- Unmerged, symbol not yet found.
Packages
Gitsavvy
GitSavvy provides integration between Sublime Text 3 and Git.
If you're a new user and you find yourself asking, "Can GitSavvy do X?", there are two places to look.
- Open your command palette and type `GitSavvy: help`. This will take you to the offline wiki-style documentation.
- You can also check for configurability options by opening `Preferences > Package Settings > GitSavvy > Settings - Default` in the ST3 menu.
Any optional or configurable behavior will be documented here, along with the default values.
If you need help along the way, there's usually someone around in our Gitter channel: https://gitter.im/divmain/GitSavvy
Finally, if at any time you encounter a bug, or if you wish that GitSavvy included some missing functionality, please open an issue: https://github.com/divmain/GitSavvy/issues
On youtube: https://www.youtube.com/watch?v=HLU_D8ZiqRs
Documentation: https://raw.githubusercontent.com/divmain/GitSavvy/master/docs/README.md
Hunspell
The spellings-package is based on Hunspell [4][5].
Adding Language
To add a new language to sublime text 3
- Download the language file from the appropriate OpenOffice extension [6].
- Rename the "some.oxt" file to "some.zip"
- Unzip the file
- Look for two files:
- "lang.aff"
- "lang.dic
- For example es_ES.aff and es_ES.dic
- Open the "lang.aff" to check the encoding used. Such the line: SET ISO-8859-1
- Convert that file to UTF-8 from the used encoding
- Convert "lang.dic" to UTF-8 from the used encoding.
- Change SET ISO-8859-1 to SET UTF-8
- In ST3, click on Preferences -> Browse Packages
- Create a new folder, for example Language - Spanish
- Move lang.dic and lang.aff to that folder
- Activate the dictionary in ST3 (View -> Dictionary -> Language - Spanish -> es_ES)
- Press F6 to enable spell check
adapted from the github repo for SublimeText/Dictionaries
Sublime Preferences
File Indexing
Some of the core features in Sublime Text 3 are Goto Definition and Goto Symbol in Project [7].
Both of these work by indexing the files in the current project to determine where each symbol is defined.
To see when files are being indexed, you can enter sublime.log_indexing(True) in Sublime Text's console.
This will trigger Sublime Text to start logging relevant information whenever it indexes files.
In the latest version 4107 this in the background working mechanism has been extended causing the complete editor to become terrible slow.
So what to do?
- First of all, disable file indexing:
- index_files: false.
- File indexing works by applying syntax highlighting rules to each file, and then extracting everything that looks like a symbol.
The syntax highlighting rules are regex based, and some combinations of rules and files can cause the parsing to take a long time.
See the log-file what's going on, and then consider adding the files to the index_exclude_patterns setting. - Various events can cause the index itself to become corrupted, and when this happens, Sublime Text will do the indexing work, but be unable to write the results to disk, so it'll start again in the near future.
The next build of Sublime Text will handle this situation more gracefully, but in the mean time you can check this for yourself: if the index is corrupted, there will be a log message in the console (accessible from the View/Show Console menu), which indicates which directory needs to be deleted to reset the index.
See also
- Git, Version Control System.
Reference
- ↑ SublimeText, A programmers editor the way it should be.
- ↑ Sublime trademark of © Sublime HQ Pty Ltd, Woollahra, Sydney.
- ↑ Stack-Exchange, Show hidden files in the open file dialog on OSX.
- ↑ Hunspell, About.
- ↑ SysTutorials.com, Documentation man-page Hunspell.
- ↑ OxygenXML.com Spell Checking.
- ↑ SublimeText Blog, Articles File-Indexing.