I've added something like this to my .vimrc:

function! Map(mode, ...)
  if a:1== '<buffer>'
    let buffer = '<buffer> '
    let what = a:2
    let args = a:000[2:]
  else
    let buffer = ''
    let what = a:1
    let args = a:000[1:]
  endif
  if !has('gui_running')
    exec a:mode.'noremap 
'.buffer.substitute(substitute(what,'<m-\(.\)>','<esc>\1','g'),'<m-s-\(.\)>','<esc><s-\1>','g').'
 '.join(args,' ')
  else
    exec a:mode.'noremap '.buffer.what.' '.join(args,' ')
  endif
endfunction
command! -nargs=* Noremap call Map('', <f-args>)
command! -nargs=* Nnoremap call Map('n', <f-args>)
command! -nargs=* Inoremap call Map('i', <f-args>)
command! -nargs=* Vnoremap call Map('v', <f-args>)

So that I can use Noremap instead of noremap everywhere.

It replaces  <m-a> by <esc>a if there is no gui. This sucks but works
fine. At least I can share mappings this way.

Do you have better suggestions to get a similar result?
(I know about the suggestion made by LeoNerd..)
I'm thinking about which is the best way to add kind of hook to TOVL
so that I can apply the <m-a> to <esc>a conversion?
Maybe I should just map all <esc>char to <m-char> combinations?
How do you do this?

Sincerly
Marc Weber

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to