How can I convert tabs to spaces and vice versa in an existing file

后端 未结 4 1440
余生分开走
余生分开走 2021-01-30 02:48

I cannot figure out how to do this for the life of me apart from doing a find-replace on 4 spaces and converting to tabs (Version 0.10.2). I can\'t think of an editor/I

相关标签:
4条回答
  • 2021-01-30 03:17

    If you are trying to convert non-leading tabs to spaces (or vice versa) you can use a regex search and replace.

    1. Press CTRL + H
    2. Click the .* button to search using regular expressions.
    3. To search for tabs enter [\t] in Find box.
    4. Enter spaces in Replace box and perform your replace.

    Search box in regex mode:

    0 讨论(0)
  • 2021-01-30 03:19

    Since fix of: https://github.com/Microsoft/vscode/issues/1228 the editor supports it out of the box. Simply go for:

    1. F1,
    2. indentationToSpaces or indentationToTabs (depending on your need)
    3. Enter.
    0 讨论(0)
  • 2021-01-30 03:29
    1. Select Replace: CTRL-H
    2. Enter Horizontal Tab in Find box: hold ATL and type 009 on the keypad.
    3. Enter a space(or more spaces) into the Replace box: press space bar
    4. Press Enter to begin replacing Tabs with Space(s).
    0 讨论(0)
  • 2021-01-30 03:30

    Another way to do it is click the current indentation (Tab/Spaces:n) on the footer which will open your indentation options where you can select what you want to do.

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