Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Tabs in files(Java editor)
Tabs in files [message #1819552] Fri, 17 January 2020 09:05 Go to next message
joseph newcomer is currently offline joseph newcomerFriend
Messages: 15
Registered: July 2017
Junior Member
I have searched throughout the menus and preferences searching for a way to make sure a tab character is not once, not ever, inserted into a source file I am editing. The TAB key is used to do indentation, but I want to see spaces, and ONLY spaces, in any whitespace in the source. Putting a TAB character (0x09 or \u0009) into a source file is a very evil thing to do, since it makes looking at that file impossible in editors that use different values for tab spacing, or printing utilities, or pretty much anything other than one unique editor. I would like to have an option to automatically "untabify" any source file I edit, but lacking that, an "untabify" command would do. Am I missing something obvious here?

[Please do not waste my time or yours telling me that the use of TAB characters makes my files smaller, or faster to parse. I have storage measured in Gigabytes in the cloud and Terabytes on my machine, and it would take a massive effort and extremely high-precision timers to tell the difference in speed between compiling programs that use TAB characters and those that use spaces]

[And yes, I am a Newcomer, in name, as well as in using Eclipse]
Joseph M. Newcomer, Ph.D. (ret)
Re: Tabs in files [message #1819557 is a reply to message #1819552] Fri, 17 January 2020 10:07 Go to previous messageGo to next message
Emmanuel Chebbi is currently offline Emmanuel ChebbiFriend
Messages: 123
Registered: February 2018
Senior Member
The following links explain how to insert spaces when hitting the TAB key:

To replace existing tabs you can then format your code (Ctrl + Shift + F) or use Eclipse's search and replace dialog:

  • Ctrl + H > File Search tab
  • Check "Regular expression" and type "\t" in the Search string field
  • Click Replace...
  • Type " " (times the number of spaces you want) in the dialog that opens when the search ends
  • OK
Re: Tabs in files [message #1822660 is a reply to message #1819557] Wed, 11 March 2020 01:22 Go to previous messageGo to next message
joseph newcomer is currently offline joseph newcomerFriend
Messages: 15
Registered: July 2017
Junior Member
I want consistent behavior. If I add a space somewhere, I want everything to the right to move right one space. If I hit backspace, I want everything to the right to move left by one space. TAB is absolutely NOT an abstraction; it is an implementation. Comments like "wasteful" are just plain silly; the amount of extra space consumed on my 5TB server is an uninteresting percentage expressed with negative exponents. In the days of machines that execute billions of instructions per second, the time to skip over spaces vs. tabs is likewise an uninterestingly small number. I will give this up only if tab is actually implemented as an abstraction. Which means that I can, at any point, set the tabs up to mean what I want them to mean, which is not always "move right to the next column which is a multiple of N". Since I have no control over what tab means (such as in laying out a complex table in a comment), there is no way it can be treated as an abstraction.

Now if eclipse allowed me to put HTML in a comment and rendered it properly, that would be a whole different story. And I still wouldn't need tabs, because I would have other abstractions to use. Of course, if you never comment your code, worrying about how to make comments maintainable is not terribly critical, but I am not that kind of programmer.

I started programming in 1963, which means I have been doing it for 56 years. I am sorely disappointed that today, to write a Java program, I still am doing "punched cards", that is, typing in the text a line at a time. I should be able to, at least in comments, include a PowerPoint slide, an Excel spreadsheet, a Visio diagram, a Word document, a PDF file, an image, a video, or anything else I feel like including. But no, I am limited to the same model that I used in 1963: a sequence of lines of text, nothing richer or even interesting. Yes, the lines are no longer restricted to 72 characters, I don't have to put a C in column 6 to put a multiline expression in, but that is trivial compared to where we should be. But our conceptual model of what a "program" is has not matured beyond, say, 1955. There is no real excuse for this.

Besides, the whole way eclipse handles indentation sucks. I am locked into a style that someone, somewhere, for some bizarre reasons, thinks makes sense. I, who have studied cognitive psychology and understand how the perceptual centers of the brain recognize and process information, am painfully aware that the eclipse indentation rules are completely nonsensical. My indentation style evolved over decades of use to something that is exceedingly easy to use, and eclipse actively works against my style. And I don't need tabs to increase my misery level.

And yes, I know how to do string substitution. But doing that in fifty source files, one at a time? The tabs should never have been there in the first place, and I should be able to "untabify" a file with a single mouse click any time I want to. Is there a plugin that can do this?
Re: Tabs in files [message #1822664 is a reply to message #1822660] Wed, 11 March 2020 06:23 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
The previous instructions will work for all files in the workspace in a single operation. I set my formatter preferences to not use tabs.

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Eclipse wouldn't start
Next Topic:XML outline tree browser - changing a color
Goto Forum:
  


Current Time: Tue Apr 23 11:41:29 GMT 2024

Powered by FUDForum. Page generated in 0.08843 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top