Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resetting all key maps in Vim

Tags:

vim

Is there a command that resets key mappings to their default values?

For all of them, not just for one key.

or a plugin maybe?

like image 217
iLemming Avatar asked Feb 21 '14 20:02

iLemming


People also ask

How do I Unmap a key in Vim?

On vim , command-mode keys can be mapped through the ex command :map <key> <macro> and insert-mode keys can be mapped through :map! <key> <macro> . After mapped, the commands to remove the mapping from the command-mode keys and insert-mode keys are unmap <key> and unmap! <key> respectively.

How do you check if a key is mapped in Vim?

Use :map! and :map for manually set keys and :help 'char(-combination)' to find out which keys are already mapped in vim out-of-the-box(/out of your specific compiling options).

How do I map a key to a vim command?

Creating keymaps To map a sequence of keys to execute another sequence of keys, use the ':map' command. For example, the following command maps the <F2> key to display the current date and time. The ':map' command creates a key map that works in normal, visual, select and operator pending modes.


1 Answers

You can remove all mappings for certain modes by running some of the mapclear family of commands.

This is taken from :h mapclear

:mapc[lear]                     mapmode-nvo             :mapc   :mapclear
:nmapc[lear]                    mapmode-n               :nmapc  :nmapclear
:vmapc[lear]                    mapmode-v               :vmapc  :vmapclear
:xmapc[lear]                    mapmode-x               :xmapc  :xmapclear
:smapc[lear]                    mapmode-s               :smapc  :smapclear
:omapc[lear]                    mapmode-o               :omapc  :omapclear
:mapc[lear]!                    mapmode-ic              :mapc!  :mapclear!
:imapc[lear]                    mapmode-i               :imapc  :imapclear
:lmapc[lear]                    mapmode-l               :lmapc  :lmapclear
:cmapc[lear]                    mapmode-c               :cmapc  :cmapclear
                        Remove ALL mappings for the modes where the map
                        command applies.  {not in Vi}
                        Use the <buffer> argument to remove buffer-local
                        mappings :map-<buffer>
                        Warning: This also removes the default mappings.

One command to remove everything is

:mapclear | mapclear <buffer> | mapclear! | mapclear! <buffer>
like image 78
FDinoff Avatar answered Sep 30 '22 16:09

FDinoff