On Wed, Nov 22, 2006 at 02:04:29PM +0100, A.J.Mechelynck wrote:
> DervishD wrote:
[snip]
> > I want to do something like that in my vimrc.
> >
> > delete_all_keys "if at all possible
> > map i i "yes, I want to go to insert mode
> > ...
> > ...
> > map <C-k>x w "Weird, but just an example
> >
> > So, if I don't have map'ed <C-w>+ and I hit it, the window size
> >won't change, but I still will be able to do this:
> >
> > map <C-+> <C-w>+
> >
> > Sorry if I haven't made it clear O:)))) and thanks in advance.
> >
> > Raúl Núñez de Arenas Coronado
> >
>
> - There is no simple command to unbind all keys. You can have one
> particular key have no effect by mapping it to <Nop> -- but beware of the
> risk of breaking the ":normal" command in scripts.
>
> - You may want to use ":noremap" rather than ":map". See ":help map.txt"
> for details.
>
> - BUT, I don't think you can map Ctrl-K. It is used for digraphs (see
> ":help digraphs") and (IIUC) cannot be mapped to anything else. As for
> Ctrl-+, that's not a "standard" control-key: I don't think Vim (which uses
> "cooked" keyboard input) would be able to recognise it reliably.
>
> I recommend that you learn the "vim" key bindings. (Until you learn them,
> you can use arrow keys, which are presumably portable; menus; and
> ex-commands.)
I agree that this is not necessarily a good idea, but there are a
few ways to map keys to <Nop> "in bulk."
let letter = "a"
while letter <= "z"
execute "map" letter "<Nop>"
let letter = nr2char(char2nr(letter) + 1)
endwhile
" Vim 7.0 only
for char in split("@!&#$%", '.\zs')
execute "map" char "<Nop>"
endfor
" Vim 7.0 only
for word in ['<C-W>', '<C-X>', '<C-A>']
execute "map" word "<Nop>"
endfor
A better solution might be to stay out of Normal mode.
:set insertmode
:help 'insertmode'
:help evim-keys
HTH --Benji Fisher