danchoi / vmail

a vim interface for gmail
http://danielchoi.com/software/vmail.html
MIT License
786 stars 60 forks source link

overriding/disabling conflicting keybindings #215

Open towc opened 5 years ago

towc commented 5 years ago

I use vim inside of tmux, and I set vim up so that when I press c-j/c-k, I go to whatever is below/above, either a vim window, or a tmux pane.

Vmail is overriding this by opening the previous/next email. I tried to put a bunch of stuff in vim_opts in the .vmailrc, but I can't seem to disable/re-override (ideally elegantly) these mappings. Any suggestions? What can I do?

Also, running :nunmap <buffer> <c-j> after opening vmail correctly restores the behaviour in that particular buffer, but I don't want to manually do that every time

notalex commented 5 years ago

The mapping is defined here: https://github.com/danchoi/vmail/blob/9ccbb5989bdb91d108bf974186935da5b863fa23/lib/vmail.vim#L864-L874

So if one wants vmail to not map c-j and c-k, they would need to add mappings for these <Plug>... functions in their .vimrc. For e.g. if you want only the <leader>j/<leader>k mappings to go to the next/previous message, define the following in your .vimrc:

  nmap <buffer> <leader>j <Plug>VmailMessageWindow_ShowNext
  nmap <buffer> <leader>k <Plug>VmailMessageWindow_ShowPrev

Let me know if this works for you.