deyilee
V2EX  ›  问与答

vscode 中 vim 的换行替换

  •  
  •   deyilee · Jul 1, 2020 · 2944 views
    This topic created in 2321 days ago, the information mentioned may be changed or developed.

    一直习惯在 vscode 中使用 vim 模式,但是有个问题直接很困扰,就是无法替换换行符。

    比如在 normal 模式下,我可以匹配换行符“/\n”,但是无法替换换行符“:%s/\n/qwe/g”。

    请问有人知道怎么在 vscode 的 vim 模式下替换\n 吗?

    8 replies  •  2021-01-26 15:47:09 +08:00
    JackieMe
    JackieMe
    Jul 1, 2020
    1
    Debian 下试了一下我可以哈

    ```
    VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May 12 2020 02:37:13)
    Included patches: 1-716
    Modified by [email protected]
    Compiled by [email protected]
    ```
    Guosch
    Guosch
    Jul 1, 2020 via Android
    2
    替换的时候试试用 \r 匹配换行符
    justgodlike1993
    justgodlike1993
    Jul 1, 2020
    3
    试试 %s/\r\n//g 或者%s/\r//g
    volvo007
    volvo007
    Jul 2, 2020
    4
    同意楼上,win/Linux/Mac 的换行符都不同,win 下可以试试 \r\n
    deyilee
    deyilee
    OP
    Jul 3, 2020
    5
    @volvo007 都不行哦...
    deyilee
    deyilee
    OP
    Jul 3, 2020
    6
    @justgodlike1993 都不行哦...
    deyilee
    deyilee
    OP
    Jul 3, 2020
    7
    @Guosch 都不行哦...
    xianyukang
    xianyukang
    Jan 26, 2021
    8
    vscode 总是有各种让人抓狂的毛病 (让强迫症想砸屏幕的垃圾设计)
    ① vscode vim 不支持换行符 :%s/\n/fuck/g 替换
    ② vscode 的 ctrl+z 撤销粒度太大, 撤销过头了, 又得重写一遍
    ③ vscode 不支持关闭程序重启后恢复 undo history (vim 就能通过设置支持)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1606 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 12:54 · PVG 20:54 · LAX 04:54 · JFK 07:54
    ♥ Do have faith in what you're doing.