sublime 原生快捷鍵 —— 不常用但很有用的那些快捷鍵
sublime 原生快捷鍵
注意:如果是 mac 中ctrl換為?
-
alt+F3
選中所有相同的詞匯 - 按下鼠標中鍵來進行垂直方向的縱列選擇馏艾,也可以進入多重編輯狀態(tài)饿敲。
-
Ctrl+L
選中整行 -
Ctrl+Shift+L
在每行行尾插入光標。經(jīng)常和Ctrl+L塞颁、home鍵配合使用洋丐,可同時編輯這些行。 -
ctrl+F2
用于標記一個書簽爱榕,和F2配合使用臊诊。當修改代碼行數(shù)跨度很大的時候方便通過F2來快速跳躍到另一個修改地點。
ctrl+shift+F2
取消全部書簽
ctrl+alt+F2
取消置頂書簽 -
Ctrl + M
在起始括號和結尾括號間切換 -
Ctrl + Shift + M
快速選擇括號間的內容 -
alt+shift+w
使用標簽包裹內容 -
ctrl+shift+;
這會移除與你的光標相關的父標簽状原。對清除標記很有幫助聋呢。 -
alt+shift+↑ 或 ↓
和ctrl+ ↑ 或 ↓
,可微調css中的數(shù)值比如12px改為11px颠区。 -
ctrl+j
縮成一行坝冕。行當前選中行和下一行縮成一行。 -
ctrl+k,ctrl+d
之后可以跳轉到下一個相同單詞瓦呼。 - 代碼折疊功能〔獍担可參考看菜單 edit - code folding【注意mac下面必須選中要折疊的部分】
按ctrl + k
央串,然后按ctrl + 1
,可收起所有函數(shù)
按ctrl + k
碗啄, 再按ctrl + j
顯示所有函數(shù)
你也可以ctrl + k
质和,ctrl + 2
(這個數(shù)字可以變的,表示收起的函數(shù)的級數(shù))
emmet中不常用的標識
-
$
表示從1開始的計數(shù)
li.item$*4>a{Item $}
有時間可以繼續(xù)看看別人是怎么使用sublime的工具用好了提高編碼效率稚字,當然這些都是小成饲宿。
-
ctrl+shift+'
快速選中光標所在元素的標簽名之后,可以快速修改標簽名胆描。(注意光標必須在標簽名中L毕搿)
參考文獻
-
一個前端程序猿的Sublime Text3的自我修養(yǎng)
2016.6月內容轉載自某博客鏈接地址已失效。至今由自己不斷完善昌讲,打造自己個性化的快捷鍵国夜。
sublime 自定義快捷鍵整理(個人使用習慣)
插件的某些快捷鍵會和系統(tǒng)默認或其他插件之間產生沖突,可以根據(jù)context來做適配短绸,設定快捷鍵的使用范圍车吹。可見:
Sublime Key Bindings
windows環(huán)境
[
// 刪除當前行
{
"keys": ["ctrl+d"],
"command": "run_macro_file",
"args": {
"file": "Packages/Default/Delete Line.sublime-macro"
}
},
//plainTask插件中用于標記任務完成
{
"keys": ["alt+d"],
"command": "plain_tasks_complete",
"context": [{
"key": "selector",
"operator": "equal",
"operand": "text.todo"
}]
},
// 復制選中行到行后
{
"keys": ["ctrl+alt+down"],
"command": "duplicate_line"
},
// 選詞(按住-繼續(xù)選擇下個相同的字符串)
{
"keys": ["ctrl+g"],
"command": "find_under_expand"
},
// 自動提示醋闭、補全
{
"keys": ["alt+/"],
"command": "auto_complete"
}, {
"keys": ["alt+/"],
"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": ["alt+up"],
"command": "swap_line_up"
},
// 與下行互換
{
"keys": ["alt+down"],
"command": "swap_line_down"
}, {
"keys": ["alt+/", "alt+/"],
"command": "insert_best_completion"
},
//與tab鍵沖突窄驹,秒之
{
"keys": ["shift+tab"],
"command": "insert_best_completion",
"args": {
"default": "\t",
"exact": true
}
}, {
"keys": ["shift+tab"],
"command": "insert_best_completion",
"args": {
"default": "\t",
"exact": false
},
"context": [{
"key": "setting.tab_completion",
"operator": "equal",
"operand": true
}]
}, {
"keys": ["shift+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": ["shift+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": ["shift+tab"],
"command": "indent",
"context": [{
"key": "text",
"operator": "regex_contains",
"operand": "\n"
}]
}, {
"keys": ["shift+tab"],
"command": "next_field",
"context": [{
"key": "has_next_field",
"operator": "equal",
"operand": true
}]
}, {
"keys": ["shift+tab"],
"command": "commit_completion",
"context": [{
"key": "auto_complete_visible"
}, {
"key": "setting.auto_complete_commit_on_tab"
}]
},
//移動光標
{
"keys": ["alt+l"],
"command": "move",
"args": {
"by": "characters",
"forward": false
}
}, {
"keys": ["alt+r"],
"command": "move",
"args": {
"by": "characters",
"forward": true
}
}, {
"keys": ["alt+u"],
"command": "move",
"args": {
"by": "lines",
"forward": false
}
}, {
"keys": ["shift+alt+l"],
"command": "move",
"args": {
"by": "characters",
"forward": false,
"extend": true
}
}, {
"keys": ["shift+alt+r"],
"command": "move",
"args": {
"by": "characters",
"forward": true,
"extend": true
}
}, {
"keys": ["shift+alt+u"],
"command": "move",
"args": {
"by": "lines",
"forward": false,
"extend": true
}
}, {
"keys": ["shift+alt+d"],
"command": "move",
"args": {
"by": "lines",
"forward": true,
"extend": true
}
},
//移動光標到行首或行末
{
"keys": ["alt+b"],
"command": "move_to",
"args": {
"to": "bol",
"extend": false
}
}, {
"keys": ["alt+e"],
"command": "move_to",
"args": {
"to": "eol",
"extend": false
}
}, {
"keys": ["shift+alt+b"],
"command": "move_to",
"args": {
"to": "bol",
"extend": true
}
}, {
"keys": ["shift+alt+e"],
"command": "move_to",
"args": {
"to": "eol",
"extend": true
}
},
//滾屏
{
"keys": ["alt+g"],
"command": "scroll_lines",
"args": {
"amount": 1.0
}
}, {
"keys": ["alt+h"],
"command": "scroll_lines",
"args": {
"amount": -1.0
}
},
//縮進
{
"keys": ["shift+tab"],
"command": "unindent"
}, {
"keys": ["shift+enter"],
"command": "run_macro_file",
"args": {
"file": "res://Packages/Default/Add Line.sublime-macro"
}
},
//切換Side Bar
{
"keys": ["ctrl+]"],
"command": "toggle_side_bar"
},
//切換注釋
{
"keys": ["ctrl+/"],
"command": "toggle_comment",
"args": {
"block": false
}
},
//轉到第幾行
// { "keys": ["ctrl+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} },
{
"keys": ["ctrl+p"],
"command": "show_overlay",
"args": {
"overlay": "goto",
"text": ":"
}
},
//選中整行(系統(tǒng)默認)(轉到第幾行請用ctrl+p)
{
"keys": ["ctrl+l"],
"command": "expand_selection",
"args": {
"to": "line"
}
},
//override termial插件默認配置
{
"keys": ["ctrl+shift+t"],
"command": "reopen_last_file"
},
//override termial插件默認配置
{
"keys": ["ctrl+shift+t"],
"command": "reopen_last_file"
},
//Emmet插件兼容velocity。還需在Emmet.sublime-settings中添加如下內容
//"vm":{
// "extends":"html",
// "profiles":"vm"
// }
{
"keys": [
"tab"
],
"command": "expand_abbreviation_by_tab",
"context": [{
"operand": "source.css, source.sass, source.less, source.scss, source.stylus, source.postcss, source.velocity,source.jade, text.jade, text.slim, text.xml, text.html - source, text.haml, text.scala.html, source string, text.html.basic",
"operator": "equal",
"match_all": true,
"key": "selector"
}, {
"operand": "storage.type.templatetag.django",
"operator": "not_equal",
"match_all": true,
"key": "selector"
}, {
"match_all": true,
"key": "selection_empty"
}, {
"operator": "equal",
"operand": false,
"match_all": true,
"key": "has_next_field"
}, {
"operator": "equal",
"operand": false,
"match_all": true,
"key": "setting.disable_tab_abbreviations"
}, {
"operand": false,
"operator": "equal",
"match_all": true,
"key": "auto_complete_visible"
}, {
"match_all": true,
"key": "is_abbreviation"
}]
},
// Table Editor快捷鍵 start
{
"keys": ["tab"],
"command": "table_editor_next_field",
"context": [{
"key": "setting.enable_table_editor",
"operator": "equal",
"operand": true,
"match_all": true
}, {
"key": "preceding_text",
"operator": "regex_contains",
"operand": "^\\s*\\|",
"match_all": true
}, {
"key": "following_text",
"operator": "regex_contains",
"operand": "$",
"match_all": true
}]
}, {
"keys": ["shift+tab"],
"command": "table_editor_previous_field",
"context": [{
"key": "setting.enable_table_editor",
"operator": "equal",
"operand": true,
"match_all": true
}, {
"key": "preceding_text",
"operator": "regex_contains",
"operand": "^\\s*\\|",
"match_all": true
}, {
"key": "following_text",
"operator": "regex_contains",
"operand": "$",
"match_all": true
}]
},
//Table Editor快捷鍵 end
{ "keys": ["ctrl+r"], "command": "goto_definition" },
]
==========================================================================================================================
Mac環(huán)境
[
// 刪除當前行
{
"keys": ["super+d"],
"command": "run_macro_file",
"args": {
"file": "Packages/Default/Delete Line.sublime-macro"
}
},
//plainTask插件中用于標記任務完成
{
"keys": ["alt+d"],
"command": "plain_tasks_complete",
"context": [{
"key": "selector",
"operator": "equal",
"operand": "text.todo"
}]
},
// 復制選中行到行后
{
"keys": ["super+alt+down"],
"command": "duplicate_line"
},
// 選詞(按住-繼續(xù)選擇下個相同的字符串)
{
"keys": ["super+g"],
"command": "find_under_expand"
},
// 自動提示证逻、補全
{
"keys": ["alt+/"],
"command": "auto_complete"
}, {
"keys": ["alt+/"],
"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": ["alt+up"],
"command": "swap_line_up"
},
// 與下行互換
{
"keys": ["alt+down"],
"command": "swap_line_down"
}, {
"keys": ["alt+/", "alt+/"],
"command": "insert_best_completion"
},
//與tab鍵沖突乐埠,秒之
{
"keys": ["shift+tab"],
"command": "insert_best_completion",
"args": {
"default": "\t",
"exact": true
}
}, {
"keys": ["shift+tab"],
"command": "insert_best_completion",
"args": {
"default": "\t",
"exact": false
},
"context": [{
"key": "setting.tab_completion",
"operator": "equal",
"operand": true
}]
}, {
"keys": ["shift+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": ["shift+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": ["shift+tab"],
"command": "indent",
"context": [{
"key": "text",
"operator": "regex_contains",
"operand": "\n"
}]
}, {
"keys": ["shift+tab"],
"command": "next_field",
"context": [{
"key": "has_next_field",
"operator": "equal",
"operand": true
}]
}, {
"keys": ["shift+tab"],
"command": "commit_completion",
"context": [{
"key": "auto_complete_visible"
}, {
"key": "setting.auto_complete_commit_on_tab"
}]
},
//移動光標
{
"keys": ["alt+l"],
"command": "move",
"args": {
"by": "characters",
"forward": false
}
}, {
"keys": ["alt+r"],
"command": "move",
"args": {
"by": "characters",
"forward": true
}
}, {
"keys": ["alt+u"],
"command": "move",
"args": {
"by": "lines",
"forward": false
}
}, {
"keys": ["shift+alt+l"],
"command": "move",
"args": {
"by": "characters",
"forward": false,
"extend": true
}
}, {
"keys": ["shift+alt+r"],
"command": "move",
"args": {
"by": "characters",
"forward": true,
"extend": true
}
}, {
"keys": ["shift+alt+u"],
"command": "move",
"args": {
"by": "lines",
"forward": false,
"extend": true
}
}, {
"keys": ["shift+alt+d"],
"command": "move",
"args": {
"by": "lines",
"forward": true,
"extend": true
}
},
//移動光標到行首或行末
{
"keys": ["alt+b"],
"command": "move_to",
"args": {
"to": "bol",
"extend": false
}
}, {
"keys": ["alt+e"],
"command": "move_to",
"args": {
"to": "eol",
"extend": false
}
}, {
"keys": ["shift+alt+b"],
"command": "move_to",
"args": {
"to": "bol",
"extend": true
}
}, {
"keys": ["shift+alt+e"],
"command": "move_to",
"args": {
"to": "eol",
"extend": true
}
},
//滾屏
{
"keys": ["alt+g"],
"command": "scroll_lines",
"args": {
"amount": 1.0
}
}, {
"keys": ["alt+h"],
"command": "scroll_lines",
"args": {
"amount": -1.0
}
},
//縮進
{
"keys": ["shift+tab"],
"command": "unindent"
}, {
"keys": ["shift+enter"],
"command": "run_macro_file",
"args": {
"file": "res://Packages/Default/Add Line.sublime-macro"
}
},
//切換Side Bar
{
"keys": ["super+]"],
"command": "toggle_side_bar"
},
//切換注釋
{
"keys": ["super+/"],
"command": "toggle_comment",
"args": {
"block": false
}
},
//轉到第幾行
// { "keys": ["super+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} },
{
"keys": ["super+p"],
"command": "show_overlay",
"args": {
"overlay": "goto",
"text": ":"
}
},
//選中整行(系統(tǒng)默認)(轉到第幾行請用super+p)
{
"keys": ["super+l"],
"command": "expand_selection",
"args": {
"to": "line"
}
},
//override termial插件默認配置
{
"keys": ["super+shift+t"],
"command": "reopen_last_file"
},
//override termial插件默認配置
{
"keys": ["super+shift+t"],
"command": "reopen_last_file"
},
//Emmet插件兼容velocity。還需在Emmet.sublime-settings中添加如下內容
//"vm":{
// "extends":"html",
// "profiles":"vm"
// }
{
"keys": [
"tab"
],
"command": "expand_abbreviation_by_tab",
"context": [{
"operand": "source.css, source.sass, source.less, source.scss, source.stylus, source.postcss, source.velocity,source.jade, text.jade, text.slim, text.xml, text.html - source, text.haml, text.scala.html, source string, text.html.basic",
"operator": "equal",
"match_all": true,
"key": "selector"
}, {
"operand": "storage.type.templatetag.django",
"operator": "not_equal",
"match_all": true,
"key": "selector"
}, {
"match_all": true,
"key": "selection_empty"
}, {
"operator": "equal",
"operand": false,
"match_all": true,
"key": "has_next_field"
}, {
"operator": "equal",
"operand": false,
"match_all": true,
"key": "setting.disable_tab_abbreviations"
}, {
"operand": false,
"operator": "equal",
"match_all": true,
"key": "auto_complete_visible"
}, {
"match_all": true,
"key": "is_abbreviation"
}]
},
// Table Editor快捷鍵 start
{
"keys": ["tab"],
"command": "table_editor_next_field",
"context": [{
"key": "setting.enable_table_editor",
"operator": "equal",
"operand": true,
"match_all": true
}, {
"key": "preceding_text",
"operator": "regex_contains",
"operand": "^\\s*\\|",
"match_all": true
}, {
"key": "following_text",
"operator": "regex_contains",
"operand": "$",
"match_all": true
}]
}, {
"keys": ["shift+tab"],
"command": "table_editor_previous_field",
"context": [{
"key": "setting.enable_table_editor",
"operator": "equal",
"operand": true,
"match_all": true
}, {
"key": "preceding_text",
"operator": "regex_contains",
"operand": "^\\s*\\|",
"match_all": true
}, {
"key": "following_text",
"operator": "regex_contains",
"operand": "$",
"match_all": true
}]
},
//Table Editor快捷鍵 end
{ "keys": ["super+r"], "command": "goto_definition" },
]