Wednesday, June 2, 2010

Plug maps and insert mode problems

Hi all,
I am trying to pass some of my keymaps to use the <Plug> syntax. But I am having some problems when doing it in insert mode maps.
I have the next maps for word deleting in inser mode:
inoremap <C-BS> <C-w>
inoremap <C-Del> _<Esc>mzew<BS>i<Del><Esc>v`z"_c

And I am trying to substitu them with this:
  noremap <unique> <script> <silent> <Plug>TdvimWordBackspaceI <C-w>
  noremap <unique> <script> <silent> <Plug>TdvimWordDeleteI _<Esc>mzew<BS>i<Del><Esc>v`z"_c
  imap <C-BS> <Plug>TdvimWordBackspaceI
  imap <C-Del> <Plug>TdvimWordDeleteI

For the first imap command I always got the text <Plug>WordBackspaceI, is there any way to pass the <C-w> sequence in insert mode using the <Plug> syntax?
For the second I got something similar, but I have this workaround:
  noremap <unique> <script> <silent> <Plug>WordDeleteI mzew<BS>i<Del><Esc>v`z"_c
  imap <C-Del> _<Esc><Plug>WordDeleteI
But would be much better to have a more clean solution which dont need to have _<Esc> in fron of the Plug tag.
My idea is to have just the <Plug>TdvimActionName in the {lhs} of all my keymaps no matter the mode, to keep things clean and put all the code in the <Plug>TdvimActionName definition.

Thanks




--
Un saludo
Best Regards
Pablo Giménez

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment