gpt4 book ai didi

bash - 在 vim 命令行模式下 : how to kill the line from the current cursor position to the end

转载 作者:行者123 更新时间:2023-11-29 09:14:38 28 4
gpt4 key购买 nike

<c-k>: kill-line bash 的特性,意思是 kill 从当前光标位置到行尾的行。如何在 vim 中执行此操作编辑命令时的命令行模式?

例如:
输入时 :echo 'hell|o world' vim 中的此命令命令行模式,光标在|位置,怎么杀线变成:echo 'hell

最佳答案

我找到了 this key binding in Shougo's vimrc设置 Ctrl+k 删除直到行尾:

" <C-k>, K: delete to end.
cnoremap <C-k> <C-\>e getcmdpos() == 1 ?
\ '' : getcmdline()[:getcmdpos()-2]<CR>

请注意,这不会像 bash 或 Emacs 中的等效绑定(bind)那样将行的其余部分保留在寄存器中。

检查 :h eval 以获取有关您可以在命令行上执行的操作的更多帮助。

关于bash - 在 vim 命令行模式下 : how to kill the line from the current cursor position to the end,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26310401/

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