3

Using vim for editing latex; how can I bind C-Enter? I tried the following, which does not work:

imap <C-Enter> \\<CR>

and

imap <C-Return> \\<CR>

However, something like:

imap <C-i> \\<CR>

Does work.

Any ideas are suggestions for vim latex-addons?

3 Answers 3

7

I'm guessing you're using Vim inside a terminal, since I was able to map <C-Enter> successfully in the GUI versions of both MacVim on OS X and gVim on Windows:

:imap <C-Enter> I just pressed Control+Enter<CR>

If you're using the terminal version of Vim, then Vim is at the mercy of whatever keycodes the terminal provides. In some terminals, pressing Control+Enter looks exactly the same to Vim as pressing Enter alone, so Vim never really sees the keystroke you're trying to send it.

See this older Stack Overflow question for additional discussion:

https://stackoverflow.com/questions/598113/can-terminals-detect-shift-enter-or-control-enter

1
  • The accepted answer of the linked question gives a solution which worked for me: imap <C-J>. Jan 12, 2014 at 14:31
0

Try

imap <C-CR> \\<CR>
1
  • I'm afraid this does not work either.
    – mtkoan
    Apr 29, 2010 at 16:16
0

To get it to accept a control character, such as Enter, try typing Ctrl + V followed by Enter.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .