Tuesday, May 30, 2017

How to prevent Vim from inserting function key names literally when in insert mode?


I'm using Vim on Ubuntu. When I press a function key in insert mode, the name of the key is inserted literally.


For example, if I'm in insert mode and I press Ctrl+F12, the following text is inserted . I have this key tied to a global shortcut key to trigger a Google search box. Furthermore, I can see no personal practical value to inserting the name of a function key into the file I'm editing.



  • How can I get Vim to not insert the name of a function key when a function key is pressed in insert mode?


Answer



Try this:


:map  
:map!

See:


:help :map
:help

However, I would assume that having a global shortcut key defined should "eat" the key events so Vim never sees them. Is it possible to tell your OS to behave that way for this binding? After all this probably only solves your problem for Vim, and not other applications.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...