V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
orangutan92
V2EX  ›  编辑器

Windows 如何在终端或 VSCode 等代码编辑器中,快速删除一个单词或一整行?

  •  
  •   orangutan92 · 11 天前 · 1296 次点击

    macOS 删除很容易,alt+backspace 就是删除单词,command+backspace 就是删除整行。

    而 win 只能用 ctl+backspace 删除一个单词,不能删除整行,有没有办法可以实现呢?

    26 条回复    2024-04-23 17:51:20 +08:00
    kaicity
        1
    kaicity  
       11 天前
    有 Delete Line 快捷键啊,我在 mac 的 IDEA 跟 VSCode 都找到了,Windows 应该也有
    qingbaihe
        2
    qingbaihe  
       11 天前   ❤️ 1
    Ctrl+w
    1191257428
        3
    1191257428  
       11 天前 via Android
    Esc
    NessajCN
        4
    NessajCN  
       11 天前
    装个 Vim 插件,dd
    czita
        5
    czita  
       11 天前   ❤️ 1
    Ctrl+x
    wkmike
        6
    wkmike  
       11 天前
    在 VS Code 中,你可以使用以下快捷键来删除当前行:

    Windows / Linux:
    删除当前行:Ctrl + Shift + K

    MacOS:
    删除当前行:Command + Shift + K
    nagisaushio
        7
    nagisaushio  
       11 天前 via Android
    Ctrl l 选中整行,backspace 删除
    luwang
        8
    luwang  
       11 天前
    VSCode 快捷键好像是这个 Ctrl + Shift + K
    body007
        9
    body007  
       11 天前   ❤️ 3
    个人习惯,在单词任意位置双击选中单词然后删除,在某行任意位置 3 击(三次单击)该行然后删除整行。

    autung
        10
    autung  
       11 天前   ❤️ 1
    dd
    juzisang
        11
    juzisang  
       11 天前
    我都是 Ctrl + X ,裁剪一行当删除用的
    vthe
        12
    vthe  
       11 天前
    pwsh 可以这样做
    vim $profile 添加`Set-PSReadLineOption -EditMode Emacs`
    然后就是和 linux shell 一样的了,Ctrl + w 删除一个单词,Ctrl + P ,Ctrl + F 都可以使用
    orangutan92
        13
    orangutan92  
    OP
       11 天前
    @luwang #8 这个可以,搜狗来捣乱了,呼出软键盘
    orangutan92
        14
    orangutan92  
    OP
       11 天前
    @body007 #9 这个确实可以,但是多点或者少点容易误触。另外终端的问题还是没有解决。
    Goooooos
        15
    Goooooos  
       11 天前
    Windows Terminal ( powershell ): ctrl+w 删除单词


    vscode : ctrl+backspace 删除单词, shift +del 删除行
    xyzmax
        16
    xyzmax  
       11 天前
    你需要入坑 vim 了,不管是终端、编辑器还是浏览器,凡是有输入地方都装上 vim 插件

    de 或者 dw 删除单词,dd 删除整行
    body007
        17
    body007  
       11 天前
    @orangutan92 #14 我用 windterm 终端,当前编辑的命令行,你可以当作文本框里面的文字编辑,支持双击和三击选择,还有从指定位置选择。记住当作文本编辑该命令行数据就行。

    yhxx
        18
    yhxx  
       11 天前
    我在 VSCode 里习惯直接 ctrl+x ,剪切光标所在行
    约等于删除
    body007
        19
    body007  
       11 天前
    @orangutan92 #14 你说容易误触,结果我试了连续多次点击,发现 4 击(四次单击)是全选,又解锁一种姿势,现在全选都是 Ctrl + A ,下次可以用鼠标 4 击了。
    jqtmviyu
        20
    jqtmviyu  
       11 天前
    cmd+L , 选中一行, 然后退格
    双击鼠标, 选中单词, 然后退格
    way2create
        21
    way2create  
       11 天前
    我直接剪切的
    noahlias
        22
    noahlias  
       11 天前
    noahlias
        23
    noahlias  
       11 天前
    建议看评论那个图
    luozic
        24
    luozic  
       11 天前
    vim mode 直接 dd ,全部在键盘上操作 or 搞啥按键组合上面,也就 vi /emacs 这两货了。
    subframe75361
        25
    subframe75361  
       11 天前
    和输入框一样,ctrl+a ,然后直接打字
    orangutan92
        26
    orangutan92  
    OP
       10 天前
    @subframe75361 #25 终端这个可以的,但不适用于 git bash
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1068 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 18:07 · PVG 02:07 · LAX 11:07 · JFK 14:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.