- AuthorPosts
- February 22, 2009 at 1:27 am #6950urlwolfMember
Hi,
For python, mixing tabs and spaces is bad.
So most python coders use the ‘tabs to spaces’ option.
However, that makes it very inconvenient to delete indetation.Vim solves the problem with ‘smarttabs’:
“‘smarttab’ ‘sta’ boolean (default off)
global
{not in Vi}
When on, ain front of a line inserts blanks according to
‘shiftwidth’. ‘tabstop’ or ‘softtabstop’ is used in other places. A
will delete a ‘shiftwidth’ worth of space at the start of the
line.”Can we have this?
Thanks
February 23, 2009 at 9:51 am #6971zhouzh2ParticipantHi,
Emeditor has “tabs to spaces” function.
just for fun, I write a macro for a smart del feature://SmartTab4python by zhouzh2
document.selection.CharLeft(true,1);
document.selection.CharLeft(true,1);
document.selection.CharLeft(true,1);
document.selection.CharLeft(true,1);
if (document.selection.Text == " ")
{
document.selection.Delete(1);
}
else
{
document.selection.CharRight(false,1);
document.selection.DeleteLeft(1);
}
assign “backspace” to this macro in Python configuration will do what you want.
note this macro works only when a tab means 4 spaces. If not, you can change this macro accordingly.
P.S. It works a little slow, so i think a plug-in should be a better choose. - AuthorPosts
- You must be logged in to reply to this topic.