Sublime Text 2/3

Source: Internet
Author: User

Sublime Text 2/3

Document directory

  1. 1. 0. Set subl command line
  2. 2. 1. Modify the default configuration of Sublime Text2
  3. 3. 2. Add the shortcut key to the front-end webpage debugging Function
  4. 4. 3. Add a warranty management artifact
  5. . Common Sublime Text shortcuts
  6. 6. 5. Recommended plug-ins
    1. 6.1. 5.1 theme categories:
    2. 6.2. Other plug-ins

Sublime TextSexiest Editor, cross-platform, free to use

PS: This article mainly applies to Sublime Text configuration in Mac. For other settings, modify the shortcut key by yourself. I wrote an error before. Sublime Text2 is used in Mac, sublime Text3 for another computer is mixed, but there is only a small difference in configuration 2/3. More version differences are reflected in the support of plug-ins.

0. Set subl command line
1234567 # If it is in the default shell, sudo ln-s "/Applications/Sublime Text. app/Contents/SharedSupport/bin/subl "/usr/bin/subl # use the following command for zsh: alias subl =" '/Applications/Sublime Text. app/Contents/SharedSupport/bin/subl '"alias nano =" subl "export EDITOR =" subl"

Test and use the following command

1 $ Subl

Usage

1234567891011121314151617181920 Usage: subl [arguments] [files] edit the specified file edit the given filesor: subl [arguments] [directories] Open the specified directory or: subl [arguments]-edit the stdin parameter Arguments: -- project <project>: load the specified project -- command <command>: run the specified command-n or -- new-window: open a new window-a or -- add: add a folder to the current window-w or -- wait: wait until the file is closed-B or -- background: do not activate the application-s or -- stay: After the file is closed, keep the application active-h or -- help: displays help and exits-v or -- version: display version information and exit if the standard input -- wait is implicit. When a file is closed using -- stay, the file name is not switched to the background Console (only related to whether there is a waiting file) and can be specified by adding the suffix "line" or "line: column. Usage from official documents
1. Modify the default configuration of Sublime Text2

On the menu bar, choose Sublime Text-> Preferences-> Setting-User (note that Setting-Default is the Default system configuration and cannot be modified ), by modifying user settings, the system will overwrite the corresponding default configuration. The following is my configuration list.

12345678910111213141516 {"Color_scheme": "Packages/Theme-itg. flat/itg. dark. tmTheme ", # topic settings. This is automatically generated after the downloaded topic. You can also manually configure" font_size ": 15, # Set the font size, I prefer the bigger font "ignored_packages": # sets the file type to be ignored. The second is ignored by default. The first markdown file is opened using another file. ["Markdown ", "Vintage"], "create_window_at_startup": false, # This setting is disgusting when the new window is automatically opened when the startup is canceled, A blank window "open_files_in_new_window" is automatically generated after each start: false, # a new window is generated when the file is unopened, by default, each time a project is opened, a window "highlight_line": true is generated again. # The current editing line is highlighted. In fact, the highlighted window is not obvious. "highlight_modified_tabs": true, # When setting file modification, the label is highlighted. In this way, you can save "show_encoding": true, # the encoding of the opened file "original_color_scheme": "Packages/Theme-itg is displayed in the lower right corner of the window. flat/itg. dark. tmTheme ", # topic Settings" translate_tabs_to_spaces ": true # change the tab key format to four spaces}
2. Add the shortcut key front-end webpage debugging Function

This feature was previously seen in github projects and the source address of the Project is no longer found. Thanks to the original author.

1. Choose Tools> New Plugin ..., Enter the following content in the created py file:

123456789101112131415161718192021 Import sublime, sublime_pluginimport webbrowser url_map = {'/Users/andrew_liu/HTML/': 'file: // Users/andrew_liu/HTML /', # Here you need to configure the personal computer and configure the personal project path} class OpenBrowserCommand (sublime_plugin.TextCommand): def run (self, edit): window = sublime. active_window () window. run_command ('save') url = self. view. file_name () flag = Falsefor path, domain in url_map.items (): if url. startswith (path): url = url. replace (path, domain ). replace ('\', '\/') flag = Truebreakif not flag: url = 'file: // '+ urlwebbrowser. open_new (url) # use the default browser for debugging

Save the file to the Packages/User directory... Open). The file name is random, such as open_browser.py. The plug-in is partially completed.

2. Next, assign shortcuts to the plug-in. Click menu Tools-> Command Palette ..., Orshift+cmd+p, Open the command set, select "key Bindings-User" to open the personal shortcut key configuration, and enter the following content:

[{ "keys": ["ctrl+shift+b"], "command": "open_browser" }]
This is all the work to be done. You can test it. Open an html file and press ctrl + shift + B. The file will be opened in the default browser. The ing from the site directory to URL configured in url_map should also be available.

3. Add a warranty management artifact

Recently, the Package Control seems to have been down by the wall. I can't go to another computer, but it's not clear. We know that if you can't go to it all the time, pleaseWall flip

Installation Process: Use the shortcut key control + or chooseView > Show Console

  • Sublime Text3 input on the console
1 Import urllib. request, OS, hashlib; h = '7183a2d3e96f11eeadd761d777e62404 '+ 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'package Control. sublime-package '; ipp = sublime. installed_packages_path (); urllib. request. install_opener (urllib. request. build_opener (urllib. request. proxyHandler (); by = urllib. request. urlopen ('HTTP: // packagecontrol. io/'+ pf. replace ('', '% 20 ')). read (); dh = hashlib. sha256 (). Hexdigest (); print ('error validating download (got % s instead of % s), please try manual install '% (dh, h) if dh! = H else open (OS. path. join (ipp, pf), 'wb'). write ()
  • Sublime Text2 input on the console
1 Import urllib2, OS, hashlib; h = '7183a2d3e96f11eeadd761d777e62404 '+ 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'package Control. sublime-package '; ipp = sublime. installed_packages_path (); OS. makedirs (ipp) if not OS. path. exists (ipp) else None; urllib2.install _ opener (urllib2.build _ opener (urllib2.ProxyHandler (); by = urllib2.urlopen ('HTTP: // packagecontrol. io/'+ pf. replace ('', '% 20 ')). read (); dh = Hashlib. sha256 (). hexdigest (); open (OS. path. join (ipp, pf), 'wb '). write (by) if dh = h else None; print ('error validating download (got % s instead of % s), please try manual install '% (dh, h) if dh! = H else 'Please restart Sublime Text to finish installation ')

Use the shortcut key to open the package management artifactshift + cmd + pAnd enter the package or some abbreviations.

4. Common Sublime Text shortcuts
Shortcut key combination Function
shift + cmd + p Open Command Panel
Control +' Console
cmd + n Create tag
Cmd + number Tag switching
cmd + option + 2 Split into two screens
Control + number Move to different screens when split screens
cmd + delelte Delete all the characters before the cursor. It looks like a Mac shortcut.
cmd + f Search
option + cmd + f Search and replace
cmd + t File jump
control + g Line jump, similar to num + gg in vim
cmd + r Function jump
cmd + / Add or remove comments to or from selected rows
Cmd + [or cmd +] Smart line indent
cmd + k + b Switch sidebar

For more shortcut keys, see the official documentation.

5. Recommended plug-ins

Plug-ins are a very important part. A general editor is difficult to meet the needs of most people, and it is more difficult to meet the diversified programming languages of programmers. Therefore, plug-ins must be used to createPersonalized class IDECompared with IDE, it has the advantages of Fast startup, clean, and less interference.

5.1 topic categories:
  • Plug-in packages containing a large number of color themes
    First, we will introduce a website that contains a large number of color packages, Colorsublime. various colors are dazzling.
    Colorsublime Plugin

Installation Method:

1234 Shift + cmd + p open the Command Panel and enter the "Package Control: Install Package" command and enter Colorsublime plugin. Find the Package and press Enter. After installation is successful, select the color in preferences.

Colorsublime Plugin github Project address

  • ITg theme, my favorite

Installation Method

1234 Shift + cmd + p open the Command Panel and enter the "Package Control: Install Package" command and enter Theme-itg. flat. Then, press enter to Install the Package successfully and select the topic in preferences.

Github address of the project

  • Famous Soda topic

Installation Method

1234567 Shift + cmd + p open the Command Panel, enter "Package Control: Install Package", enter soda, and find Theme-Soda, find and press Enter. After installation is successful, select Setting-User in preferences to change the theme settings: {"theme": "Soda Light 3. sublime-theme "}

Github Project address

5.2. Other plug-ins

The installation method is controlled by the Package.

123 Shift + cmd + p open the Command Panel, enter the "Package Control: Install Package" command, enter the short or full spelling of the plug-in to be installed, find it, and press enter to Install
  • Alignment
    I forgot what I did. It seems that it controls the indentation of all types of text.
  • All Autocomplete
    Sublime only does not search the current file in this file,all AutocompleteIs to find all open files incomplete, select more comprehensive
  • ConverttoUTF8
    All files edited use UTF-8 Encoding
  • Docblockr
    Powerful document annotation function, as long as you enter/*Click the tab to automatically generate comments based on the code,
  • Emmet
    Front-end artifacts reduce the workload. For more information, see Emmet: HTML/CSS code to quickly compile artifacts or official documents.
  • Git
    It supports git operations on sublime.
  • Markdownediting or markdownPerview
    This is essential for writing Markdown. You can install it in the package manager. After the script is installed, you can press ctrl + B to directly generate HTML and display it in the browser when writing Markdown (the syntax is Markdown in the lower right corner.
  • Jsformat
    JavaScript code formatting
  • Sidebarenhancement
    This is used to enhance the left sidebar. You can open the left sidebar in View> Side Bar> Show Side Bar. You can use Project> Add Folder to Project... Add common folders to the sidebar. After this plug-in is installed, the right-click menu on the sidebar has more functions, which is quite practical.
  • Bracket Highlighter
    This is used for matching the brackets and highlighting. you can install it in the package manager. The brackets in Sublime Text 2 are matched with only a small horizontal line, which is too inconspicuous. This can make the highlight big, but I think it will cover the cursor.

  • SublimeLinter
    The syntax detection tool can detect the syntax errors of the written code and highlight the errors.
    User Manual
    Install an additional package, as shown in figureSublimeLinter-pyflakes and SublimeLinter-pep8.SublimeLinter-jshint, SublimeLinter-pyyaml, SublimeLinter-csslint, SublimeLinter-html-tidy, and SublimeLinter-json

More

  • Djaneiro
    Supports template and keyword highlighting to provide useful code snippets

Not installed:

  • Anaconda
    Build a python IDE

    Anaconda turns your Sublime Text 3 in a full featured Python development IDE including autocompletion, code linting, IDE features, autopep8 formating, McCabe complexity checker and Vagrant for Sublime Text 3

For more information about Sublime Text, refer:

Ubuntu installation code editor Sublime Text 3 (Build 3083)

Animation display 16 Sublime Text Shortcut Key Usage

Ubuntu 12.10 install and crack Sublime Text 2

Install Sublime Text 2 on Ubuntu 13.04

Code artifact-Sublime Text package management tools and extensions

How to Develop the Sublime Text 2 plug-in

Install and crack the Sublime Text 2 editor in Windows Mac Linux

Text Editor Sublime Text User Experience

Sublime Text details: click here
Sublime Text: click here

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.