shagabutdinov / sublime-toggle-wrap

Toggles wrap type (and remove wrap) between (), {}, [] and quotes "", '', ``
Other
3 stars 1 forks source link

Linux config file is invalid #1

Open theoo opened 9 years ago

theoo commented 9 years ago

Here is an updated version, all trailing coma suppressed:

[
{
  "keys": ["alt+/"],
  "command": "toggle_wrap",
  "args": {
    "source": [["\"", "\""], ["`", "`"], ["'", "'"], ["(", ")"], ["[", "]"], ["{", "}"]],
    "target": ["", ""]
  },
  "context": [
    {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true},
    {"key": "selection_empty", "operator": "equal", "operand": false, "match_all": true},
    {"key": "following_text_begin", "operator": "regex_contains", "operand": "^[({\\[\"'`]", "match_all": true},
    {"key": "preceding_text_end", "operator": "regex_contains", "operand": "[)}\\]\"'`]$", "match_all": true}
  ]
},

{
  "keys": ["ctrl+/"],
  "command": "run_macro_file",
  "args": {
    "file": "Packages/ToggleWrap/macro/clean_brackets_forward.sublime-macro"
  },
  "context": [
    {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true},
    {"key": "scope_b", "operator": "not_regex_contains", "operand": "comment|symbol|string"},
    {"key": "selection_empty", "operator": "equal", "operand": true},
    {"key": "following_text", "operator": "regex_contains", "operand": "^[({\\[][^)}\\]]"}
  ]
},

{
  "keys": ["ctrl+/"],
  "command": "run_macro_file",
  "args": {
    "file": "Packages/ToggleWrap/macro/clean_quotes_forward.sublime-macro"
  },
  "context": [
    {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true},
    {"key": "scope_b_left", "operator": "not_regex_contains", "operand": "comment|symbol|string"},
    {"key": "scope_b_right", "operator": "regex_contains", "operand": "comment|symbol|string"},
    {"key": "following_text_b", "operator": "regex_contains", "operand": "^\\w?[\"'`][^\"'`]"}
  ]
},

{
  "keys": ["ctrl+backspace"],
  "command": "run_macro_file",
  "args": {
    "file": "Packages/ToggleWrap/macro/clean_brackets_backward.sublime-macro"
  },
  "context": [
    {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true},
    {"key": "scope_b", "operator": "not_regex_contains", "operand": "comment|symbol|string"},
    {"key": "selection_empty", "operator": "equal", "operand": true},
    {"key": "preceding_text", "operator": "regex_contains", "operand": "[^({\\[][)}\\]]$"}
  ]
},

{
  "keys": ["ctrl+backspace"],
  "command": "run_macro_file",
  "args": {
    "file": "Packages/ToggleWrap/macro/clean_quotes_backward.sublime-macro"
  },
  "context": [
    {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true},
    {"key": "scope_b_right", "operator": "not_regex_contains", "operand": "comment|symbol|string"},
    {"key": "scope_b_left", "operator": "regex_contains", "operand": "comment|symbol|string"},
    {"key": "preceding_text_b", "operator": "regex_contains", "operand": "[^\"'`][\"'`]\\s*$"}
  ]
},

{
  "keys": ["'"],
  "command": "toggle_wrap",
  "args": {
    "source": [["\"", "\""], ["`", "`"], [":", ""], ["", ":"]],
    "target": ["'", "'"],
    "escape": ["'"],
    "unescape": ["\"", "`"]
  },
  "context": [
    {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true},
    {"key": "selection_empty", "operator": "equal", "operand": false, "match_all": true},
    {"key": "text", "operator" : "regex_contains", "operand": "^(\"|:|`)[\\s\\S]*(\"|:|`)$", "match_all": true}
  ]
},

{
  "keys": ["\""],
  "command": "toggle_wrap",
  "args": {
    "source": [["'", "'"], ["`", "`"], [":", ""], ["", ":"]],
    "target": ["\"", "\""],
    "escape": ["\""],
    "unescape": ["'", "`"]
  },
  "context": [
    {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true},
    {"key": "selection_empty", "operator": "equal", "operand": false, "match_all": true},
    {"key": "text", "operator" : "regex_contains", "operand": "^('|:|`)[\\s\\S]*('|:|`)$", "match_all": true}
  ]
},

{
  "keys": [":"],
  "command": "toggle_wrap",
  "args": {
    "source": [["'", "'"], ["\"", "\""], ["`", "`"], ["", ":"]],
    "target": [":", ""]
  },
  "context": [
    {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true},
    {"key": "selection_empty", "operator": "equal", "operand": false, "match_all": true},
    {"key": "text", "operator" : "regex_contains", "operand": "^('|\"|'|:|`)", "match_all": true}
  ]
},

{
  "keys": [";"],
  "command": "toggle_wrap",
  "args": {
    "source": [["'", "'"], ["\"", "\""], ["`", "`"], [":", ""]],
    "target": ["", ":"]
  },
  "context": [
    {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true},
    {"key": "selection_empty", "operator": "equal", "operand": false, "match_all": true},
    {"key": "text", "operator" : "regex_contains", "operand": "^('|\"|'|:|`)", "match_all": true}
  ]
},

{
  "keys": ["`"],
  "command": "toggle_wrap",
  "args": {
    "source": [["'", "'"], ["\"", "\""], [":", ""], ["", ":"]],
    "target": ["`", "`"],
    "escape": ["`"],
    "unescape": ["'", "\""]
  },
  "context": [
    {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true},
    {"key": "selection_empty", "operator": "equal", "operand": false, "match_all": true},
    {"key": "text", "operator" : "regex_contains", "operand": "^('|\"|:)[\\s\\S]*('|\"|:)$", "match_all": true}
  ]
},

{
  "keys": ["("],
  "command": "toggle_wrap",
  "args": {
    "source": [["(", ")"], ["[", "]"], ["{", "}"]],
    "target": ["(", ")"]
  },
  "context": [
    {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true},
    {"key": "selection_empty", "operator": "equal", "operand": false, "match_all": true},
    {"key": "text", "operator" : "regex_contains", "operand": "^(\\[|\\{)[\\s\\S]+(\\]|\\})$", "match_all": true}
  ]
},

{
  "keys": ["{"],
  "command": "toggle_wrap",
  "args": {
    "source": [["(", ")"], ["[", "]"], ["{", "}"]],
    "target": ["{", "}"]
  },
  "context": [
    {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true},
    {"key": "selection_empty", "operator": "equal", "operand": false, "match_all": true},
    {"key": "text", "operator" : "regex_contains", "operand": "^(\\[|\\()[\\s\\S]+(\\]|\\))$", "match_all": true}
  ]
},

{
  "keys": ["["],
  "command": "toggle_wrap",
  "args": {
    "source": [["(", ")"], ["[", "]"], ["{", "}"]],
    "target": ["[", "]"]
  },
  "context": [
    {"key": "setting.sublime_enhanced_keybindings", "operator": "equal", "operand": true},
    {"key": "selection_empty", "operator": "equal", "operand": false, "match_all": true},
    {"key": "text", "operator" : "regex_contains", "operand": "^(\\(|\\{)[\\s\\S]+(\\)|\\})$", "match_all": true}
  ]
}
]

Sorry, I don't have time for a pull request.

shagabutdinov commented 9 years ago

Sorry, I don't have time for a pull request.

Please, pay respect: I spent hundreds hours for those plugins and I expect commiter will find 15 minutes to create a pull request.

Anyway, this issue can wait until you, or somebody else, will find time to create pull request, because sublime text 3 works well enough with trailing commas.

theoreichel commented 9 years ago

Hello, Sorry for this, it seams we both have busy life. Don't misunderstand this action, I'm very grateful for your work, this is why I quickly paste it here. I'll take care of this asap.