Instert tabstop if Soft-Tab is enabled


#1

Hi there,

I have soft tabs switched on, as I normally relay on this feature. But it happens, that I have to insert a tab (character) sometimes. In vim I may do that by pressing Ctrl-v tab. I did not find a way to do this in Atom.

Regards


#2

Simplest way I can think of to get this working, is by adding the following (or something similar) to your init script

atom.workspaceView.command "user:tabstop", =>
  editor = atom.workspace.getActiveEditor()
  editor?.insertText('\t')
atom.keymap.add "user", ".editor:not(.mini)": "alt-tab": "user:tabstop"

This maps alt-tab to the a custom command called user:tabstop which inserts a tab character at the position of the text cursor.

Hope this helps!


#3

Uh! Work’s like a charm, [at leas for me][ps]! Thanks!

[ps]:: I don’t need it, but since I’m curious, I played a little bit around with mixing hard tabs and soft tabs. Most of the time,this works nicely. There is one exception: Using hard tab in one line and hard, soft in the next one produces either 1 or 3 spaces.