In a Vim script, how do I know which keys to use for my mappings, so

that the mapped key will not collide with an already used key? Vim uses most of the keys in the keyboard. You can use the <leader> prefix in maps to define keys which will not overlap with Vim keys. For example:

    :map S s

    :map j j

    :map k k

where by default <leader> gets substituted with a backslash (\), so the user would enter

        \s

        \j

        \k

to invoke the above map commands. The user can change the mapleader variable to be whatever they wanted:

    :let mapleader = ","

When writing a plugin or other script, more often than not, it is advisable to use :noremap instead of :map to avoid side effects from user defined mappings.

Read free Software Algorithms and Computer Science Books by CodeAhoy Learn.

Introduction to Recursion and Backtracking

Sorting Algorithms

Introduction to C Programming Language

And More...

Speak Your Mind