Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
349 changes: 216 additions & 133 deletions BBCode.sublime-syntax

Large diffs are not rendered by default.

117 changes: 112 additions & 5 deletions Default (OSX).sublime-keymap
Original file line number Diff line number Diff line change
@@ -1,7 +1,114 @@
[
{ "keys": ["super+ctrl+b"], "command": "insert_snippet", "args": {"name": "Packages/BBCode Syntax/Bold.sublime-snippet"} },
{ "keys": ["super+ctrl+c"], "command": "insert_snippet", "args": {"name": "Packages/BBCode Syntax/Color.sublime-snippet"} },
{ "keys": ["super+ctrl+i"], "command": "insert_snippet", "args": {"name": "Packages/BBCode Syntax/Italic.sublime-snippet"} },
{ "keys": ["super+ctrl+2"], "command": "insert_snippet", "args": {"name": "Packages/BBCode Syntax/Size.sublime-snippet"} },
{ "keys": ["super+ctrl+w"], "command": "insert_snippet", "args": {"name": "Packages/BBCode Syntax/Wrap.sublime-snippet"} }
// BUG: preceding_text/following_text selectors fail since 'selection' is included, so can't reliably parse @ the start/end
// https://github.com/sublimehq/sublime_text/issues/4042
// // [BBCode] Text Formatting Bold
// // auto-pair if not within a word
// {"keys":["super+b"], "command":"insert_snippet","args":{"name":"Packages/BBCode/Bold.sublime-snippet"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - markup.bold - markup.bold_italic - meta.tag.any.bbcode", "match_all":true },
// {"key":"selection_empty", "operator":"equal", "operand":true, "match_all":true },
// {"key":"eol_selector", "operator":"not_equal", "operand":"string.quoted.single", "match_all":true },
// {"key":"preceding_text", "operator":"not_regex_contains", "operand":"['a-zA-Z0-9_*]$", "match_all":true },
// {"key":"following_text", "operator":"regex_contains", "operand":"^(?:\t| |\\)|]|\\}|$)", "match_all":true } ]},
// // Bold on Cmd + B (if caret is at the beginning, in the middle of or at the end of a word)
// {"keys":["super+b"], "command":"run_macro_file","args":{"file":"Packages/BBCode/macro/Transform Word - Bold.sublime-macro"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - markup.bold - markup.bold_italic - meta.tag.any.bbcode", "match_all":true },
// {"key":"selection_empty", "operator":"equal", "operand":true, "match_all":true },
// {"key":"preceding_text", "operator":"regex_contains", "operand":"\\w$", "match_all":true } ]},
// {"keys":["super+b"], "command":"run_macro_file","args":{"file":"Packages/BBCode/macro/Transform Word - Bold.sublime-macro"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - markup.bold - markup.bold_italic - meta.tag.any.bbcode", "match_all":true },
// {"key":"selection_empty", "operator":"equal", "operand":true, "match_all":true },
// {"key":"following_text", "operator":"regex_contains", "operand":"^\\w", "match_all":true } ]},
// // Transform selection to bold
// {"keys":["super+b"], "command":"insert_snippet","args":{"name":"Packages/BBCode/Bold.sublime-snippet"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - markup.bold - markup.bold_italic - meta.tag.any.bbcode", "match_all":true },
// {"key":"selection_empty", "operator":"equal", "operand":false, "match_all":true },
// {"key":"preceding_text", "operator":"not_regex_contains", "operand":"\\[b\\]$", "match_all":true },
// {"key":"following_text", "operator":"not_regex_contains", "operand":"^\\[\\/b\\]", "match_all":true } ]},
// // Unbold on Cmd + B if already bold
// {"keys":["super+b"], "command":"run_macro_file","args":{"file":"Packages/BBCode/macro/Transform Word - UnBold.sublime-macro"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode markup.bold - punctuation, text.bbcode markup.bold_italic - punctuation", "match_all":true } ]},

// // [BBCode] Text Formatting Italic
// // auto-pair if not within a word
// {"keys":["super+i"], "command":"insert_snippet","args":{"name":"Packages/BBCode/Italic.sublime-snippet"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - markup.italic - markup.bold_italic - meta.tag.any.bbcode", "match_all":true },
// {"key":"selection_empty", "operator":"equal", "operand":true, "match_all":true },
// {"key":"eol_selector", "operator":"not_equal", "operand":"string.quoted.single", "match_all":true },
// {"key":"preceding_text", "operator":"not_regex_contains", "operand":"['a-zA-Z0-9_*]$", "match_all":true },
// {"key":"following_text", "operator":"regex_contains", "operand":"^(?:\t| |\\)|]|\\}|$)", "match_all":true } ]},
// // Italics on Cmd + I (if caret is at the beginning, in the middle of or at the end of a word)
// {"keys":["super+i"], "command":"run_macro_file","args":{"file":"Packages/BBCode/macro/Transform Word - Italic.sublime-macro"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - markup.italic - markup.bold_italic - meta.tag.any.bbcode", "match_all":true },
// {"key":"selection_empty", "operator":"equal", "operand":true, "match_all":true },
// {"key":"preceding_text", "operator":"regex_contains", "operand":"\\w$", "match_all":true } ]},
// {"keys":["super+i"], "command":"run_macro_file","args":{"file":"Packages/BBCode/macro/Transform Word - Italic.sublime-macro"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - markup.italic - markup.bold_italic - meta.tag.any.bbcode", "match_all":true },
// {"key":"selection_empty", "operator":"equal", "operand":true, "match_all":true },
// {"key":"following_text", "operator":"regex_contains", "operand":"^\\w", "match_all":true } ]},
// // Unitalicize on Cmd + I if already italic
// {"keys":["super+i"], "command":"insert_snippet","args":{"name":"Packages/BBCode/Italic.sublime-snippet"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - markup.italic - markup.bold_italic - meta.tag.any.bbcode", "match_all":true },
// {"key":"selection_empty", "operator":"equal", "operand":false, "match_all":true },
// {"key":"preceding_text", "operator":"not_regex_contains", "operand":"\\[i\\]$", "match_all":true },
// {"key":"following_text", "operator":"not_regex_contains", "operand":"^\\[\\/i\\]", "match_all":true } ]},
// {"keys":["super+i"], "command":"run_macro_file","args":{"file":"Packages/BBCode/macro/Transform Word - UnItalicize.sublime-macro"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode markup.italic - punctuation, text.bbcode markup.bold_italic - punctuation", "match_all":true } ]},

// // [BBCode] Text Formatting Other: wrap, color, size tags
// // Wrap: auto-pair if outside a word
// {"keys":["super+ctrl+w"], "command":"insert_snippet","args":{"name":"Packages/BBCode/Wrap.sublime-snippet"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - meta.tag.any.bbcode", "match_all":true},
// {"key":"selection_empty", "operator":"equal", "operand":true, "match_all":true},
// {"key":"eol_selector", "operator":"not_equal", "operand":"string.quoted.single", "match_all":true},
// {"key":"preceding_text", "operator":"not_regex_contains", "operand":"['a-zA-Z0-9_*]$", "match_all":true},
// {"key":"following_text", "operator":"regex_contains", "operand":"^(?:\t| |\\)|]|\\}|$)", "match_all":true} ]},
// // Wrap if caret is @ word's beginning/middle/end
// {"keys":["super+ctrl+w"], "command":"run_macro_file","args":{"file":"Packages/BBCode/macro/Transform Word - Wrap.sublime-macro"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - meta.tag.any.bbcode", "match_all":true},
// {"key":"selection_empty", "operator":"equal", "operand":true, "match_all":true},
// {"key":"preceding_text", "operator":"regex_contains", "operand":"\\w$", "match_all":true} ]},
// // Wrap selection
// {"keys":["super+ctrl+b"], "command":"insert_snippet","args":{"name":"Packages/BBCode/Wrap.sublime-snippet"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - meta.tag.any.bbcode", "match_all":true},
// {"key":"selection_empty", "operator":"equal", "operand":false, "match_all":true},
// {"key":"preceding_text", "operator":"not_regex_contains", "operand":"\\[\\w\\]$", "match_all":true},
// {"key":"following_text", "operator":"not_regex_contains", "operand":"^\\[\\/\\w\\]", "match_all":true} ]},

// // Color: auto-pair if outside a word
// {"keys":["super+ctrl+c"], "command":"insert_snippet","args":{"name":"Packages/BBCode/Color.sublime-snippet"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - meta.tag.any.bbcode", "match_all":true},
// {"key":"selection_empty", "operator":"equal", "operand":true, "match_all":true},
// {"key":"eol_selector", "operator":"not_equal", "operand":"string.quoted.single", "match_all":true},
// {"key":"preceding_text", "operator":"not_regex_contains", "operand":"['a-zA-Z0-9_*]$", "match_all":true},
// {"key":"following_text", "operator":"regex_contains", "operand":"^(?:\t| |\\)|]|\\}|$)", "match_all":true} ]},
// // Color if caret is @ word's beginning/middle/end
// {"keys":["super+ctrl+c"], "command":"run_macro_file","args":{"file":"Packages/BBCode/macro/Transform Word - Color.sublime-macro"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - meta.tag.any.bbcode", "match_all":true},
// {"key":"selection_empty", "operator":"equal", "operand":true, "match_all":true},
// {"key":"preceding_text", "operator":"regex_contains", "operand":"\\w$", "match_all":true} ]},
// // Color selection
// {"keys":["super+ctrl+c"], "command":"insert_snippet","args":{"name":"Packages/BBCode/Color.sublime-snippet"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - meta.tag.any.bbcode", "match_all":true},
// {"key":"selection_empty", "operator":"equal", "operand":false, "match_all":true},
// {"key":"preceding_text", "operator":"not_regex_contains", "operand":"\\[\\w\\]$", "match_all":true},
// {"key":"following_text", "operator":"not_regex_contains", "operand":"^\\[\\/\\w\\]", "match_all":true} ]},

// // Size: auto-pair if outside a word
// {"keys":["super+ctrl+2"], "command":"insert_snippet","args":{"name":"Packages/BBCode/Size.sublime-snippet"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - meta.tag.any.bbcode", "match_all":true},
// {"key":"selection_empty", "operator":"equal", "operand":true, "match_all":true},
// {"key":"eol_selector", "operator":"not_equal", "operand":"string.quoted.single", "match_all":true},
// {"key":"preceding_text", "operator":"not_regex_contains", "operand":"['a-zA-Z0-9_*]$", "match_all":true},
// {"key":"following_text", "operator":"regex_contains", "operand":"^(?:\t| |\\)|]|\\}|$)", "match_all":true} ]},
// // Size if caret is @ word's beginning/middle/end
// {"keys":["super+ctrl+2"], "command":"run_macro_file","args":{"file":"Packages/BBCode/macro/Transform Word - Size.sublime-macro"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - meta.tag.any.bbcode", "match_all":true},
// {"key":"selection_empty", "operator":"equal", "operand":true, "match_all":true},
// {"key":"preceding_text", "operator":"regex_contains", "operand":"\\w$", "match_all":true} ]},
// // Size selection
// {"keys":["super+ctrl+2"], "command":"insert_snippet","args":{"name":"Packages/BBCode/Size.sublime-snippet"},"context":[
// {"key":"selector", "operator":"equal", "operand":"text.bbcode - meta.tag.any.bbcode", "match_all":true},
// {"key":"selection_empty", "operator":"equal", "operand":false, "match_all":true},
// {"key":"preceding_text", "operator":"not_regex_contains", "operand":"\\[\\w\\]$", "match_all":true},
// {"key":"following_text", "operator":"not_regex_contains", "operand":"^\\[\\/\\w\\]", "match_all":true} ]},
]
Loading