On my Mac, I put the following in my .vimrc to use ii as the key. Note, I include the : in the .vimrc file, i'm not sure if you're supposed to but it still works :)

:imap ii <Esc>

I'm now trying to setup Vim on my iPad (see http://applidium.com/en/applications/vim/). Since there's no Esc on the iPad, the developers who ported Vim mapped the Esc key to \, however \ is very inconvenient if you're using the native iPad keyboard (rather than the bluetooth), so I'm trying to remap it again in the .vimrc that I've imported into the iPad via iTunes.

I put this in the .vimrc, thinking I should remap the remap

`:imap ii \`

but it always types two i rather then enter command mode.

What should I put in the .vimrc to make the Vim enter command mode on the iPad by pressing ii. I'm not sure if something special has to be done to remap a remap.

the .vimrc file where ii mapping still prints ii rather than escaping

syntax on
set autoindent
set number
set tabstop=4
set shiftwidth=4
set expandtab
set ruler
set number

set incsearch
set ignorecase
set smartcase

let mapleader = "\<space>"
nmap <leader>h <C-W>h
nmap <leader>j <C-W>j
nmap <leader>k <C-W>k
nmap <leader>l <C-W>l
:imap ii <esc> 
  • If it were .exrc, the : would be required, but for .vimrc the : is optional. – Heptite Aug 31 '14 at 21:46

Just map it to <esc>:

:imap ii <esc>

Even though iDevices don't support the escape key, Vim still recognizes the notation for escape in mappings, etc.

  • I did what you suggested but it still prints ii everytime, no matter how quickly i press ii (note on my laptop I use ii mapping without problem). I posted the whole .vimrc file in the OP for you to see – BrainLikeADullPencil Aug 31 '14 at 22:19
  • That is very strange. What does the output of :scriptnames and :verbose imap ii show? – Heptite Sep 1 '14 at 0:05
  • I took a screenshot on the iPad of the output of those commands, see here dl.dropboxusercontent.com/u/10328969/vim.PNG – BrainLikeADullPencil Sep 1 '14 at 2:13
  • 1
    I was able to try testing it on my iTouch. So far I can't make it work no matter what I do. Looks like a bug, which isn't surprising considering how much the people who ported Vim had to do to make it work. – Heptite Sep 1 '14 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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