justinmahar / SublimeCSAutocompletePlus

CoffeeScript autocompletions and more!
172 stars 12 forks source link

Change autocomplete key binding #10

Closed ahmednuaman closed 11 years ago

ahmednuaman commented 11 years ago

Is it possible to change the key binding for autocompletion from ctrl+space to something else?

justinmahar commented 11 years ago

Yes, although the plugin operates on SublimeText's generic autocomplete shortcut. You can open Preferences -> Key Bindings - User to change it. The command name is auto_complete.

The default binding looks like this (Windows): { "keys": ["ctrl+space"], "command": "auto_complete" }

Iristyle commented 11 years ago

FYI -- here's a context aware way of using this just within coffee files

I'm not sure yet if this will cause any issues with regular sublime tab behavior (which is why I tried to limit it based on regex to someword. before a TAB will do anything)

  { "keys": ["tab"], "command": "auto_complete", "context":
    [
      { "key": "preceding_text", "operator": "regex_contains", "operand": "\\w\\.", "match_all": true },
      { "key": "selector", "operator": "equal", "operand": "source.coffee" }
    ]
  }
Iristyle commented 11 years ago

Or even better.. from the ST2 forums http://www.sublimetext.com/forum/viewtopic.php?f=5&t=11285

Had forgotten you could do this!

"auto_complete_triggers":
   [
      {"characters": ".@", "selector": "source.coffee"}
   ]