Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
554 views
in Technique[技术] by (71.8m points)

vim - What's the difference between Ctrl+C and Ctrl+[?

What's the difference between Ctrl+C and Ctrl+[? The documents contain the following that I can find:

<Esc> or CTRL-[ End insert or Replace mode, go back to Normal mode.  Finish
                abbreviation.           
                Note: If your <Esc> key is hard to hit on your keyboard, train
                yourself to use CTRL-[.
CTRL-C          Quit insert mode, go back to Normal mode.  Do not check for
                abbreviations.  Does not trigger the |InsertLeave| autocommand
                event.
CTRL-C                  Interrupt current (search) command.  Use CTRL-Break on
                        MS-DOS |dos-CTRL-Break|.
                        In Normal mode, any pending command is aborted.

It seems there is some disagreement to what exactly the commands do.

Does Ctrl+C not also leave Replace mode, and how do abbreviations relate to pending commands?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It helps to think of CtrlC in vim the same way you think of CtrlC in a shell - you want to stop whatever you were doing ASAP and get control back. So in vim, if you're using CtrlC to break out of insert mode, vim isn't going to bother checking if you just wrote part of an abbreviation, and it isn't going to run the fancy auto commands your plugins have set up for every time you leave insert mode, it's just going to dump you back in normal mode as soon as it can. If you're not using abbreviations or autocmds, then you're not going to notice this difference.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...