Find and replace with a newline in Visual Studio Code

后端 未结 9 841
囚心锁ツ
囚心锁ツ 2020-12-04 04:43

I am trying out the new Microsoft Visual Studio Code editor in Linux Fedora environment. I would like to know how to replace new line (\\n) in place of some other text.

相关标签:
9条回答
  • 2020-12-04 05:38

    A possible workaround would be to use the multi-cursor. select the >< part of your example use Ctrl+Shift+L or select all occurrences. Then use the arrow keys to move all the cursors between the tags and press enter to insert a newline everywhere.

    This won't work in all situations.

    You can also use Ctrl+D for select next match, which adds the next match to the selection and adds a cursor. And use Ctrl+K Ctrl+D to skip a selection.

    0 讨论(0)
  • 2020-12-04 05:38

    On my mac version of VS Code, I select the section, then the shortcut is Ctrl+j to remove line breaks.

    0 讨论(0)
  • 2020-12-04 05:39

    In the local searchbox (ctrl + f) you can insert newlines by pressing ctrl + enter.

    If you use the global search (ctrl + shift + f) you can insert newlines by pressing shift + enter.

    If you want to search for multilines by the character literal, remember to check the rightmost regex icon.


    In previous versions of Visual Studio code this was difficult or impossible. Older versions require you to use the regex mode, older versions yet did not support newline search whatsoever.

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