插件下载
http://www.cnblogs.com/457220157-FTD/p/5546545.html
https://www.jianshu.com/p/3b6aa8e32be5
sublimeLinter 检查代码软件
https://segmentfault.com/a/1190000000389188
themr 自动切换主题插件
可以下载predawn,过一会儿就会显示可以切换主题,ctrl + f5
Boxy
主题查考
https://scotch.io/@Viclotana/the-10-best-sublime-text-3-themes-of-2017#conclusion
user配置
default的翻译
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
// While you can edit this file, it’s best to put your changes in // “User/Preferences.sublime-settings”, which overrides the settings in here. // // Settings may also be placed in file type specific options files, for // example, in Packages/Python/Python.sublime-settings for python files. { // Sets the colors used within the text area // 主题文件的路径 “color_scheme”: “Packages/Color Scheme – Default/Monokai.tmTheme”, // Note that the font_face and font_size are overriden in the platform // specific settings file, for example, “Preferences (Linux).sublime-settings”. // Because of this, setting them here will have no effect: you must set them // in your User File Preferences. // 设置字体和大小,必须在Settings-User里重写,这里设置没有任何效果 “font_face”: “Consolas”, “font_size”: 12, // Valid options are “no_bold”, “no_italic”, “no_antialias”, “gray_antialias”, // “subpixel_antialias” and “no_round” (OS X only) // 字体选项:no_bold不显示粗体字,no_italic不显示斜体字,no_antialias和no_antialias关闭反锯齿 // subpixel_antialias和no_round是OS X系统独有的 “font_options”: [], // Characters that are considered to separate words // 在文字上双击会全选当前的内容,如果里面出现以下字符,就会被截断 “word_separators”: “./\\()\”‘-:,.;<>~!@#$%^&*|+=[]{}`~?”, // Set to false to prevent line numbers being drawn in the gutter // 是否显示行号 “line_numbers”: true, // Set to false to hide the gutter altogether // 是否显示行号边栏 “gutter”: true, // Spacing between the gutter and the text //行号边栏和文字的间距 “margin”: 4, // Fold buttons are the triangles shown in the gutter to fold regions of text // 是否显示代码折叠按钮 “fold_buttons”: true, // Hides the fold buttons unless the mouse is over the gutter // 不管鼠标在不在行号边栏,代码折叠按钮一直显示 “fade_fold_buttons”: true, // Columns in which to display vertical rulers //列显示垂直标尺,在中括号里填入数字,宽度按字符计算 “rulers”: [], // Set to true to turn spell checking on by default // 是否打开拼写检查 “spell_check”: false, // The number of spaces a tab is considered equal to // Tab键制表符宽度 “tab_size”: 4, // Set to true to insert spaces when tab is pressed // 设为true时,缩进和遇到Tab键时使用空格替代 “translate_tabs_to_spaces”: false, // If translate_tabs_to_spaces is true, use_tab_stops will make tab and // backspace insert/delete up to the next tabstop // translate_tabs_to_spaces设置为true,Tab和Backspace的删除/插入作用于制表符宽度 // 否则作用于单个空格 “use_tab_stops”: true, // Set to false to disable detection of tabs vs. spaces on load // false时禁止在载入的时候检测制表符和空格 “detect_indentation”: true, // Calculates indentation automatically when pressing enter // 按回车时,自动与制表位对齐 “auto_indent”: true, // Makes auto indent a little smarter, e.g., by indenting the next line // after an if statement in C. Requires auto_indent to be enabled. //针对C语言的 “smart_indent”: false, // Adds whitespace up to the first open bracket when indenting. Requires // auto_indent to be enabled. // 需要启用auto_indent,第一次打开括号缩进时插入空格?(没测试出来效果…) “indent_to_bracket”: true, // Trims white space added by auto_indent when moving the caret off the // line. // 显示对齐的白线是否根据回车、tab等操作自动填补 “trim_automatic_white_space”: true, // Disables horizontal scrolling if enabled. // May be set to true, false, or “auto”, where it will be disabled for // source code, and otherwise enabled. // 是否自动换行,如果选auto,需要加双引号 “word_wrap”: false, // Set to a value other than 0 to force wrapping at that column rather than the // window width // 设置窗口内文字区域的宽度 “wrap_width”: 0, // Set to false to prevent word wrapped lines from being indented to the same // level // 防止被缩进到同一级的字换行 “indent_subsequent_lines”: true, // Draws text centered in the window rather than left aligned // 如果没有定义过,则文件居中显示(比如新建的文件) “draw_centered”: false, // Controls auto pairing of quotes, brackets etc // 自动匹配引号,括号等 “auto_match_enabled”: true, // Word list to use for spell checking // 拼写检查的单词列表路径 “dictionary”: “Packages/Language – English/en_US.dic”, // Set to true to draw a border around the visible rectangle on the minimap. // The color of the border will be determined by the “minimapBorder” key in // the color scheme // 代码地图的可视区域部分是否加上边框,边框的颜色可在配色方案上加入minimapBorder键 “draw_minimap_border”: false, // If enabled, will highlight any line with a caret // 突出显示当前光标所在的行 “highlight_line”: false, // Valid values are “smooth”, “phase”, “blink”, “wide” and “solid”. // 设置光标闪动方式 “caret_style”: “smooth”, // Set to false to disable underlining the brackets surrounding the caret // 是否特殊显示当前光标所在的括号、代码头尾闭合标记 “match_brackets”: true, // Set to false if you’d rather only highlight the brackets when the caret is // next to one // 设为false时,只有光标在括号或头尾闭合标记的两端时,match_brackets才生效 “match_brackets_content”: true, // Set to false to not highlight square brackets. This only takes effect if // match_brackets is true // 是否突出显示圆括号,match_brackets为true生效 “match_brackets_square”: false, // Set to false to not highlight curly brackets. This only takes effect if // match_brackets is true // 是否突出显示大括号,match_brackets为true生效 “match_brackets_braces”: false, // Set to false to not highlight angle brackets. This only takes effect if // match_brackets is true // 是否突出显示尖括号,match_brackets为true生效 “match_brackets_angle”: false, // Enable visualization of the matching tag in HTML and XML // html和xml下突出显示光标所在标签的两端,影响HTML、XML、CSS等 “match_tags”: true, // Highlights other occurrences of the currently selected text // 全文突出显示和当前选中字符相同的字符 “match_selection”: true, // 设置每一行到顶部,以像素为单位的间距,效果相当于行距 “line_padding_top”: 1, // 设置每一行到底部,以像素为单位的间距,效果相当于行距 “line_padding_bottom”: 1, // 设置为false时,滚动到文本的最下方时,没有缓冲区 “scroll_past_end”: true, // 控制向上或向下到第一行或最后一行时发生什么(没明白也没试出来) “move_to_limit_on_up_down”: false, // 按space或tab时,实际会产生白色的点(一个空格一个点)或白色的横线(tab_size设置的制表符的宽度),选中状态下才能看到 // 设置为none时,什么情况下都不显示这些点和线 // 设置为selection时,只显示选中状态下的点和线 // 设置为all时,则一直显示 “draw_white_space”: “selection”, // 制表位的对齐白线是否显示,颜色可在主题文件里设置(guide,activeGuide,stackGuide) “draw_indent_guides”: true, // 制表位的对齐白线,draw_normal为一直显示,draw_active为只显示当前光标所在的代码控制域 “indent_guide_options”: ["draw_normal"], // 为true时,保存文件时会删除每行结束后多余的空格 “trim_trailing_white_space_on_save”: false, // 为true时,保存文件时光标会在文件的最后向下换一行 “ensure_newline_at_eof_on_save”: false, // 切换到其它文件标签或点击其它非本软件区域,文件自动保存 “save_on_focus_lost”: false, // 编码时不能自动检测编码时,将自动检测ASCII, UTF-8 和 UTF-16 “fallback_encoding”: “Western (Windows 1252)”, // 默认编码格式 “default_encoding”: “UTF-8〃, // 包含空字节的文件被打开默认为十六进制 “enable_hexadecimal_encoding”: true, // 每一行结束的时候用什么字符做终止符 “default_line_ending”: “system”, // 设置为enabled时,在一个字符串间按Tab将插入一个制表符 // 设置为true时,按Tab会根据前后环境进行代码自动匹配填补 “tab_completion”: true, // 代码提示 “auto_complete”: true, // 代码提示的大小限制 “auto_complete_size_limit”: 4194304, // 代码提示延迟显示 “auto_complete_delay”: 50, // 代码提示的控制范围 “auto_complete_selector”: “source – comment”, // 触发代码提示的其他情况 “auto_complete_triggers”: [ {"selector": "text.html", "characters": "<"} ], // 设为false时,选择提示的代码按回车或点击可以输出出来,但选择true时不会输出而是直接换行 “auto_complete_commit_on_tab”: false, “auto_complete_with_fields”: false, // 设置为false,使用Shift + tab总是插入制表符 “shift_tab_unindent”: true, // 选中的文本按Ctrl + f时,自动复制到查找面板的文本框里 “find_selected_text”: true, // Data\Packages\Theme – Default\Default.sublime-theme控制软件的主题 “theme”: “Default.sublime-theme”, // 滚动的速度 “scroll_speed”: 1.0, // 左边边栏文件夹动画 “tree_animation_enabled”: true, // 标签页的关闭按钮 “show_tab_close_buttons”: true, // Valid values are “system”, “enabled” and “disabled” // 水平垂直滚动条:system和disabled为默认显示方式,enabled为自动隐藏显示 “overlay_scroll_bars”: “system”, }
现在我用的user配置:
ubuntu 2018-02-15 21:34:32
{ //在default那里的,如果你不重写,就默认是用default //这个是设置主题路径 "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", //设置字体样式,需要显示的字体名字(请参照自己电脑存在的字体或下载安装需要的字体) "font_face": "YaHei Consolas Hybrid", //设置字体大小 "font_size": 14, //是否打开拼写检查 "spell_check": false, //tab键大小 "tab_size": 4, //设置是否自动匹配括号,引号之类的。 "auto_match_enabled": false, //突出当前光标所在的行,待用 "highlight_line": false, // Valid values are “smooth”, “phase”, “blink”, “wide” and “solid”. // 设置光标闪动方式 "caret_style": "smooth", //还没测试出效果 // 设置为enabled时,在一个字符串间按Tab将插入一个制表符 //设置为true时,按Tab会根据前后环境进行代码自动匹配填补 "tab_completion": "enabled", // 这个弄不了的???,这样的话,tab键编程了写html的 //设置自动换行为false,自动换行就是那个,一行显示不完全,就自动跳去下一行。 "word_wrap": false, // Display file encoding in the status bar "show_encoding":true, // Display line endings in the status bar "show_line_endings": true, //取消检查更新 "update_check": false, //忽略掉的包,我不用vim这个包 "ignored_packages": ["Vintage"] }
"font_options": ["no_bold", "no_italic", "no_antialias", "gray_antialias",],
"font_size": 12,
"font_face": "YaHei Consolas Hybrid",
no_italic:不是斜体显示(也叫意大利字体样式显示);
no_antialias:无反图像失真或反锯齿显示;
gray_antialias";反图像灰度值失真显示;
以上参数去掉no_或不写入得相反效果;
font_size:字体的大小;
font_face;需要显示的字体名字(请参照自己电脑存在的字体或下载安装需要的字体)
快捷键配置
2018-05-29 22:54:36
[ //注释快捷键 { "keys": ["ctrl+shift+c"], "command": "toggle_comment", "args": { "block": false } }, //代码提示功能 { "keys": ["ctrl+space"], "command": "auto_complete" }, { "keys": ["ctrl+space"], "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": ["f9"], "command": "build" }, //代码格式化 { "keys": ["alt+f8"], "command": "reindent" }, //打开跳去指定行的操作 { "keys": ["ctrl+escape"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }, // { "keys": ["ctrl+shift+t"], "command": "reopen_last_file" }, { "keys": ["ctrl+w"], "command": "close" }, /*Terminal plug*/ { "keys": ["ctrl+shift+o"], "command": "open_terminal_project_folder" }, { "command": "add_info", "keys": ["ctrl+shift+."] }, { "keys": ["ctrl+j"], "command": "jump_forward"}, { "keys": ["ctrl+k"], "command": "jump_back"}, { "keys": ["ctrl+d"], "command": "godef" }, { "keys": ["ctrl+alt+i"], "command": "java_import_path" }, { "keys": ["ctrl+shift+r"], "command": "reveal_in_side_bar"}, { "keys": "tab", "command": "insert", "args": {"characters": "\t"} }, { "keys": ["f2"], "command": "rename_file", "args": { "paths": ["$file"] } } ]
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
[ //注释快捷键 { "keys": ["ctrl+shift+c"], "command": "toggle_comment", "args": { "block": false } }, //代码提示功能 { "keys": ["ctrl+space"], "command": "auto_complete" }, { "keys": ["ctrl+space"], "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": ["f9"], "command": "build" }, //代码格式化 { "keys": ["alt+f8"], "command": "reindent" }, //打开跳去指定行的操作 { "keys": ["alt+`"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }, //这个是为了适合chrome,要明确写出来,不然被其他插件的defalut代替了。然后搜索的时候,按一个键就匹配去下一个的话,上面就搜索不了了 //也就是说不一定不存在这个命令,需要你一次性整一个复制进去搜索 { "keys": ["ctrl+shift+t"], "command": "reopen_last_file" }, { "keys": ["ctrl+w"], "command": "close" }, /*Terminal plug*/ { "keys": ["ctrl+shift+o"], "command": "open_terminal_project_folder" }, //按下整个就生成注释,需要自己写一个插件的 { "command": "add_info", "keys": ["ctrl+shift+."]}, { "keys": ["ctrl+j"], "command": "jump_forward"}, { "keys": ["ctrl+k"], "command": "jump_back"}, { "keys": ["ctrl+d"], "command": "godef" }, /* On OS X, basic text manipulations (left, right, command+left, etc) make use of the system key bindings, and don't need to be repeated here. Anything listed here will take precedence, however. */ { "keys": ["ctrl+shift+n"], "command": "new_window" }, { "keys": ["ctrl+shift+w"], "command": "close_window" }, { "keys": ["ctrl+o"], "command": "prompt_open" }, { "keys": ["ctrl+shift+t"], "command": "reopen_last_file" }, { "keys": ["ctrl+alt+up"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "hh", "h", "ipp", "inl", "m", "mm"]} }, { "keys": ["ctrl+n"], "command": "new_file" }, { "keys": ["ctrl+s"], "command": "save" }, { "keys": ["ctrl+shift+s"], "command": "prompt_save_as" }, { "keys": ["ctrl+alt+s"], "command": "save_all" }, { "keys": ["ctrl+w"], "command": "close" }, { "keys": ["ctrl+ctrl+f"], "command": "toggle_full_screen" }, { "keys": ["ctrl+ctrl+shift+f"], "command": "toggle_distraction_free" }, { "keys": ["ctrl+z"], "command": "undo" }, { "keys": ["ctrl+shift+z"], "command": "redo" }, { "keys": ["ctrl+y"], "command": "redo_or_repeat" }, { "keys": ["ctrl+u"], "command": "soft_undo" }, { "keys": ["ctrl+shift+u"], "command": "soft_redo" }, { "keys": ["ctrl+x"], "command": "cut" }, { "keys": ["ctrl+c"], "command": "copy" }, { "keys": ["ctrl+v"], "command": "paste" }, { "keys": ["ctrl+shift+v"], "command": "paste_and_indent" }, { "keys": ["ctrl+option+v"], "command": "paste_from_history" }, { "keys": ["ctrl+alt+left"], "command": "move", "args": {"by": "subwords", "forward": false} }, { "keys": ["ctrl+alt+right"], "command": "move", "args": {"by": "subword_ends", "forward": true} }, { "keys": ["ctrl+alt+shift+left"], "command": "move", "args": {"by": "subwords", "forward": false, "extend": true} }, { "keys": ["ctrl+alt+shift+right"], "command": "move", "args": {"by": "subword_ends", "forward": true, "extend": true} }, { "keys": ["ctrl+left"], "command": "move", "args": {"by": "subwords", "forward": false} }, { "keys": ["ctrl+right"], "command": "move", "args": {"by": "subword_ends", "forward": true} }, { "keys": ["ctrl+shift+left"], "command": "move", "args": {"by": "subwords", "forward": false, "extend": true} }, { "keys": ["ctrl+shift+right"], "command": "move", "args": {"by": "subword_ends", "forward": true, "extend": true} }, { "keys": ["ctrl+alt+up"], "command": "scroll_lines", "args": {"amount": 1.0} }, { "keys": ["ctrl+alt+down"], "command": "scroll_lines", "args": {"amount": -1.0} }, { "keys": ["ctrl+shift+up"], "command": "select_lines", "args": {"forward": false} }, { "keys": ["ctrl+shift+down"], "command": "select_lines", "args": {"forward": true} }, { "keys": ["ctrl+shift+["], "command": "prev_view" }, { "keys": ["ctrl+shift+]"], "command": "next_view" }, { "keys": ["ctrl+alt+left"], "command": "prev_view" }, { "keys": ["ctrl+alt+right"], "command": "next_view" }, { "keys": ["ctrl+tab"], "command": "next_view_in_stack" }, { "keys": ["ctrl+shift+tab"], "command": "prev_view_in_stack" }, { "keys": ["ctrl+a"], "command": "select_all" }, { "keys": ["ctrl+shift+l"], "command": "split_selection_into_lines" }, { "keys": ["escape"], "command": "single_selection", "context": [ { "key": "num_selections", "operator": "not_equal", "operand": 1 } ] }, { "keys": ["escape"], "command": "clear_fields", "context": [ { "key": "has_next_field", "operator": "equal", "operand": true } ] }, { "keys": ["escape"], "command": "clear_fields", "context": [ { "key": "has_prev_field", "operator": "equal", "operand": true } ] }, { "keys": ["escape"], "command": "hide_panel", "args": {"cancel": true}, "context": [ { "key": "panel_visible", "operator": "equal", "operand": true } ] }, { "keys": ["escape"], "command": "hide_overlay", "context": [ { "key": "overlay_visible", "operator": "equal", "operand": true } ] }, { "keys": ["escape"], "command": "hide_popup", "context": [ { "key": "popup_visible", "operator": "equal", "operand": true } ] }, { "keys": ["escape"], "command": "hide_auto_complete", "context": [ { "key": "auto_complete_visible", "operator": "equal", "operand": true } ] }, { "keys": ["ctrl+]"], "command": "indent" }, { "keys": ["ctrl+["], "command": "unindent" }, { "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": true} }, { "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false}, "context": [ { "key": "setting.tab_completion", "operator": "equal", "operand": true }, { "key": "preceding_text", "operator": "not_regex_match", "operand": ".*\\b[0-9]+$", "match_all": true }, ] }, { "keys": ["tab"], "command": "replace_completion_with_next_completion", "context": [ { "key": "last_command", "operator": "equal", "operand": "insert_best_completion" }, { "key": "setting.tab_completion", "operator": "equal", "operand": true } ] }, { "keys": ["tab"], "command": "reindent", "context": [ { "key": "setting.auto_indent", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_match", "operand": "^$", "match_all": true }, { "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true } ] }, { "keys": ["tab"], "command": "indent", "context": [ { "key": "text", "operator": "regex_contains", "operand": "\n" } ] }, { "keys": ["tab"], "command": "next_field", "context": [ { "key": "has_next_field", "operator": "equal", "operand": true } ] }, { "keys": ["tab"], "command": "commit_completion", "context": [ { "key": "auto_complete_visible" }, { "key": "setting.auto_complete_commit_on_tab" } ] }, { "keys": ["shift+tab"], "command": "insert", "args": {"characters": "\t"} }, { "keys": ["shift+tab"], "command": "unindent", "context": [ { "key": "setting.shift_tab_unindent", "operator": "equal", "operand": true } ] }, { "keys": ["shift+tab"], "command": "unindent", "context": [ { "key": "preceding_text", "operator": "regex_match", "operand": "^[\t ]*" } ] }, { "keys": ["shift+tab"], "command": "unindent", "context": [ { "key": "text", "operator": "regex_contains", "operand": "\n" } ] }, { "keys": ["shift+tab"], "command": "prev_field", "context": [ { "key": "has_prev_field", "operator": "equal", "operand": true } ] }, { "keys": ["ctrl+l"], "command": "expand_selection", "args": {"to": "line"} }, { "keys": ["ctrl+shift+space"], "command": "expand_selection", "args": {"to": "scope"} }, { "keys": ["ctrl+shift+m"], "command": "expand_selection", "args": {"to": "brackets"} }, { "keys": ["ctrl+m"], "command": "move_to", "args": {"to": "brackets"} }, { "keys": ["ctrl+shift+j"], "command": "expand_selection", "args": {"to": "indentation"} }, { "keys": ["ctrl+shift+a"], "command": "expand_selection", "args": {"to": "tag"} }, { "keys": ["ctrl+alt+."], "command": "close_tag" }, { "keys": ["ctrl+q"], "command": "toggle_record_macro" }, { "keys": ["ctrl+shift+q"], "command": "run_macro" }, { "keys": ["ctrl+enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line.sublime-macro"} }, { "keys": ["ctrl+shift+enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line Before.sublime-macro"} }, { "keys": ["enter"], "command": "commit_completion", "context": [ { "key": "auto_complete_visible" }, { "key": "setting.auto_complete_commit_on_tab", "operand": false } ] }, { "keys": ["ctrl+t"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }, { "keys": ["ctrl+shift+p"], "command": "show_overlay", "args": {"overlay": "command_palette"} }, { "keys": ["ctrl+r"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} }, { "keys": ["ctrl+g"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }, { "keys": ["f12"], "command": "goto_definition" }, { "keys": ["ctrl+alt+down"], "command": "goto_definition" }, { "keys": ["ctrl+shift+r"], "command": "goto_symbol_in_project" }, { "keys": ["ctrl+minus"], "command": "jump_back" }, { "keys": ["ctrl+shift+minus"], "command": "jump_forward" }, { "keys": ["ctrl+i"], "command": "show_panel", "args": {"panel": "incremental_find", "reverse": false} }, { "keys": ["ctrl+shift+i"], "command": "show_panel", "args": {"panel": "incremental_find", "reverse": true} }, { "keys": ["ctrl+f"], "command": "show_panel", "args": {"panel": "find", "reverse": false} }, { "keys": ["ctrl+alt+f"], "command": "show_panel", "args": {"panel": "replace", "reverse": false} }, { "keys": ["ctrl+alt+e"], "command": "replace_next" }, { "keys": ["ctrl+g"], "command": "find_next" }, { "keys": ["ctrl+shift+g"], "command": "find_prev" }, { "keys": ["ctrl+e"], "command": "slurp_find_string" }, { "keys": ["ctrl+shift+e"], "command": "slurp_replace_string" }, { "keys": ["alt+ctrl+g"], "command": "find_under" }, { "keys": ["shift+alt+ctrl+g"], "command": "find_under_prev" }, { "keys": ["ctrl+ctrl+g"], "command": "find_all_under" }, { "keys": ["ctrl+shift+f"], "command": "show_panel", "args": {"panel": "find_in_files"} }, { "keys": ["f4"], "command": "next_result" }, { "keys": ["shift+f4"], "command": "prev_result" }, { "keys": ["f6"], "command": "toggle_setting", "args": {"setting": "spell_check"} }, { "keys": ["ctrl+f6"], "command": "next_misspelling" }, { "keys": ["ctrl+shift+f6"], "command": "prev_misspelling" }, { "keys": ["ctrl+ctrl+up"], "command": "swap_line_up" }, { "keys": ["ctrl+ctrl+down"], "command": "swap_line_down" }, { "keys": ["ctrl+backspace"], "command": "delete_word", "args": { "forward": false, "sub_words": true } }, { "keys": ["ctrl+delete"], "command": "delete_word", "args": { "forward": true, "sub_words": true } }, { "keys": ["ctrl+forward_slash"], "command": "toggle_comment", "args": { "block": false } }, { "keys": ["ctrl+alt+forward_slash"], "command": "toggle_comment", "args": { "block": true } }, { "keys": ["ctrl+shift+d"], "command": "duplicate_line" }, { "keys": ["ctrl+backquote"], "command": "show_panel", "args": {"panel": "console", "toggle": true} }, { "keys": ["ctrl+space"], "command": "auto_complete" }, { "keys": ["ctrl+space"], "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+alt+p"], "command": "show_scope_name" }, { "keys": ["ctrl+shift+p"], "command": "show_scope_name" }, { "keys": ["f7"], "command": "build" }, { "keys": ["ctrl+b"], "command": "build" }, { "keys": ["ctrl+shift+b"], "command": "build", "args": {"select": true} }, { "keys": ["ctrl+t"], "command": "transpose" }, { "keys": ["f5"], "command": "sort_lines", "args": {"case_sensitive": false} }, { "keys": ["ctrl+f5"], "command": "sort_lines", "args": {"case_sensitive": true} }, // Auto-pair quotes { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"$0\""}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true }, { "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true }, { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double - punctuation.definition.string.end", "match_all": true } ] }, { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"${0:$SELECTION}\""}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } ] }, { "keys": ["\""], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\"", "match_all": true }, { "key": "selector", "operator": "not_equal", "operand": "punctuation.definition.string.begin", "match_all": true }, { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double - punctuation.definition.string.end", "match_all": true }, ] }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\"$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\"", "match_all": true }, { "key": "selector", "operator": "not_equal", "operand": "punctuation.definition.string.begin", "match_all": true }, { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double - punctuation.definition.string.end", "match_all": true }, ] }, // Auto-pair single quotes { "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'$0'"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true }, { "key": "preceding_text", "operator": "not_regex_contains", "operand": "['a-zA-Z0-9_]$", "match_all": true }, { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single - punctuation.definition.string.end", "match_all": true } ] }, { "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'${0:$SELECTION}'"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } ] }, { "keys": ["'"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true }, { "key": "selector", "operator": "not_equal", "operand": "punctuation.definition.string.begin", "match_all": true }, { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single - punctuation.definition.string.end", "match_all": true }, ] }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "'$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true }, { "key": "selector", "operator": "not_equal", "operand": "punctuation.definition.string.begin", "match_all": true }, { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single - punctuation.definition.string.end", "match_all": true }, ] }, // Auto-pair brackets { "keys": ["("], "command": "insert_snippet", "args": {"contents": "($0)"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|;|\\}|$)", "match_all": true } ] }, { "keys": ["("], "command": "insert_snippet", "args": {"contents": "(${0:$SELECTION})"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } ] }, { "keys": [")"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true } ] }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\($", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true } ] }, // Auto-pair square brackets { "keys": ["["], "command": "insert_snippet", "args": {"contents": "[$0]"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|;|\\}|$)", "match_all": true } ] }, { "keys": ["["], "command": "insert_snippet", "args": {"contents": "[${0:$SELECTION}]"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } ] }, { "keys": ["]"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\]", "match_all": true } ] }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\[$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\]", "match_all": true } ] }, // Auto-pair curly brackets { "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{$0}"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|$)", "match_all": true } ] }, { "keys": ["{"], "command": "wrap_block", "args": {"begin": "{", "end": "}"}, "context": [ { "key": "indented_block", "match_all": true }, { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true }, ] }, { "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{${0:$SELECTION}}"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } ] }, { "keys": ["}"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true } ] }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Left Right.sublime-macro"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true } ] }, { "keys": ["enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line in Braces.sublime-macro"}, "context": [ { "key": "setting.auto_indent", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true } ] }, { "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line in Braces.sublime-macro"}, "context": [ { "key": "setting.auto_indent", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true } ] }, { "keys": ["enter"], "command": "auto_indent_tag", "context": [ { "key": "setting.auto_indent", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "selector", "operator": "equal", "operand": "punctuation.definition.tag.begin", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": ">$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^</", "match_all": true }, ] }, { "keys": ["shift+enter"], "command": "auto_indent_tag", "context": [ { "key": "setting.auto_indent", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "selector", "operator": "equal", "operand": "punctuation.definition.tag.begin", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": ">$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^</", "match_all": true }, ] }, { "keys": ["ctrl+alt+1"], "command": "set_layout", "args": { "cols": [0.0, 1.0], "rows": [0.0, 1.0], "cells": [[0, 0, 1, 1]] } }, { "keys": ["ctrl+alt+2"], "command": "set_layout", "args": { "cols": [0.0, 0.5, 1.0], "rows": [0.0, 1.0], "cells": [[0, 0, 1, 1], [1, 0, 2, 1]] } }, { "keys": ["ctrl+alt+3"], "command": "set_layout", "args": { "cols": [0.0, 0.33, 0.66, 1.0], "rows": [0.0, 1.0], "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1]] } }, { "keys": ["ctrl+alt+4"], "command": "set_layout", "args": { "cols": [0.0, 0.25, 0.5, 0.75, 1.0], "rows": [0.0, 1.0], "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1], [3, 0, 4, 1]] } }, { "keys": ["ctrl+alt+shift+2"], "command": "set_layout", "args": { "cols": [0.0, 1.0], "rows": [0.0, 0.5, 1.0], "cells": [[0, 0, 1, 1], [0, 1, 1, 2]] } }, { "keys": ["ctrl+alt+shift+3"], "command": "set_layout", "args": { "cols": [0.0, 1.0], "rows": [0.0, 0.33, 0.66, 1.0], "cells": [[0, 0, 1, 1], [0, 1, 1, 2], [0, 2, 1, 3]] } }, { "keys": ["ctrl+alt+5"], "command": "set_layout", "args": { "cols": [0.0, 0.5, 1.0], "rows": [0.0, 0.5, 1.0], "cells": [ [0, 0, 1, 1], [1, 0, 2, 1], [0, 1, 1, 2], [1, 1, 2, 2] ] } }, { "keys": ["ctrl+1"], "command": "focus_group", "args": { "group": 0 } }, { "keys": ["ctrl+2"], "command": "focus_group", "args": { "group": 1 } }, { "keys": ["ctrl+3"], "command": "focus_group", "args": { "group": 2 } }, { "keys": ["ctrl+4"], "command": "focus_group", "args": { "group": 3 } }, { "keys": ["ctrl+5"], "command": "focus_group", "args": { "group": 4 } }, { "keys": ["ctrl+6"], "command": "focus_group", "args": { "group": 5 } }, { "keys": ["ctrl+7"], "command": "focus_group", "args": { "group": 6 } }, { "keys": ["ctrl+8"], "command": "focus_group", "args": { "group": 7 } }, { "keys": ["ctrl+9"], "command": "focus_group", "args": { "group": 8 } }, { "keys": ["ctrl+shift+1"], "command": "move_to_group", "args": { "group": 0 } }, { "keys": ["ctrl+shift+2"], "command": "move_to_group", "args": { "group": 1 } }, { "keys": ["ctrl+shift+3"], "command": "move_to_group", "args": { "group": 2 } }, { "keys": ["ctrl+shift+4"], "command": "move_to_group", "args": { "group": 3 } }, { "keys": ["ctrl+shift+5"], "command": "move_to_group", "args": { "group": 4 } }, { "keys": ["ctrl+shift+6"], "command": "move_to_group", "args": { "group": 5 } }, { "keys": ["ctrl+shift+7"], "command": "move_to_group", "args": { "group": 6 } }, { "keys": ["ctrl+shift+8"], "command": "move_to_group", "args": { "group": 7 } }, { "keys": ["ctrl+shift+9"], "command": "move_to_group", "args": { "group": 8 } }, { "keys": ["ctrl+0"], "command": "focus_side_bar" }, { "keys": ["ctrl+1"], "command": "select_by_index", "args": { "index": 0 } }, { "keys": ["ctrl+2"], "command": "select_by_index", "args": { "index": 1 } }, { "keys": ["ctrl+3"], "command": "select_by_index", "args": { "index": 2 } }, { "keys": ["ctrl+4"], "command": "select_by_index", "args": { "index": 3 } }, { "keys": ["ctrl+5"], "command": "select_by_index", "args": { "index": 4 } }, { "keys": ["ctrl+6"], "command": "select_by_index", "args": { "index": 5 } }, { "keys": ["ctrl+7"], "command": "select_by_index", "args": { "index": 6 } }, { "keys": ["ctrl+8"], "command": "select_by_index", "args": { "index": 7 } }, { "keys": ["ctrl+9"], "command": "select_by_index", "args": { "index": 8 } }, { "keys": ["ctrl+0"], "command": "select_by_index", "args": { "index": 9 } }, { "keys": ["f2"], "command": "next_bookmark" }, { "keys": ["shift+f2"], "command": "prev_bookmark" }, { "keys": ["ctrl+f2"], "command": "toggle_bookmark" }, { "keys": ["ctrl+shift+f2"], "command": "clear_bookmarks" }, { "keys": ["alt+f2"], "command": "select_all_bookmarks" }, { "keys": ["ctrl+r"], "command": "next_bookmark" }, { "keys": ["ctrl+shift+r"], "command": "toggle_bookmark" }, { "keys": ["ctrl+equals"], "command": "increase_font_size" }, { "keys": ["ctrl+plus"], "command": "increase_font_size" }, { "keys": ["ctrl+minus"], "command": "decrease_font_size" }, { "keys": ["ctrl+shift+w"], "command": "insert_snippet", "args": { "name": "Packages/XML/Snippets/long-tag.sublime-snippet" } }, { "keys": ["ctrl+shift+k"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} }, { "keys": ["ctrl+alt+q"], "command": "wrap_lines" }, { "keys": ["ctrl+alt+["], "command": "fold" }, { "keys": ["ctrl+alt+]"], "command": "unfold" }, { "keys": ["ctrl+alt+o"], "command": "toggle_overwrite" }, { "keys": ["alt+f2"], "command": "context_menu" }, { "keys": ["ctrl+alt+c"], "command": "toggle_case_sensitive", "context": [ { "key": "setting.is_widget", "operator": "equal", "operand": true } ] }, { "keys": ["ctrl+alt+r"], "command": "toggle_regex", "context": [ { "key": "setting.is_widget", "operator": "equal", "operand": true } ] }, { "keys": ["ctrl+alt+w"], "command": "toggle_whole_word", "context": [ { "key": "setting.is_widget", "operator": "equal", "operand": true } ] }, { "keys": ["ctrl+alt+a"], "command": "toggle_preserve_case", "context": [ { "key": "setting.is_widget", "operator": "equal", "operand": true } ] }, // Find panel key bindings { "keys": ["enter"], "command": "find_next", "context": [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] }, { "keys": ["shift+enter"], "command": "find_prev", "context": [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] }, { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, "context": [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] }, // Replace panel key bindings { "keys": ["enter"], "command": "find_next", "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] }, { "keys": ["shift+enter"], "command": "find_prev", "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] }, { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] }, { "keys": ["ctrl+alt+enter"], "command": "replace_all", "args": {"close_panel": true}, "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] }, // Incremental find panel key bindings { "keys": ["enter"], "command": "hide_panel", "context": [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] }, { "keys": ["shift+enter"], "command": "find_prev", "context": [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] }, { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, "context": [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] }, // Find in Files panel key bindings { "keys": ["alt+enter"], "command": "find_all", "context": [{"key": "panel", "operand": "find_in_files"}, {"key": "panel_has_focus"}] }, { "keys": ["ctrl+alt+enter"], "command": "replace_all", "context": [{"key": "panel", "operand": "find_in_files"}, {"key": "panel_has_focus"}] }, { "keys": ["ctrl+,"], "command": "edit_settings", "args": { "base_file": "${packages}/Default/Preferences.sublime-settings", "default": "// Settings in here override those in \"Default/Preferences.sublime-settings\",\n// and are overridden in turn by syntax-specific settings.\n{\n\t$0\n}\n" } }, // These are OS X built in commands, and don't need to be listed here, but // doing so lets them show up in the menu { "keys": ["ctrl+backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete to Hard BOL.sublime-macro"} }, // ctrl+delete isn't a built in command, but makes sense anyway { "keys": ["ctrl+delete"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete to Hard EOL.sublime-macro"} }, { "keys": ["ctrl+l"], "command": "show_at_center" }, { "keys": ["ctrl+o"], "command": "insert_snippet", "args": { "contents": "$0\n" } }, // { "keys": ["ctrl+ctrl+d"], "command": "noop" }, { "keys": ["ctrl+ctrl+shift+d"], "command": "noop" }, // HTML, XML close tag { "keys": ["/"], "command": "close_tag", "args": { "insert_slash": true }, "context": [ { "key": "selector", "operator": "equal", "operand": "(text.html, text.xml) - string - comment", "match_all": true }, { "key": "preceding_text", "operator": "regex_match", "operand": ".*<$", "match_all": true }, { "key": "setting.auto_close_tags" } ] } ]
-------------------------------------------------------------------------------------------------------------------------------------------------------
常用快捷键
1、把窗口变成两个:按alt+shift+2即可,或者利用菜单,view->layout->,选一个即可。
2、输入文件名,然后打开指定文件,ctrl + p
3、替换变量,ctrl + h,然后全部 替换就是ctrl + alt + p
4、跳转到某一行,ctrl + g
5、输入变量,跳转到哪里,ctrl + ;,就是冒号哪里
6、编辑多行, 选中多行,然后ctrl+shift+L
GCC中在cmd中打开,输入数据:https://zhidao.baidu.com/question/1047649305255045859.html
附录:sublime text中配置golang开发环境。
1、安装完golang后,如果不手动配GOPATH, GOBIN,GOROOT之类的东西,可以考虑插件goSublime
gosublime是一个插件
安装好GoSublime之后,如果你的环境变量GOPATH、GOPATH等没有设置好,或者要使用一个不一样的配置,可以打开Preferences -> Package Settings -> GoSublime -> Settings - user,按照下面的格式,填写你的配置内容:
首先,你的项目应该是这样的(建立在你的GOPATH/src),项目名:(src,pkg,bin),代码放在src上。
然后要在GOPATH中设置好路径,改成:
{ "env": { "GOROOT" : "/usr/lib/go-1.9", "GOBIN" : "/usr/lib/go-1.9/GOPATH/bin", "GOPATH" : "/usr/lib/go-1.9/GOPATH", }, "fmt_cmd": ["/usr/lib/go-1.9/GOPATH/bin/goimports"], //这个是go的包自动删除 or 添加的
// go get golang.org/x/tools/cmd/goimports }
中间用冒号【:】分割,这样才能识别你的项目。路径直到项目名就好,系统会帮我们找到src的
注意,mac用冒号分割,windows用分号分割(这个和windows自己设置path的时候是一致的)
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
{ "env": { "GOROOT":"H:\\Golang", //go的安装路径 "GOBIN":"H:\\Golang\\bin;H:/Golang/project/liuweiming/bin", "GOPATH": "H:\\Golang:\\project\\pro;H:/Golang/project/liuweiming", //您go的工作路径 "GOARCH":"amd64", //系统变量里面的 GOHOSTARCH ,386为32位平台,amd64为 64位平台 "GOOS":"windows", //系统里面的GOOS "PATH":"%GOBIN%;%PATH%" }, "comp_lint_enabled": true, //打开这个才有下面的 comp_lint_commands标签里面的内容 "comp_lint_commands": [ {"cmd": ["go", "install"]} ], "on_save": [ {"cmd":"gs_comp_lint"} //当按保存时以cmd自动执行的命令 ] }
文件夹就是方法包,主项目的方法包名字就是main,然后其他的包随便命名,引用的第一句是package 文件夹 名称