在 vi 中编辑内容时终端挂起

vip*_*169 14 gnome-terminal 12.04 vi

当我不小心按下Ctrl+S而不是:wq.

现在一切都悬而未决。我尝试Escape,:q!了各种 vi 命令,但没有任何响应。终端屏幕卡住了。我现在无法关闭终端会话,因为它会导致所有更改丢失。请建议应该怎么做

zwe*_*ets 26

Ctrl+Q将撤消Ctrl+ S。这些是古老的控制代码,用于停止和恢复到终端的输出。它们仍然很有用,例如,当您正在处理tailf日志文件和一些有趣的滚动时,但是这个无限回滚缓冲区的时代确实已经过时了。


小智 7

我想补充zwets 接受的答案

您可以通过发出命令stty -a和来查看特殊按键的含义man stty

stty -a打印终端的所有当前设置。我的终端中的结果:

speed 38400 baud; rows 33; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk > -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
Run Code Online (Sandbox Code Playgroud)

man stty打印stty手册。此处相关的部分:

特殊的角色:

   start CHAR
          CHAR will restart the output after stopping it

   stop CHAR
          CHAR will stop the output
Run Code Online (Sandbox Code Playgroud)