Hello, @frank-peelo, @alan-kilborn, @mkupper, @coises and All,
Of course, as @alan-kilborn said :
The notions of “indentation” and “tab” are bound up together. It has always been this way in Notepad++
However, @frank-peelo, I’d like to show you a way to simulate what you’re trying to achieve !
Firstly, in Settings > Preferences... > Indentation, set [Default] of the Indent Settings to value 8, select below the Space character(s) option and check the Backspace key unindents instead of removing single space option
Secondly, create a new macro to type in a tabulation char, anywhere, each time you’ll press the Alt + T shortcut
<Macro name="Insertion 1 TABULATION" Ctrl="no" Alt="yes" Shift="no" Key="84">
<Action type="1" message="2170" wParam="0" lParam="0" sParam="	" />
</Macro>
Thirdly, create an other macro to reduce the
leading indentation by
two, each time you’ll press the
Alt + I shortcut
<Macro name="Indentation divided by 2" Ctrl="no" Alt="yes" Shift="no" Key="73">
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="^(\x20+)\1" />
<Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="$1" />
<Action type="3" message="1702" wParam="0" lParam="640" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
</Macro>
Now, let’s imagine you’re working on a Python script. Of course, each time you hit the TAB key, eight space characters are inserted
But, after some non-blank characters, you’ll be able, at any location, to insert a true TAB of eight chars, in current line, using the ALT + T shortcut of the macro.
#00000000111111111222222222233333333334444444444555555555566666666667777777777
#23456789012345678901234567890123456789012345678901234567890123456789012345678
# This is an example to see how it works
# This is an example to see how it works
# This is an example to see how it works
...
Click on the
View > Show Symbol > Show All Characters option to easily see the
tabulations
As you can verify, each Tab character always ends, as expected, at position 8 × k, whatever the value of the integer k
At any moment, if you want to get the true indentation of your Python script :
Select ALL the part of text, not already modified
Press the Alt + I shortcut, once only
Thus, the above example becomes :
#00000000111111111222222222233333333334444444444555555555566666666667777777777
#23456789012345678901234567890123456789012345678901234567890123456789012345678
# This is an example to see how it works
# This is an example to see how it works
# This is an example to see how it works
...
And, indeed, the leading indentation is, now, always equal to 4 × n, whatever the value of the integer n
However, the inserted tabulations remain tabs every 8 chars !
If we suppose that, instead, you’re working on a C-like program. Again, each time you’ll hit the TAB key, eight space characters will be inserted
But, after some non-blank characters, you’ll be able, at any location, to insert a true TAB of eight chars, in current line, using the ALT + T shortcut of the macro.
//0000000111111111222222222233333333334444444444555555555566666666667777777777
//3456789012345678901234567890123456789012345678901234567890123456789012345678
// This is an example to see how it works
// This is an example to see how it works
// This is an example to see how it works
...
Again, each Tab character always ends, as expected, at position 8 × k, whatever the value of the integer k
At any moment, if you want to get the true indentation of your C-like program :
Select ALL the part of text, not already modified
Press the Alt + I shortcut twice ( So Alt + I, Alt + I )
Then , the above example becomes :
//0000000111111111222222222233333333334444444444555555555566666666667777777777
//3456789012345678901234567890123456789012345678901234567890123456789012345678
// This is an example to see how it works
// This is an example to see how it works
// This is an example to see how it works
...
And, indeed, the leading indentation is, now, always equal to 2 × n, whatever the value of the integer n
However, the inserted tabulations remain tabs every 8 chars !
To summarize, it’s rather a tricky work-around. However, it’s a semi-automatic way to get, at the same time :
The correct leading indentation for your C-like programs and Python scripts
The correct insertion of a true TAB character of eight characters size, at any position, after the leading indentation
That you expect to ! Just experiment ;-))
Best Regards,
guy038