How do you quit the Vi editor with single keypress

2019-04-06 21:49发布

Because honestly

:wq!

is just too much to type.

Please note that the question is about original Vi (say Vi which comes with FreeBSD) not Vim.

7条回答
Explosion°爆炸
2楼-- · 2019-04-06 22:38

This seems to work on solaris' old version of vi:

Version SVR4.0, Solaris 2.5.0

$ vi -c "map g ZZ" test

edit: Also, this seems to work:

$ vi -c 'map g :q!^M' test

Where ^M is actually, ^V (ctl-v) then ^M (ctl-m)

查看更多
登录 后发表回答