Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vim

key

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?

like image 492
Matt Joiner Avatar asked Feb 17 '11 14:02

Matt Joiner


People also ask

What is the difference between Ctrl-C CTRL-Z and Ctrl D?

Ctrl-C : Program terminates immediately (causes SIGINT signal to terminate process) Ctrl-D : a = -1 , getchar() returns immediately. Ctrl-Z : a == '\n' `getchar() returns after newline (i.e. Ctrl-Z is ignored).

What does Ctrl-C actually do?

Alternatively referred to as Control+C, ^c, and C-c, Ctrl+C is a keyboard shortcut used to copy highlighted text or other object to the clipboard in a graphical user environment. On Apple computers, the keyboard shortcut to copy is Command + C .

What are the difference between Ctrl-C and CTRL-Z process )?

ctrl c is used to kill a process. It terminates your program. ctrl z is used to pause the process. It will not terminate your program, it will keep your program in background.

What signal does CTRL-Z send?

Ctrl-Z sends a TSTP signal ("terminal stop", SIGTSTP); by default, this causes the process to suspend execution. Ctrl-\ sends a QUIT signal (SIGQUIT); by default, this causes the process to terminate and dump core.


1 Answers

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.

like image 157
too much php Avatar answered Oct 10 '22 09:10

too much php