如何从当前位置删除到行首?
How to delete from current position to the beginning of the line?
如何删除从光标当前位置到行首的所有内容?
例如,假设我是 运行 npm run start
并且我的光标位于 start
之前?如何使用离开 start
的键盘快捷键删除 npm run
?
~ npm run █start
我期待 ctrl+w 删除最后一个字的方式。同样,有没有快捷键可以从当前光标位置删除到行首?
我在 Mac 10.12 上使用 oh-my-zsh shell。
编辑:
这里有一些快捷方式 -
move to the start of line - ctrl + a
move to the end of line - ctrl + e
clear the word previous to the cursor - ctrl + w
clear text from cursor to the start of line - ctrl + r, by adding "bindkey \^R backward-kill-line" to your zshrc file
clear text from cursor to the end of line - ctrl + k
clear full line - ctrl + u
unix-line-discard (C-u)
Kill backward from point to the beginning of the line. The killed text is saved on the kill-ring.
看到man bash
也很有用。
如果你使用 zsh,你应该添加这一行:bindkey \^U backward-kill-line
到你的 .zshrc
。参见 this。
如何删除从光标当前位置到行首的所有内容?
例如,假设我是 运行 npm run start
并且我的光标位于 start
之前?如何使用离开 start
的键盘快捷键删除 npm run
?
~ npm run █start
我期待 ctrl+w 删除最后一个字的方式。同样,有没有快捷键可以从当前光标位置删除到行首?
我在 Mac 10.12 上使用 oh-my-zsh shell。
编辑: 这里有一些快捷方式 -
move to the start of line - ctrl + a
move to the end of line - ctrl + e
clear the word previous to the cursor - ctrl + w
clear text from cursor to the start of line - ctrl + r, by adding "bindkey \^R backward-kill-line" to your zshrc file
clear text from cursor to the end of line - ctrl + k
clear full line - ctrl + u
unix-line-discard (C-u) Kill backward from point to the beginning of the line. The killed text is saved on the kill-ring.
看到man bash
也很有用。
如果你使用 zsh,你应该添加这一行:bindkey \^U backward-kill-line
到你的 .zshrc
。参见 this。