vim - 如何让 google cloud shell 在 vi​​m 中正确识别 Esc 键

标签 vim google-cloud-shell

Esc 键在 vim 中被大量使用,用于从插入、命令或可视模式返回到正常模式。当您在云壳上的 vim 内按 Esc 键时,光标会改变形状并且 vim 会阻塞。如果你连续按 Esc 键或者你点击光标本身然后 vim 再次工作。 我习惯于在 vim 中使用 Esc 键恢复正常,因此这使得在 cloud shell 上使用 vim 非常痛苦。

我不必使用 Esc 键(我可以使用 Ctrl+c 或 Ctrl+[ 并且它可以工作,除了横幅提示仍然声称 vim 在切换到 NORMAL 模式时处于 INSERT 模式)但是很难改变我的习惯。

vim cursor in INSERT mode just before pressing Esc key

vim cursor becomes hollowed out just after Esc is pressed but still in INSERT mode

NORMAL mode can be obtained by pressing Esc two or three more times and waiting

我研究过在 vim 中重新映射 Esc 键,但这会弄乱 vim,我会出现奇怪的行为(请参阅警告不要更改 Esc 键映射 How to disable Esc and cursor keys in vim )。

退格键在 vim 中也不起作用,但可以在 .vimrc 中修复:

inoremap <bs> <left><del>

如果 Esc 键映射没有修复,那么我将不得不强制自己学会不使用 Esc 键。 云外壳上 Esc 键的最佳替代方法似乎是 Alt+Space - 因为它会调用返回到 NORMAL 模式并关闭底部的 --INSERT 模式消息。

最佳答案

您必须(快速)按 Esc 键两次才能进入 ESC 模式。

关于vim - 如何让 google cloud shell 在 vi​​m 中正确识别 Esc 键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62705379/

相关文章:

windows - 如何在 Windows 下将 gvim 用于 svn 提交消息?

vim - 如何在 VIM 中递归使用 Global?

python - 如何在 Google App Store Cloud Shell 中配置 pycodestyle

Vim: w 按子字移动

vim - 如何在 ViM 中撤消 C-s C-x?

vim - 在Vim中将光标设置为垂直的细线

ubuntu - 基本 Docker 容器报告运行级别未知

google-cloud-platform - 有没有办法找到大于特定大小的 Google Cloud Storage Bucket 中的所有文件/对象?

mysql - 无法在 Cloud shell 上连接到本地 mysql

visual-studio-code - 通过 ssh 将 vscode 连接到 gcp cloud shell