Home Download Buy Blog Forum Support

Remapping Space bar and Tab keys

Remapping Space bar and Tab keys

Postby Dan0 on Mon Sep 03, 2012 10:37 pm

Hey,

Firstly, I love sublime and use it 8 hours a day at work coding up html email templates.
Recently I have been getting RSI in my left hand from repeatedly using ctrl+shift+a and snippet autocompletion via the tab key.

I have successfully remapped ctrl+space to the "expand selection to tag" tag using the sublime-keymap preferences file.
However, I'm having a hard time mapping the space bar to act with the same functionality as tab. Currently I have the tab mapped to " " but I can not get space mapped to "\t" or "insert_best_completion" commands.

The code I have so far - at the end of the sublime-keymap file:
Code: Select all
{ "keys": ["ctrl+space"], "command": "unbound"},
{ "keys": ["ctrl+space"], "command": "expand_selection", "args": {"to": "tag"} },

{ "keys": ["tab"], "command": "unbound"},
{ "keys": ["tab"], "command": "insert", "args": {"characters": " "} },

{ "keys": ["space"], "command": "unbound"},
{ "keys": ["space"], "command": "insert", "args": {"characters": "\t"} },

{ "keys": ["super+ctrl+space"], "command": "insert_best_completion", "args": {"default": " ", "exact": true} },
{ "keys": ["super+ctrl+space"], "command": "insert_best_completion", "args": {"default": " ", "exact": false},
   "context":
   [
      { "key": "setting.tab_completion", "operator": "equal", "operand": true }
   ]
},
{ "keys": ["super+ctrl+space"], "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": ["super+ctrl+space"], "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": ["super+ctrl+space"], "command": "indent", "context":
   [
      { "key": "text", "operator": "regex_contains", "operand": "\n" }
   ]
},
{ "keys": ["super+ctrl+space"], "command": "next_field", "context":
   [
      { "key": "has_next_field", "operator": "equal", "operand": true }
   ]
},
{ "keys": ["super+ctrl+space"], "command": "commit_completion", "context":
   [
      { "key": "auto_complete_visible" },
      { "key": "setting.auto_complete_commit_on_tab" }
   ]
}


It's really important to me that I can do this to save my hand from repetitive strain injury, it really hurts!

Thank you so much for your help :),
Dan0
Dan0
 
Posts: 1
Joined: Mon Sep 03, 2012 10:29 pm

Return to Technical Support

Who is online

Users browsing this forum: Silberling, Yahoo [Bot] and 27 guests