i
to switch to insert mode.<Cv>
.<key>
or combo.- Vim prints the raw keypress / combo value.
Here (the Gnome terminal on Ubuntu 11.04), typing i<Cv>
, then <Alt>
, and then prints something similar to ^[,
, which means "Escape". The Alt
key (which I think you want to use for <Meta>
) is not recognized as <Meta>
and not as <Alt>
.
The immediate conclusion is that the CLI Vim does not like <M->
(and many terminal emulators do not handle it very well). Some terminal emulators allow you to map the <Alt>
key to Meta
, but this is not an ideal cross-platform solution (I use <Alt>
lot in Mac OS X to enter special characters).
On this machine
nnoremap ^[, :split<CR> " ^[ is <Cv><Esc>
does exactly what I think you want.
If you absolutely want to continue using <M->
shortcuts in both the GUI and the CLI, you will need to support two separate sets of shortcuts. If you have dozens of user mappings in your .vimrc
, this will quickly become a little difficult to manage.
This is why I think you should use mappings that work everywhere, like:
:nnoremap <leader>, :split<CR> :nnoremap <leader>. :vsplit<CR> :nnoremap <leader>/ :close<CR>
The <leader>
key is the default <leader>
, but I set it to <leader>
Please note that you do not need to use the <leader>key
, just displaying ,,
,.
and ,/
.
See :help <leader>
.
source share