gpt4 book ai didi

vim - 在 vim 中使用 block 选择从行尾删除

转载 作者:行者123 更新时间:2023-12-04 02:56:19 26 4
gpt4 key购买 nike

当我尝试在 vim 中使用块选择从行尾删除时出现异常行为。

所以假设我有一个这样的文本:

delete this char:x
and this:x
also this:x
and then this:x
lastly this:x

如果我想附加 y我能做到的每一行:
  • 使用 C-v 开始块选择
  • 选择所有带有 4j 的行
  • 使用 $ 转到行尾
  • 开始附加 A
  • 输入所需的文本 y

  • 为了得到:
    delete this char:xy
    and this:xy
    also this:xy
    and then this:xy
    lastly this:xy

    但如果我尝试删除 x在最后一步而不是追加我希望得到:
    delete this char:
    and this:
    also this:
    and then this:
    lastly this:

    虽然我最终得到:
    delete this char:
    and this:x:
    also this:x:
    and then this:x:
    lastly this:x:

    据我了解,它将第一行中的最后一个字符附加到所有其他行(在本例中为 : )而不是删除丢失的字符(在本例中为 x )。

    我可以用宏或替代品来做到这一点,但我不太明白这种行为背后的基本原理。有没有办法通过块选择来做到这一点?

    最佳答案

    你试过了吗:{range}normal ?这应该有效:

    :'<,'>normal $x

    ( '<,'> 位是在您输入 : 时为您填写的。)

    关于vim - 在 vim 中使用 block 选择从行尾删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14165566/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com