Skip to content

Commit

Permalink
1.3.5
Browse files Browse the repository at this point in the history
without tp selection
  • Loading branch information
duydao committed Feb 27, 2014
1 parent 54cd806 commit bb78311
Show file tree
Hide file tree
Showing 5 changed files with 849 additions and 381 deletions.
7 changes: 6 additions & 1 deletion Default (OSX).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
{ "keys": ["super+alt+n"], "command": "text_pastry_show_command_line", "args": { "text": "" } },
{ "keys": ["super+alt+t"], "command": "text_pastry_show_menu" },
{ "keys": ["super+alt+v"], "command": "text_pastry_insert_text", "args": { "clipboard": true, "separator": "\\n" } },
{ "keys": ["super+alt+b"], "command": "text_pastry_redo" }
{ "keys": ["super+alt+b"], "command": "text_pastry_redo" },
{ "keys": ["up"], "command": "text_pastry_history_navigator", "args": { "reverse": true },
"context": [{ "key": "selector", "operator": "equal", "operand": "source.text_pastry" }, {"key": "panel_has_focus"}] },

{ "keys": ["down"], "command": "text_pastry_history_navigator", "args": { "reverse": false },
"context": [{ "key": "selector", "operator": "equal", "operand": "source.text_pastry" }, {"key": "panel_has_focus"}] }
]
42 changes: 25 additions & 17 deletions Default.sublime-commands
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
[
{
[{
"caption": "Text Pastry: From 0 To X",
"command": "insert_nums",
"command": "insert_nums",
"args": {"current": "0", "step": "1", "padding": "1"}
},{
}, {
"caption": "Text Pastry: From 1 To X",
"command": "insert_nums",
"command": "insert_nums",
"args": {"current": "1", "step": "1", "padding": "1"}
},{
"caption": "Text Pastry: From N to X by M",
"command": "text_pastry_show_command_line",
"args": {"text": "\\i(N,M)"}
},{
"caption": "Text Pastry: Lines from clipboard",
"command": "text_pastry_insert_text",
}, {
"caption": "Text Pastry: Paste Lines",
"command": "text_pastry_insert_text",
"args": {"text": "", "clipboard": true, "separator": "\\n"}
},{
"caption": "Text Pastry: Words from clipboard",
"command": "text_pastry_insert_text",
}, {
"caption": "Text Pastry: Paste",
"command": "text_pastry_insert_text",
"args": {"text": "", "clipboard": true}
}
]
}, {
"caption": "Text Pastry: UUID",
"command": "text_pastry_uuid"
}, {
"caption": "Text Pastry: Command Line",
"command": "text_pastry_show_command_line",
"args": {"text": ""}
}, {
"caption": "Text Pastry: Menu",
"command": "text_pastry_show_menu"
}, {
"caption": "Text Pastry: Settings",
"command": "text_pastry_show_menu",
"args": {"settings": true, "back": false}
}]
97 changes: 92 additions & 5 deletions TextPastry.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,7 +1,94 @@
{
"clipboard_strip_newline": true,
"repeat_words": false,
"repeat_clipboard": false,
"history_enabled": true,
"keep_selection": false
"clipboard_strip_newline": true,
"repeat_words": true,
"repeat_clipboard": false,
"history_enabled": false,
"keep_selection": true,
"history_max_entries": 100,

"selection_use_regex": true,
"selection_ignore_case": true,
"selection_threshold": "[\\W]",

"presets": {
"days": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
"months": ["January", "February", "March", "April", "May", "June", "Juli", "August", "September", "October", "November", "December"]
},
"cmd_shortcuts": [
// number range from 1 to X
{"match": "^\\\\i$", "command": "insert_nums", "args": {"current": "1", "step": "1", "padding": "1"}},
{"match": "^i$", "command": "insert_nums", "args": {"current": "1", "step": "1", "padding": "1"}},

// number range from 0 to X
{"match": "^\\\\i0$", "command": "insert_nums", "args": {"current": "0", "step": "1", "padding": "1"}},
{"match": "^i0$", "command": "insert_nums", "args": {"current": "0", "step": "1", "padding": "1"}},

// \iN
{"match": "^\\\\i(-?\\d+)$", "command": "insert_nums", "args": {"current": "$1", "step": "1", "padding": "1"}},
{"match": "^i(-?\\d+)$", "command": "insert_nums", "args": {"current": "$1", "step": "1", "padding": "1"}},

// \iN,P
{"match": "^\\\\i(-?\\d+),(-?\\d+)$", "command": "insert_nums", "args": {"current": "$1", "step": "$2", "padding": "1"}},
{"match": "^i(-?\\d+),(-?\\d+)$", "command": "insert_nums", "args": {"current": "$1", "step": "$2", "padding": "1"}},

// \i(N,P)
{"match": "^\\\\i\\((-?\\d+),(-?\\d+)\\)?$", "command": "insert_nums", "args": {"current": "$1", "step": "$2", "padding": "1"}},
{"match": "^i\\((-?\\d+),(-?\\d+)\\)?$", "command": "insert_nums", "args": {"current": "$1", "step": "$2", "padding": "1"}},

// \i(N)
{"match": "^\\\\i\\((-?\\d+)\\)?$", "command": "insert_nums", "args": {"current": "$1", "step": "1", "padding": "1"}},
{"match": "^i\\((-?\\d+)\\)?$", "command": "insert_nums", "args": {"current": "$1", "step": "1", "padding": "1"}},

// insert nums syntax: CURRENT STEP PADDING (e.g. 100 50 3)
{"match": "^(-?\\d+) (-?\\d+) (\\d+)$", "command": "insert_nums", "args": {"current": "$1", "step": "$2", "padding": "$3"}},

// insert nums shortcut: CURRENT STEP (e.g. 100 50)
{"match": "^(-?\\d+) (-?\\d+)$", "command": "insert_nums", "args": {"current": "$1", "step": "$2", "padding": "1"}},

// use regex to split the clipboard data
{"match": "^\\\\r\\((.*?)\\)$", "command": "text_pastry_insert_text", "args": {"separator": "$1", "clipboard": true, "regex": true}},
{"match": "^r\\((.*?)\\)$", "command": "text_pastry_insert_text", "args": {"separator": "$1", "clipboard": true, "regex": true}},
{"match": "^\\\\r (.*)", "command": "text_pastry_insert_text", "args": {"separator": "$1", "clipboard": true, "regex": true}},
{"match": "^r (.*)", "command": "text_pastry_insert_text", "args": {"separator": "$1", "clipboard": true, "regex": true}},
{"match": "^regex (.*)", "command": "text_pastry_insert_text", "args": {"separator": "$1", "clipboard": true, "regex": true}},

// generate UUID
{"match": "^\\\\UUID$", "command": "text_pastry_uuid", "args": {"uppercase": true} },
{"match": "^UUID$", "command": "text_pastry_uuid", "args": {"uppercase": true} },
{"match": "^\\\\uuid$", "command": "text_pastry_uuid" },
{"match": "^uuid$", "command": "text_pastry_uuid" },

// paste clipboard with custom separator
{"match": "^\\\\p\\((.*?)\\)?$", "command": "text_pastry_insert_text", "args": {"separator": "$1", "clipboard": true} },
{"match": "^p\\((.*?)\\)?$", "command": "text_pastry_insert_text", "args": {"separator": "$1", "clipboard": true} },
{"match": "^p (.*)", "command": "text_pastry_insert_text", "args": {"separator": "$1", "clipboard": true} },

// paste clipboard with newline separator
{"match": "^\\\\p\\\\n", "command": "text_pastry_insert_text", "args": {"separator": "\\n", "clipboard": true} },
{"match": "^pn$", "command": "text_pastry_insert_text", "args": {"separator": "\\n", "clipboard": true} },

// paste clipboard with whitespace separator
{"match": "^\\\\p", "command": "text_pastry_insert_text", "args": {"clipboard": true} },
{"match": "^p$", "command": "text_pastry_insert_text", "args": {"clipboard": true} },

// regular text, using whitespace separator
{"match": "^words no-repeat (.*)", "command": "text_pastry_insert_text", "args": {"text": "$1", "repeat": false} },
{"match": "^words (.*)", "command": "text_pastry_insert_text", "args": {"text": "$1"} },

// build-in commands
{"match": "^uc$", "command": "upper_case"},
{"match": "^upper$", "command": "upper_case"},
{"match": "^lc$", "command": "lower_case"},
{"match": "^lower$", "command": "lower_case"},

// shortcut case conversion plugin
{"match": "^snake", "command": "convert_to_snake"},
{"match": "^camel", "command": "convert_to_camel"},
{"match": "^pascal", "command": "convert_to_pascal"},
{"match": "^dot", "command": "convert_to_dot"},
{"match": "^dash", "command": "convert_to_dash"},

{"match": "^node ", "command": "text_pastry_nodejs", "args": {"file": "test.js"} },
{"match": "^js (.*)", "command": "text_pastry_nodejs", "args": {"script": "$1"} }
]
}
16 changes: 16 additions & 0 deletions TextPastry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>text_pastry</string>
</array>
<key>name</key>
<string>Text Pastry</string>
<key>scopeName</key>
<string>source.text_pastry</string>
<key>uuid</key>
<string>e8694b5b-0553-463a-a834-335d8187e516</string>
</dict>
</plist>
Loading

0 comments on commit bb78311

Please sign in to comment.