Search code examples
vimvim-plugin

Rebinding Vim key in sexp-mappings-for-regular-people


I am using Tim Pope's Sexp Mappings For Regular People

I want to remap the slurp and barf commands that are currently bound to: >) and <) to: ctrl-alt right arrow and ctrl-alt left arrow -

I am using a Mac

How do I do this?


Solution

  • Tim's plugin doesn't allow further customization (and as the sexp-plugin defines buffer-local mappings, this isn't that trivial), so you have the following options:

    1. Directly change plugin/sexp.vim from Tim. Normally, this is a bad idea, but as these just provide remappings that presumably are quite stable, it may be fine for you.
    2. Write your own customization file, modeled after the one from Tim.

    In any case, you'd need the following commands:

    nmap <buffer> <C-A-Right>  <Plug>(sexp_emit_head_element)
    nmap <buffer> <C-A-Left>  <Plug>(sexp_emit_tail_element)
    

    Note that Ctrl + Alt + cursor keys may work in the GUI version, but probably not in terminal Vim.