Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've added these two lines to my vimrc:

:nnoremap <silent><C-j> m`:silent +g/\m^\s*$/d<CR>``:noh<CR>
:nnoremap <silent><A-j> :set paste<CR>m`o<Esc>``:set nopaste<CR>

Upon saving and reloading the vimrc (:so $MYVIMRC), only the first binding works. The second does not work. The behavior I see is like the A-j just registers as a j, with the cursor moving down a line. My expected behavior is to see the a new line added below the cursor and a return to normal mode.

As context: I am using OS X's, and I have "Use option as meta key" turned on in its settings.

share|improve this question
Do you only want to use option as the meta key for vim, or for other purposes as well? – Dean Jun 27 '13 at 2:15
I'd want to get this working and then figure it out – dimadima Jun 27 '13 at 4:15
<A-> mappings don't work reliably across environments and, specifically in Mac OS X's terminal emulators (<A-> and <M-> are equivalent). Use a different approach, like :help mapleader. – romainl Jun 27 '13 at 5:32

I've never had any luck getting alt/meta working on OSX. However, you can just use the multi-byte character that is mapped to by default (when option as meta is not selected). In the case of option-j, it's .

:nnoremap <silent>∆ :set paste<CR>m`o<Esc>``:set nopaste<CR>
share|improve this answer

Your Answer


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.