问题:
If I'm using terminal and typing in a line of text for a command, is there a hotkey or any way to clear/delete that line? 如果我正在使用终端并为命令输入一行文本,是否有热键或任何方式来清除/删除该行?
For example, if my current line/command is something really long like: 例如,如果我当前的行/命令非常像:
> git log --graph --all --blah..uh oh i want to cancel and clear this line <cursor is here now>
Is there a hotkey or command to go from the above to: 是否有热键或命令从上面到:
>
? ?
Usually I will press the ↓ key, and if my current line is a brand new one on the history, that will clear it. 通常我会按↓键,如果我的当前行是历史上的全新行,那将清除它。 But if I'm going through my command history via the ↑ key and start editing or using those commands, ↓ will only change the prompt to the next newest command in history, so it doesn't work here unless I press ↓ multiple times. 但是如果我通过↑键浏览我的命令历史并开始编辑或使用这些命令, ↓只会将提示更改为历史记录中的下一个最新命令,因此除非我多次按↓,否则它不起作用。
解决方案:
参考一: https://stackoom.com/question/ec9Q/如何清除-删除终端中的当前行参考二: https://oldbug.net/q/ec9Q/How-do-I-clear-delete-the-current-line-in-terminal
来源:oschina
链接:https://my.oschina.net/u/3797416/blog/4337038