Inserting a tab character into an editor

已回答

I've searched and just can't find an answer to this. In my code style I have "Use Tab Character" turned off since I like to have spaces in my files.

However, once in a while I need to insert a real tab character. What magic key sequence will insert a real tab character even though "Use Tab Character" is off?

In 'vi' I can use ]]> to get the result I need.

Thanks.

4
Avatar
Permanently deleted user

This is an extremely old post but I am running into the same thing. Has anyone solved this?

0
Avatar
Permanently deleted user

Same for me - how to occasionally enter real tabs?

0

Hello,

Could you please clarify where do you need to insert tab character?

0
Avatar
Permanently deleted user

I'm writing a shell script in intellij with an here-document inside. Therefor need to insert it into "normal" text editor. Same goes for any other file i like to edit inside intellij (plain text file, other source code file,...)

Normally tabs are automatically converted into spaces when pressing <tab> key. This behavior should stay the default. And changing this back and forth via settings menu just to enter one or two "real" tab chars in text file is way to complicated...

1

In my case, my team has a ".tab" file that's tab delimited. Very rarely do we need to make changes to this file, but due to requirements from other teams, it must be tab delimited. Unfortunately I have to resort to vim for modifying that file instead of RubyMine since there doesn't seem to be a way to manually add a Tab character.

Thanks!

0

Please create new feature request on YouTrack attaching your use-cases: http://youtrack.jetbrains.com/issues/IDEA.

1

For anyone coming here in the future, a feature request has been added to:

https://youtrack.jetbrains.com/issue/RUBY-22707

1

I have the exact same requirement as Stefan Seide. Writing shell script using an indented here-doc - the indented lines MUST be indented using tabs, not spaces, otherwise the shell doesn't handle the here-doc correctly.

The alternative is to simply not indent the here-doc lines, ignoring the shell script indentation ... but that is ugly as hell.

Apart from this particular edge case, 2-space indentation is usually fine.

Will comment in YouTrack also, but added here first FYI. 

0

Hi Sean Healey ,

I've raised a new feature request in YouTrack. Feel free to upvote for https://youtrack.jetbrains.com/issue/IDEA-273464 .

See also the related discussion at StackOverflow - https://stackoverflow.com/questions/38769474/how-can-i-enter-a-literal-tab-character-in-intellij-idea-pycharm .

1

Thanks Egor!  

I have found exactly what I need in IntelliJ's existing functionality.  When adding a here-document in a shell script, I simply select the indented here-document lines and use [Edit] -> [Convert Indents] -> [To Tabs].  Job done. 

To make things extra clear in this mixed space/tab indent environment, I went into the editor settings and switched on 'display whitespace' - so it is clear which lines are indented with spaces or tabs.

2

> I have found exactly what I need in IntelliJ's existing functionality.  When adding a here-document in a shell script, I simply select the indented here-document lines and use [Edit] -> [Convert Indents] -> [To Tabs].  Job done. 

Please note that these changes might be reset by the reformat action. (Ctrl + Shift + L)

-1

请先登录再写评论。