DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Coding
  3. Frameworks
  4. Spaces vs. Tabs in Eclipse

Spaces vs. Tabs in Eclipse

Erich Styger user avatar by
Erich Styger
·
Oct. 12, 12 · Interview
Like (0)
Save
Tweet
Share
18.57K Views

Join the DZone community and get the full member experience.

Join For Free

i admit: i’m a ‘space’ person. what i mean is that i prefer ‘spaces’ over ‘tabs’ in my source code. why? because i don’t want to relay on the tab width, and i prefer to use ‘two spaces for an intention level’.

i would assume that maybe half of the world is for spaces, and half of the world is for tabs. i don’t want to cause a religious wars here. i’m for freedom of choice, and this is what eclipse and codewarrior for mcu (which is eclipse based) offers. now as i have outed myself as a ‘spacer’, and given the fact that codewarrior comes as ‘tabser’ by default, this is something i have to change as a setting for my workspace. here is what i do….

show white-space characters

a useful thing is to show tabs and spaces in the source view. for this i use this toolbar button:

show white-space characters toolbar button

show white-space characters toolbar button

if it is not present, that button is added with the menu window > customize perspective:

adding toolbar button

adding toolbar button

that button makes the tabs and spaces visible in the source view:

tab and spaces in source

tab and spaces in source

tabs for spaces

being a ‘spacer’, i want to use tabs to insert spaces. for this there is a preference under the menu window > preferences > general > editors > text editors:

text editor preferences

text editor preferences

the next thing to do is to define my own code style . for this go the preferences and go into c/c++ > code style and press edit :

editing the code style

editing the code style

this offers a dialog where i can specify the tab policy and the intention size :

tab policy settings

tab policy settings

as noted in the bottom of above dialog: i have modified a built-in profile, and i’m not allowed to change it. so i specify my coding style profile and press ok:

my own coding style profile

my own coding style profile

now the editor is using spaces instead of tabs, with the given intention level (number of spaces for tabs).

this of course will only apply to new source changes. existing tabs are not affected. but there is an easy way to convert tabs into spaces (with the right plugin).

anyedit tools and plugin

for any advanced manipulation of spaces and tabs, i recommend the anyedit tools which offers really cool features. it offers a powerful automatic conversion of tabs and spaces:

anyedit conversion features

anyedit conversion features

summary

if you are a ‘spacer’ or a ‘tabser’: it does not matter, eclipse is a perfect choice for both worlds. and allows you to easily switch sources from one world to another. and don’t worry that you have to apply settings for every workspace: see copy my workspace settings which helps to apply them to multiple workspaces.

happy spacing :-)

Space (architecture) Eclipse

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • DevOps Roadmap for 2022
  • Utilize OpenAI API to Extract Information From PDF Files
  • The Top 3 Challenges Facing Engineering Leaders Today—And How to Overcome Them
  • Top 5 Java REST API Frameworks

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: