I'd like to assign [[ to leader[ and ]] to leader].

I've tried the obvious:

let mapleader=" "
nnoremap <leader>[ [[
nnoremap <leader>] ]]

but the former mapping doesn't work.

I've tried with just those lines in _vimrc, and can reproduce this on both Vim8 on windows and Neovim (reasonably recent build from source) on RHEL.

Note: The obvious duplicate question doesn't apply to this one because I have no problem when not using the leader key.

  • Almost exactly duplicate in the sense that this answer should explain the behavior you are seeing and give you a possible solution vi.stackexchange.com/questions/13273/…
    – Mass
    Sep 14 '17 at 16:07
  • That answer doesn't mention leader keys, and I have no problem performing a non-leader mapping, so I'm not sure it's relevant.
    – user859
    Sep 14 '17 at 16:10
  • You need nmap not nnoremap.
    – Mass
    Sep 14 '17 at 16:10
  • The code given works for me. Try starting vim with vim -u NONE and see if the problem persists.
    – Tumbler41
    Sep 14 '17 at 16:11
  • @Mass Why would he need to take out nore?
    – Tumbler41
    Sep 14 '17 at 16:11

Your Answer

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