Page 1 of 1

Delphi style smart tab

Posted: Wed Jan 22, 2003 12:39 am
by Ben Wells
Hello,

Sorry if this has been asked before, but I couldn't find anything from a search.

What I want to know is if there is any way to set up tab to be like delphi's smart tab.
This means when you hit tab it goes to the next word on the previous line.

E.g if I have
word1 word2 word3 word4
blah ^

and the caret is at the ^, then when I hit tab once, the caret will got to be before word2, then if I hit it again it will go to being before word3, then again it will go to word4 ... after that it will use tab stops.

Thanks,
Ben.

Re: Delphi style smart tab

Posted: Wed Jan 22, 2003 11:32 am
by Berend
Maybe there's an easier way, but you can record a macro (and assign a shortcut to it) to mimic the same behaviour:

Here's the steps you need to create the macro. This only works when there's more text on the previous line than the current one). It helps if you type some sample text in advance, and place the cursor (^) at the location you want to use Smart Tab, i.e.:
someword someotherword2
xxx^

(Start recording)
1. Type a character you don't use in the rest of your text
2. Press 'End'. This won't move the cursor but it assures the cursor remains on the same character position in 3.
3. Press 'Up'
4. Press 'Shift-Ctrl-Right'
5. Press 'Ctrl-C'
6. Press 'Down'
7. Press 'Ctrl-V'
8. Do a backward search on the character from 1. Make sure you have 'Extend Selection' checked
9. Do a search/replace where Search = .(a dot) Replace = (a space). Check 'Regular Expression' and 'Selected Text'
10. Press 'End'
(Stop recording)