Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sometimes, when changing between the modes in Vim, I forget to take my finger off the Shift key. This innocent mistake is probably part of the luggage carried over from other terminals, but I have never seen my input treated this way.

After changing from command mode to input mode, if I hit the Esc key while the Shift key is down, Vim will display <9b> (Control Sequence Introducer) instead of switching to the command mode.

At least two work-arounds to this intended behavior are available on the mintty site (faq, issue).

" Avoiding escape timeout issues in vim
:let &t_ti.="\e[?7727h"
:let &t_te.="\e[?7727l"
:noremap <Esc>O[ <Esc>
:noremap! <Esc>O[ <Esc>

" Remap escape
:imap <special> <CSI> <ESC>

My question is about the syntax and the meaning of the first solution. From the looks of it, it seems like t_ti is being assigned a literal value, but I'm not sure why the "c address-of" operator is required. I'm also not sure why there are two noremap statements.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

t_ti and t_te are both Vim options. Values are normally assigned to them by using the :set command, as :set t_ti=abcde, where the right-hand side (abcde in this example) is a literal string. The :let command is more flexible than :set and can be used to set the values of other types of variables besides options. To distinguish options from other types of variables in this context, Vim prefixes option names with &. See

:help options
:help :let-&

From the second reference, you can also see that the .= operator appends the argument string to the variable on the left.

The :noremap command applies to mappings in the Normal, Visual and Operator-pending modes. The :noremap! command applies to mappings in all the other modes: Insert and Command-line. See

:help :map
:help :map!
:help mapmode-nvo
:help mapmode-ic

Vim's documentation of mapping is all in the map.txt file, found with :help map.txt. While Vim's documentation is generally very good, I find that particular section hard to follow. These sections may be more clear:

:help 05.3
:help 40.1
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.