One, code Snippets
Developers often do some repetitive work.
For different data tables and additions and deletions are similar, repeated to re-go. Long time did not write the program, the use of 11 holidays at home to read books, write programs.
Recently has been very fond of using the sublime Text, found that its code snippet management function is good, as long as the input predefined phrases, large pieces of code can be automatically populated. You can also define variables.
such as PHP code. Each parameter can be defined in the same way as ${0}, others in turn. If you want to keep the $ character in the snippet, just add \ on the front. such as: \ $data
The setup steps are as follows:
1, select Tools-"New Snippet
This will create an empty code snippet template. As follows:
<![CDATA[<span class="xml"> <span class="xml"> <span class="tag"> <span class="title">snippet</span>></span><span class="tag"><span class="title">content</span>></span> </span> <![CDATA[Hello, ${1:this} is a ${2:snippet}.]]> content > Snippet >
[ ]
put your code in the middle, want to replace the key words with ${} to rewrite, the middle of the number is the order of the cursor, press the TAB key to switch.
Tabtrigger: For keywords entered in the editor, then press the TAB key
Scope: For where the type of source program works, of course, you can not set
Description: Information for prompting instructions
Write it well, save it. Keep in mind that you must save the. sublime-snippet extension. If you open an existing one, you can find it through the preferences-"Browse Packages in the user's account. Please note that I am using my Mac's laptop and I don't know where the Windows system is, and I haven't used this software under Windows.
Here is a small template I wrote:
<snippet> <content><![CDATA[/*** 删除* @param string \$${1} 数据记录的标识ID* @param string \$${2:tabelname} 数据表名称* @return void**/public function del(){\$${1} = trim(\$_GET['${1}']);if(empty(\$${1})){\$this->Error (' The record does not exist! ') ');} \ $result = M (' ${2:tabelname} ')->where (Array (' ${1} ' =>\$${1})->delete (), \ $this->message (\ $result, ' __url__/index ', ' Delete succeeded! ', ' Delete failed! ');} ]]> Content > <tabtrigger>Tpdel Tabtrigger > <description>Thinkphp-del () Delete a data method Description > Snippet >
With sublime Text 3 very handy, but in writing PHP program debugging is not convenient, write PHP program or use Phpstorm, I use is PHPSTORM6. After the above situation, I would like to be able to do so under the Phpstorm. After research found that the development tool can also, it is very cool ah. Tip: Command + J in the editor can be a hint. Under Windows, you should CTRL + J.
How to use it:
There is a Live Templates setting in the preferences, there are a lot of examples, you can try Ah. The template is edited in the same way as above sublime text. It just doesn't need to be escaped in here.
If you want to keep the $ character in the template, just enter $$. It also supports setting default values for parameters and automatic formatting after output.
The development efficiency will be greatly improved with the use of development tools.
Source: >
Second, the online installation of plug-ins
ctrl+`or View > Show Console
Sublime Text 3
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)) ifDH! = h ElseOpen (Os.path.join (IPP, PF), ' WB '). Write (by)
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: >
third, set their own style
Sublime Text 3 configuration explanation (default)
{
Set up theme files
"Color_scheme": "Packages/color scheme–default/monokai.tmtheme",
Set font and size
"Font_face": "Consolas",
"Font_size": 12,
Font options: No_bold do not display bold characters, no_italic do 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 will select the current content, if the following characters appear, it will be truncated
"Word_separators": "./\\ () \" '-:,.; <>~!@#$%^&*|+=[]{} ' ~? ',
Whether to display line numbers
"Line_numbers": true,
Whether to show line number Sidebar
"Gutter": true,
Line number sidebar and text spacing
"Margin": 4,
Whether to show Code collapse button
"Fold_buttons": true,
The code collapse button always appears, regardless of the mouse in the line number sidebar
"Fade_fold_buttons": true,
column displays a vertical ruler, filled with numbers in brackets, width by character
"Rulers": [],
Whether to turn on spell checking
"Spell_check": false,
Tab TAB width
"Tab_size": 4,
When set to true, indents and when you encounter the TAB key use a space instead
"Translate_tabs_to_spaces": false,
Otherwise acting on a single space
"Use_tab_stops": true,
"Detect_indentation": true,
Automatically aligns with tab stops when you press ENTER
"Auto_indent": true,
For the C language
"Smart_indent": false,
Need to enable auto_indent to insert spaces when opening parentheses for the first time? (No test results ...) )
"Indent_to_bracket": true,
Shows whether the aligned white line is automatically filled according to the carriage return, tab, etc.
"Trim_automatic_white_space": true,
Whether to wrap the line automatically, if you choose Auto, you need double quotation marks
"Word_wrap": false,
Sets the width of the text area within the window
"Wrap_width": 0,
Prevent word wrapping that is indented to the same level
"Indent_subsequent_lines": true,
If not defined, the file is centered (such as a newly created file)
"Draw_centered": false,
Auto-match quotes, brackets, etc.
"Auto_match_enabled": true,
Word list path for spelling checker
"Dictionary": "Packages/language–english/en_us.dic",
Whether the visual area portion of the code map is bordered by a border, the color of the border can be added to the Minimapborder key on the color scheme
"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 display the parentheses of the current cursor, the end of the terminal closure mark
"Match_brackets": true,
When set to False, Match_brackets only takes effect when the cursor is at both ends of the parenthesis or the end-of-tail closure mark
"Match_brackets_content": true,
Whether to highlight parentheses, Match_brackets is True
"Match_brackets_square": false,
Whether to highlight curly braces, match_brackets for True
"Match_brackets_braces": false,
Whether to highlight the angle brackets, Match_brackets is valid for true
"Match_brackets_angle": false,
HTML and XML highlight the cursor at both ends of the label, affecting HTML, XML, CSS, etc.
"Match_tags": true,
Full-text highlighting with the same character as the currently selected character
"Match_selection": true,
Sets the spacing to the top, in pixels, of each line, with the effect equal to leading
"Line_padding_top": 1,
Sets the amount of space, in pixels, of each line to the bottom, with the effect of leading
"Line_padding_bottom": 1,
When set to false, when scrolling to the bottom of the text, there is no buffer
"Scroll_past_end": true,
Control what happens when you go up or down to the first or last row
"Move_to_limit_on_up_down": false,
When you press space or tab, the actual result is a white dot (a single dot) or a white horizontal line (the width of the tab set by the Tab_size), which you can see in the selected state.
When set to none, these dots and lines are not displayed under any circumstances
When set to selection, only points and lines in the selected state are displayed
When set to all, it is always displayed
"Draw_white_space": "Selection",
Whether the the line is displayed on the tab stop, the color can be set in the theme file (guide,activeguide,stackguide)
"Draw_indent_guides": true,
tab stops on the the line, Draw_normal is always displayed, draw_active to show only the code control domain where the current cursor is located
"Indent_guide_options": ["Draw_normal"],
If true, the extra space after each line is deleted when the file is saved
"Trim_trailing_white_space_on_save": false,
True to save the file with the cursor changing one line at the end of the file
"Ensure_newline_at_eof_on_save": false,
Switch to another file tag or click Other non-software area, the file is saved automatically
"Save_on_focus_lost": false,
ASCII, UTF-8, and UTF-16 are automatically detected when encoding is not automatically detected during encoding
"Fallback_encoding": "Western (Windows 1252)",
Default encoding format
"Default_encoding": "Utf-8″,
Files that contain empty bytes are opened by default to hexadecimal
"Enable_hexadecimal_encoding": true,
What character to use as Terminator at the end of each line
"Default_line_ending": "System",
When set to Enabled, pressing tab between a string inserts a tab character
When set to True, pressing TAB fills the code automatically according to the front and back environment
"Tab_completion": true,
Code hints
"Auto_complete": true,
Size limit for code hints
"Auto_complete_size_limit": 4194304,
Code hint delay display
"Auto_complete_delay": 50,
Control range for Code hints
"Auto_complete_selector": "Source–comment",
Other scenarios that trigger code hints
"Auto_complete_triggers": [{"selector": "text.html", "Characters": "<"}],
When set to False, the code that selects the hint can be output by a carriage return or click, but when True is not output, it will be wrapped directly.
"Auto_complete_commit_on_tab": false,
Set to False, use SHIFT + TAB to always insert tabs
"Shift_tab_unindent": true,
The selected text is automatically copied to the text box in the Find panel when you press CTRL + F
"Find_selected_text": true,
Topics for Data\packages\theme–default\default.sublime-theme control software
"Theme": "Default.sublime-theme",
Speed of scrolling
"Scroll_speed": 1.0,
Left Sidebar folder animation
"Tree_animation_enabled": true,
The Close button of the tab page
"Show_tab_close_buttons": true,
For OS X
"Use_simple_full_screen": false,
Horizontal vertical scroll bar: System and disabled are displayed by default, enabled for auto-hide display
"Overlay_scroll_bars": "System",
Hot eject feature! Exit without prompting to save the file, but exit directly
The next time you open the software, the file will remain in the state before the exit, the content is not saved, but it is not actually written in the original file
"Hot_exit": true,
The software uses the final settings to open the file, Hot_exit is true when there is no effect
"Remember_open_files": true,
For OS X
"Open_files_in_new_window": true,
For OS X
"Close_windows_when_empty": true,
Which files will be displayed on the sidebar
"Folder_exclude_patterns": [". SVN", ". Git", ". 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", "*.SW F "," *.jar "," *.zip "],
Delete the plugin you want to ignore, need to reboot, remove Vinage to turn on 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"
}
Shortcut keys:
[
{"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: >
Four, shortcut keys
ctrl+d Word Selection (press the shortcut key repeatedly to continue to edit the next same text at the same time) Ctrl+g jump to the appropriate line
ctrl+j Merge rows (multiple rows that need to be merged are selected)
Ctrl+l Select Entire row (press and hold-continue to select the downstream)
ctrl+m cursor to start or end position within parentheses
ctrl+t Word Exchange
Ctrl+u Soft undo
ctrl+p Find files in the current project and quick search; Enter @ To find the main title/function of the file, or enter: Jump to a file line;
ctrl+r quickly list/jump to a function
ctrl+k Backspace Delete from cursor to beginning of line
ctrl+k+b Toggle Sidebar on/off
CTRL+KK Delete from cursor to end of line
Ctrl+k+t Collapsing Properties
ctrl+k+u Change to uppercase
ctrl+k+l change to lowercase
ctrl+k+0 Expand All
Ctrl+enter Insert Line (quick line wrapping)
ctrl+tab tab Toggle in the current window
Ctrl+shift+a Select the cursor position parent tag pair child
Ctrl+shift+d the entire line where the cursor is copied, before inserting the line
ctrl+shift+f in folders, unlike normal editors, Sublime allows you to add multiple folders to find
ctrl+shift+k Delete an entire row
ctrl+shift+l the mouse to select multiple rows (pressing the shortcut key), you can edit the lines at the same time
Ctrl+shift+m Select the contents in parentheses (press and hold-continue to select the parent bracket)
ctrl+shift+p Open Command Panel
ctrl+shift+/Comment Selected content
ctrl+shift+↑ can move this line of code, with upstream interchange
ctrl+shift+↓ can move this line of code, with the downstream interchange
ctrl+shift+[Folding Code
ctrl+shift+] Unwind code
ctrl+shift+enter insert Row before cursor
Ctrl+pagedown, ctrl+pageup files are switched on and off in the open sequence
Ctrl + Z undo
ctrl+y Recovery undo
ctrl+f2 setting/canceling bookmarks
ctrl+/Comment Entire line (if selected, same as "ctrl+shift+/" effect)
Ctrl + left mouse button to select multiple text to edit at the same time
shift+ the right mouse button (or using the middle mouse button) can use the mouse to select the vertical multi-line
shift+f2 Previous Bookmark
Shift+tab removing indents
alt+shift+1 (non-keypad) 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 left and right split screen-4 columns
alt+shift+5 4 Screen
alt+shift+8 Vertical Split screen-2 screen
alt+shift+9 Vertical Split screen-3 screen
ctrl+shift+ To assign the current focus page to the split-screen sequence number page
ALT +. Close the current label
alt+f3 Selected text press the shortcut key, you can select all the same text at once to edit simultaneously
Tab Indent Auto-complete
F2 Next Bookmark
F6 detecting syntax errors
F9 Row Sort (by A-Z)
F11 Full Screen mode
http://www.bkjia.com/PHPjc/733035.html www.bkjia.com true http://www.bkjia.com/PHPjc/733035.html techarticle first, the code snippet developers often do some repetitive work. For different data tables and additions and deletions are similar, repeated to re-go. Long time did not write the program, the use of 10 ...