I found a great keybinding that jumps over sublimes code compeletion by hitting enter here's the link: quora. My code in my keymap file is:
// BEGIN keymaps for skipping to the end of " ) and ] code compeletion
{ "keys": ["enter"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
[
{ "key": "following_text", "operator": "regex_contains", "operand": "^[)'\"\\]]", "match_all": true },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
]
},
// END keymaps for skipping to the end of " ) and ] code compeletion
and it defintely works how I'd like...most of the time. For example if I'm typing in some javascript:
function(p1, p2|)|
hitting enter..^.^
and I hit enter when the cursor is at the first carrot then it will jump over to the second carrot which is what I want. However, there's another case which is when you open up, say square brackets in a sublime settings file.
[|]|
.^.^
Now because of the keymapping the cursor jumps over the right square bracket, when in reality what you want is to insert a new line like:
[|
.^
|
....^
]
and move the carrot from the first to the second carrot, just like the behavior that happens when you create a javascript function:
function myFunction(){|
| <-- cursor tabbed over
} <--curly on bottom
My problem is I don't really understand regex that well yet, or how to use them in combination with keymaps in sublime. Really what I need to figure out (I think) is how to insert some sort of conditional into the keymap that basically just checks:
if (next char is a ] and the char before it is a [)
then don't do any completion hoping
else do exactly like the keymap is already set up to do
How would I go about doing this? Thanks for your help :)