Reputation: 3902
In the Atom text editor, how can I make a keybinding take a different action depending on which character is immediately to the left of the cursor?
In particular:
tab
key to insert indentation.tab
key to open the autocomplete pane.Upvotes: 1
Views: 118
Reputation: 5030
you can extend this extension https://github.com/atom/autocomplete-plus.git
.
first git clone
the repo,
remove the extension from your atom if you had it,
then cd to your cloned directory, then install it using apm link
in the https://github.com/atom/autocomplete-plus/blob/master/keymaps/autocomplete-plus.cson
you can add the tab :
'atom-text-editor':
'ctrl-space': 'autocomplete-plus:activate',
'tab': 'autocomplete-plus:activate',
and here line 501 ,before entering the while loop, you can check if the last character is equal space
if(line[position.column - 1] == ' '){
this.editor.indent()
}
and add one level Indentation .
Upvotes: 3