Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6950

    urlwolf
    Member

    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, a in 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

    #6971

    zhouzh2
    Participant

    Hi,
    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.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.