Home > Backend Development > PHP Tutorial > Configuration (organizing) of sublime text3_PHP tutorial

Configuration (organizing) of sublime text3_PHP tutorial

WBOY
Release: 2016-07-13 10:39:13
Original
894 people have browsed it

1. Code snippets

Developers often do repetitive work.

The additions, deletions, modifications and queries for different data tables are almost the same, and they are repeated over and over again. I haven’t written programs for a long time. I used the National Day holiday to read books and write programs at home.

I have been enjoying using Sublime Text recently and found that its code snippet management function is good. As long as you enter a pre-defined phrase, large code snippets can be automatically filled in. Variables can also be defined.

Such as PHP code. You can use ${0} to define each parameter, and so on. If you want to keep the $ symbol in your code snippet, just add it in front of $. Such as: $data

The setting steps are as follows:

1, select Tools-》New Snippet

This will create an empty snippet template. As follows:

snippet>content> content>snippet>

Put your code in the middle of [ ]. Use ${} to rewrite which keyword you want to replace. The number in the middle is the order of the cursor. Press the TAB key to switch.

tabTrigger: for the keyword entered in the editor, and then press the TAB key
scope: for where it will work in the class source program, of course it does not need to be set
description: for the prompt information

After writing, save it. Remember to save it with the .sublime-snippet extension. If you open an existing one, you can find it in the user directory through Preferences - "Browse Packages." Please note that I am using a MAC notebook. I don’t know where it is under the Windows system. I have never used this software under Windows.

The following is a small template I wrote:

snippet> content> error('This record does not exist!'); } $result = M('${2:tabelname}')->where(array('${1}'=>$${1}))->delete(); $this->message($result,'__URL__/index','Deletion successful!','Deletion failed!'); } ​ ​ ]]> content> tabTrigger>tpdeltabTrigger> description>ThinkPHP - del() delete a data methoddescription>snippet>

It’s easy to use Sublime Text 3, but it’s not convenient to debug when writing PHP programs. It’s better to use PhpStorm when writing PHP programs. I use PhpStorm6. After going through the above situation, I wonder if this can also be done under PhpStorm. After research, I found that this development tool can also be used, which is really cool. Tip: Just command + J in the editor to get a prompt. Under windows it should be ctrl + J.

Usage is:

There is a Live Templates setting item in Preferences. There are many examples there, you can try it. The editing method of the template is similar to the Sublime Text above. It's just that there is no need for escaping here.

If you want to keep the $ symbol in the template, just enter $$. It also supports setting default values ​​of parameters and automatic formatting after output.

Make good use of development tools, and development efficiency will be greatly improved.


来源: >   二、在线安装插件

ctrl+` or  View > Show Console

sublime text 3

Configuration (organizing) of sublime text3_PHP tutorial import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404e330c659d4bb41d3bdf022e94cab3cd0'; 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://sublime.wbond.net/' + pf.replace(' ''%20')).read(); dh = hashlib.sha256(by).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(by) Configuration (organizing) of sublime text3_PHP tutorial

sublime text 2

1 import urllib2,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404e330c659d4bb41d3bdf022e94cab3cd0'; 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://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).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')

  


Source: > 3. Set your own style Sublime Text 3 configuration explanation (default)
{
// Set theme file
"color_scheme": "Packages/Color Scheme – Default/Monokai.tmTheme",
// Set font and size
"font_face": "Consolas",
"font_size": 12,
// Font option: no_bold does not display bold Words, no_italic does not display italics, no_antialias and no_antialias turn off anti-aliasing
// subpixel_antialias and no_round are unique to OS X systems
"font_options": [],
// Double-click on the text to display all Select the current content. If the following characters appear in it, it will be truncated
"word_separators": "./\()"'-:,.;~!@#$%^&*|+ =[]{}`~?",
// Whether to display line numbers
"line_numbers": true,
// Whether to display line number sidebar
"gutter": true,
// The spacing between the line number sidebar and the text
"margin": 4,
// Whether to display the code fold button
"fold_buttons": true,
// Regardless of whether the mouse is on the line number sidebar or not, The code fold button is always displayed
"fade_fold_buttons": true,
//The column displays a vertical ruler, fill in the numbers in the square brackets, and the width is calculated in characters
"rulers": [],
/ / Whether to turn on spell check
"spell_check": false,
// Tab key tab width
"tab_size": 4,
// When set to true, indent and encounter Tab Use spaces instead of keys
"translate_tabs_to_spaces": false,
// Otherwise it works on a single space
"use_tab_stops": true,
"detect_indentation": true,
// Press Enter When, automatically align with the tab stop
"auto_indent": true,
//For C language
"smart_indent": false,
//You need to enable auto_indent, open the bracket indentation for the first time Insert spaces when entering? (The effect has not been tested...)
"indent_to_bracket": true,
// Whether the white lines displayed are automatically filled according to carriage return, tab and other operations
"trim_automatic_white_space": true,
// Whether to automatically wrap lines, if you select auto, you need to add double quotes
"word_wrap": false,
// Set the width of the text area in the window
"wrap_width": 0,
// Prevent words that are indented to the same level from wrapping.
"indent_subsequent_lines": true,
// If it is not defined, the file will be displayed in the center (such as a new file)
"draw_centered": false,
// Automatically match quotes, brackets, etc.
"auto_match_enabled": true,
// Word list path for spell checker
"dictionary": "Packages/Language – English/en_US.dic",
// Whether to add a border to the visible area of ​​the code map. The color of the border can be added to the color scheme by adding the minimapBorder key
"draw_minimap_border": false,
// Highlight the line where the current cursor is located
"highlight_line": false,
//Set the cursor flashing mode
"caret_style": "smooth",
//Whether to specially display the parentheses where the current cursor is located, and the code head and tail closing marks
"match_brackets": true,
// When set to false, match_brackets will only take effect when the cursor is at both ends of the brackets or closing tags
"match_brackets_content": true,
// Whether to highlight Display parentheses, effective when match_brackets is true
"match_brackets_square": false,
// Whether to highlight braces, effective when match_brackets is true
"match_brackets_braces": false,
// Whether to highlight sharp brackets Brackets, match_brackets is effective when true
"match_brackets_angle": false,
// Under html and xml, highlight both ends of the tag where the cursor is, affecting HTML, XML, CSS, etc.
"match_tags": true,
// Highlight characters that are the same as the currently selected character in the full text
"match_selection": true,
// Set each line to the top, the spacing in pixels, the effect is equivalent to line spacing
"line_padding_top ": 1,
// Set the spacing in pixels from each line to the bottom, the effect is equivalent to line spacing
"line_padding_bottom": 1,
// When set to false, scroll to the end of the text below, there is no buffer
"scroll_past_end": true,
// Controls what happens when going up or down to the first or last row
"move_to_limit_on_up_down": false,
// Press When space or tab is used, white dots (one space and one dot) or white horizontal lines (the width of the tab character set by tab_size) will actually be generated, which can only be seen when it is selected
// When set to none, what These points and lines are not displayed in any case
// When set to selection, only the points and lines in the selected state will be displayed
// When set to all, it will always be displayed
"draw_white_space": "selection",
// Alignment of tab stops Whether the white line is displayed, the color can be set in the theme file (guide, activeGuide, stackGuide)
"draw_indent_guides": true,
// Alignment of the white line at the tab stop, draw_normal means always display, draw_active means only display The code control domain where the current cursor is located
"indent_guide_options": ["draw_normal"],
// When it is true, the extra spaces after the end of each line will be deleted when saving the file
"trim_trailing_white_space_on_save": false,
// When it is true, the cursor will move down one line at the end of the file when saving the file
"ensure_newline_at_eof_on_save": false,
// Switch to other file tags or click on other non-software areas, files Auto-save
"save_on_focus_lost": false,
// When encoding cannot be automatically detected, ASCII, UTF-8 and UTF-16 will be automatically detected
"fallback_encoding": "Western (Windows 1252)" ,
//Default encoding format
“default_encoding”: “UTF-8″,
// Files containing null bytes are opened in hexadecimal by default
“enable_hexadecimal_encoding”: true,
// What character is used as the terminator at the end of each line?
"default_line_ending": "system",
// When set to enabled, pressing Tab between a string will insert a tab character
// When set to true, pressing Tab will automatically match and fill the code according to the surrounding environment
"tab_completion": true,
// Code prompt
"auto_complete": true,
/ / Code prompt size limit
"auto_complete_size_limit": 4194304,
// Code prompt delay display
"auto_complete_delay": 50,
// Control range of code prompt
"auto_complete_selector": "source – comment",
//Other situations that trigger code prompts
"auto_complete_triggers": [ {"selector": "text.html", "characters": " // When set to false, select the prompted code and press Enter or click to output it, but when true is selected, it will not be output but will be directly wrapped in a new line
"auto_complete_commit_on_tab": false,
// Set to false, use Shift + tab always inserts tab characters
"shift_tab_unindent": true,
// When the selected text is pressed Ctrl + f, it will be automatically copied to the text box of the find panel
"find_selected_text": true,
// DataPackagesTheme – DefaultDefault.sublime-theme controls the theme of the software
"theme": "Default.sublime-theme",
// Scroll speed
"scroll_speed": 1.0,
// Left sidebar folder animation
"tree_animation_enabled": true,
// Tab close button
"show_tab_close_buttons": true,
// For OS X
"use_simple_full_screen" : false,
// Horizontal and vertical scroll bars: system and disabled are the default display modes, and enabled is automatically hidden and displayed
"overlay_scroll_bars": "system",
// Hot launch function! When exiting, you will not be prompted whether to save the file, but will exit directly
//The next time you open the software, the file will remain in the state before exiting. The content that was not saved in time is still there, but it is not actually written in the original file
"hot_exit": true,
// The software uses the last settings to open the file. When hot_exit is true, it has no effect
"remember_open_files": true,
//For OS X
"open_files_in_new_window" : true,
// For OS , ".hg", "CVS"],
"file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj"," *.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*. pdb", "*.idb", ".DS_Store", "*.class", "*.psd", "*.db"],
// Goto Anything or Find in Files
"binary_file_patterns" : ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
// Delete the plug-ins you want to ignore, you need to restart, remove Vinage and enable it vim mode
"ignored_packages": ["Vintage"]



}

My Configuration

: {

“default_encoding”: “UTF-8″,

    "auto_complete_commit_on_tab": false,
    "auto_complete_delay": 0,
    "auto_complete_with_fields": true,
    "auto_indent": true,
    "auto_match_enabled": true,
    "bold_folder_labels": true,
    "caret_style": "wide",
    "color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme",
    "fade_fold_buttons": false,
    "fold_buttons": true,
    "font_face": "Consolas",
    "font_options":[],
    "font_size": 13,
    "highlight_line": true,
    "hot_exit": false,
    "ignored_packages":[],
    "match_brackets_angle": true,
    "match_brackets_content": true,
    "match_tags": true,
    "remember_open_files": false,
    "smart_indent": true,
    "tab_size": 4,
    "word_wrap": "false"
}

 

快捷键:

[
    { "keys": ["ctrl+["], "command": "exit_insert_mode"},
    { "keys": ["ctrl+h"], "command": "left_delete"},    
    { "keys": ["alt+h"], "command": "move", "args": {"by": "characters", "forward": false} },
    { "keys": ["alt+l"], "command": "move", "args": {"by": "characters", "forward": true} },
    { "keys": ["alt+k"], "command": "move", "args": {"by": "lines", "forward": false} },
    { "keys": ["alt+j"], "command": "move", "args": {"by": "lines", "forward": true} },
    { "keys": ["ctrl+j"], "command": "insert", "args": {"characters": "n"} },
    { "keys": ["ctrl+i"], "command": "auto_complete" },
    { "keys": ["ctrl+i"], "command": "replace_completion_with_auto_complete", "context":
        [
            { "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
            { "key": "auto_complete_visible", "operator": "equal", "operand": false },
            { "key": "setting.tab_completion", "operator": "equal", "operand": true }
        ]
    }

    { "keys": ["ctrl+d"], "command": "right_delete" },
    { "keys": ["alt+s"], "command": "save" },

]


Source: > 4. Shortcut keys Ctrl+D word selection (repeatedly press the shortcut key to continue down and select the next same text for simultaneous editing) Ctrl+G Jump to the corresponding line
Ctrl+J Merge lines (when multiple lines to be merged have been selected)
Ctrl+L Select the entire Line (hold - continue to select the next line)
Ctrl+M Move the cursor to the beginning or end of the brackets
Ctrl+T Word swap
Ctrl+U soft undo
Ctrl+P to find files in the current project and quick search; enter @ to find the main title/function of the file; or enter: to jump to a certain line of the file ;
Ctrl+R Quickly list/jump to a function
Ctrl+K Backspace Delete from the cursor to the beginning of the line
Ctrl+K+B Open/Close the sidebar
Ctrl+KK Delete from the cursor to the end of the line
Ctrl+K+T Collapse attribute
Ctrl+K+U changes to uppercase
Ctrl+K+L changes to lowercase
Ctrl+K+0 expand all
Ctrl+Enter After inserting a line (quick line wrap)
Ctrl+Tab Switch tabs in the current window


Ctrl+Shift+A selects the parent tag pair at the cursor position
Ctrl+Shift+D copies the entire line where the cursor is and inserts it before the line
ctrl+shift +F Search within a folder. The difference from ordinary editors is that sublime allows adding multiple folders to search
Ctrl+Shift+K to delete the entire line
Ctrl+Shift+L Select multiple lines with the mouse (press the shortcut key), and you can edit these lines at the same time
Ctrl+Shift+M Select the content within the brackets (press and hold - to continue selecting the parent brackets )
Ctrl+Shift+P Open the command panel
Ctrl+Shift+/ Annotate the selected content
Ctrl+Shift+↑ can be moved This line of code, interchange with the up line
Ctrl+Shift+↓You can move this line of code, interchange with the down line
Ctrl+Shift+[Collapse code
Ctrl+Shift+] Expand code
Ctrl+Shift+Enter Insert line before cursor


Ctrl+PageDown, Ctrl+ PageUp files are switched in the order they were opened


Ctrl+Z Undo
Ctrl+Y Undo
Ctrl+F2 Set/cancel bookmarks
Ctrl+/ Comment the entire line (if the content is selected, the same effect as "Ctrl+Shift+/")
Ctrl+left mouse button can Select multiple texts to be edited at the same time


Shift+right mouse button (or use the middle mouse button) can use the mouse to select vertical multiple lines
Shift+F2 Previous bookmark
Shift+Tab remove indent
Alt+Shift+1 (non-keyboard) window split screen, restore the default 1 screen
Alt+Shift+2 Left and right split screen-2 columns
Alt+Shift+3 Left and right split screen-3 columns
Alt+ Shift+4 Split screen left and right - 4 columns
Alt+Shift+5 Divide 4 screens equally
Alt+Shift+8 Split screen vertically - 2 screens
Alt+Shift+9 vertical split screen - 3 screens


Ctrl+Shift+split screen number assigns the current focus page to the split screen number page


Alt+. Close the current label
Alt+F3 Select the text and press the shortcut key to select all the same text at once for editing simultaneously


Tab indent auto-complete
F2 Next bookmark
F6 Detect syntax errors
F9 row sorting (press a-z)
F11 full screen mode

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/733035.htmlTechArticle1. Code snippets Developers often do repetitive work. The additions, deletions, modifications and queries for different data tables are similar, and they are repeated over and over again. I haven’t written a program for a long time, so I used ten...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template