As often happens, my ideas for blog posts are provided by end users asking for help. Sometimes I know the answer, sometimes I don’t. This is one of the latter cases. Chet AKA @oraclenerd asked me:
‘Tell me how to find the preference in sqldev to make a tab 2 spaces?’
I knew it had to be in there somewhere. This is a pretty basic setting for any word processor or IDE. Basically you want to control how many spaces are inserted when you hit the TAB key.
The default is ’2.’
The problem with default settings is that they are likely to make half the users happy, a third non-plussed, and the rest genuinely upset. The idea is to shoot for something that offends the least number of users and aim for ‘the right thing’, kind of like Google’s ‘Do No Harm’ motto.
Since we can’t make everyone happy, we provide options for the end user to customize and fine tune their experience. The problem here was that it was REALLY hard to find this particular option. The search mechanism in the preferences dialog doesn’t reach the page where this particular setting was stored, and the label for the setting isn’t ideal.
So let’s get down to brass tacks and show you exactly how to configure this setting in SQL Developer.
Open the preferences, go to the Database page.
Easy enough. Now click on the ‘SQL Formatting’ sub page and then on ‘Oracle Formatting.’
Click on the ‘Edit’ button next to the profile dropdown control
Go to the Indentation page and inspect the ‘Spaces’ property
It’s currently set to ’2.’ Change it to the desired setting. If I change it to 5, when I hit the ‘tab’ key, SQL Developer will insert 4 spaces leaving the cursor on the 5th curpos on the current line.
You can easily observe the new behavior in the worksheet if you enable the ‘Show Whitespace Characters’ option under the ‘Code Editor’ and ‘Display’ page in the preferences.





Twitter
RSS
GooglePlus
Facebook
Dec 21, 2011 @ 10:16:16
So how do you set up a Tab keystroke to be 2 spaces (instead of the actual Tab character)?
(Yes, now I’m following you)
Dec 21, 2011 @ 10:41:29
That’s the default behavior. I don’t see Tab characters at all. Set that option to ’2′ if you want 2 spaces when you hit