In Eclipse, how can spaces behave as tabs?

前端 未结 4 1105
独厮守ぢ
独厮守ぢ 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    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

提交回复
热议问题