David Unric
David Unric

Reputation: 7719

How to set Meta-Function key combination in Vim?

I'd need to redefine keyboard mappings of Vim in non-gui mode.

I simply don't understand why the following command does not work:

:set <M-F5>=^[[15~

"E518: Unknown option: <M-F5>=^[[15~"

whereas mapping of alone F5 key or Meta with non-function key does work:

:set <F5>=^[[15~

"ok"

:set <M-space>=^[[15~

"ok"

How to redefine Alt/Meta with function keys F1-F12 in Vim ?

Thx in an advance.

David

Update: Question correction In my .vimrc I have the following key-combination mapping

autocmd Filetype python noremap <buffer> <silent> <M-F9> :w !pylint -E %<CR>

but it does work only in gVim. It unfortunately does not work in non-gui version of Vim, because Vim recieves escape sequence "^[[20~" instead of direct Meta-F9 keycode.

Upvotes: 5

Views: 3189

Answers (1)

icyrock.com
icyrock.com

Reputation: 28598

Here's an example from Vim wiki:

inoremap <M-i> <Tab>

Take a look here:

In case that doesn't work, try this:

inoremap <ESC>i <Tab>

Note this is a hack and will yield a few wierd things that you will just probably have to live with.

For function keys, something like this should work:

nnoremap <ESC><F9> :ls<CR>

Upvotes: 2

Related Questions