In Eclipse, how can spaces behave as tabs?

前端 未结 4 1108
独厮守ぢ
独厮守ぢ 2021-02-07 06:23

I have replaced all my tabs by spaces in my PHP code source (and I configured Eclipse to use 4 spaces as tabs). When I hit tab, I get 4 spaces, that\'s OK.

相关标签:
4条回答
  • 2021-02-07 06:56

    After all this time, no solution.

    I'm considering this as impossible then : there is no solution.

    0 讨论(0)
  • 2021-02-07 06:57

    So... I also need that feature. Before a began to use Eclipse, I was a Vim user. Actually a still use it for some edit task. There is a vimplugin for eclipse, so you can use it as your Eclipse editor. But its a matter of taste.

    You can configure vim to do exactly that: Tab insert 4 spaces. Backspaces deletes indentations.

    Here the config for your settings:

    set tabstop=8       " This is the default in any editor, Tabs are 8spaces Wide"
    set expandtab       " Tabs are converted to spaces"
    set softtabstop=4   " Tabs are 4 spaces"
    set shiftwidth=4    " Indent is 4 spaces"
    " Here the magic"
    set backspace=indent,eol,start  " Deletes over indent, line breaks, edit starts"
    

    HTH

    0 讨论(0)
  • 2021-02-07 07:06

    Don't think there is a way to set it to delete the entire space indentation with backspace, but shift+tab should do what you want.

    0 讨论(0)
  • 2021-02-07 07:15

    9+ years later, space will behave as tab when it comes to deletion.
    With Eclipse 4.14 (part of the Eclipse 2019-12 simultaneous release, available December 18, 2019), you can use delete spaces as tabs

    See "Backspace/delete can treat spaces as tabs"

    If you use the Insert spaces for tabs option, now you can also change the backspace and delete keys behavior to remove multiple spaces at once, as if they were a tab.

    The new setting is called Remove multiple spaces on backspace/delete and is found on the General > Editors > Text Editors preference page.

    0 讨论(0)
提交回复
热议问题