How to set tab to always indent?


#1

I basically never want to insert a tab character in my code except for indentation, so I like tab to always indent. I added this to my configuration:

'atom-text-editor:not([mini])':
  'tab': 'editor:indent-selected-rows'

However, this has problems:

  • I cannot indent an empty line
  • now in 1.4.0 I cannot select items from the completion box with tab or anything else

How should I configure it so I don’t have these problems?


#2

The Tab key is one of the most used keys Atom. It’s used to expand snippets, select autocompletions and for indentation (and probably other things besides). As you’ve found out, tweaking with it can have unintended consequences. What you would probably have to do in order to get what you want is write some custom code and then ensure that the cascading of one function of the tab key to the next works the way you want. You should probably take a look at this section of the Flight Manual:

https://atom.io/docs/latest/behind-atom-keymaps-in-depth#overloading-key-bindings

and then do some code spelunking into the snippets and autocomplete-plus packages to ensure you understand how everything fits together.