WestCoastProjects
WestCoastProjects

Reputation: 63042

Select a different keystroke than colon ':' to enter command-line mode in vi

Is there any way to achieve that remapping? I looked a bit into

map

and

inoremap

but they appear to affect within a given mode, not how to enter a given mode.

Upvotes: 3

Views: 464

Answers (1)

rphv
rphv

Reputation: 5537

You could use nmap, e.g.,

:nmap ; :

to map semicolon to colon. The 'n' in nmap indicates normal mode.

If you wanted to use, say, the <F2> function key to enter command-line mode from insert mode, you can do:

:imap <F2> <Esc>:

There's an exhaustive 3-part tutorial about key mappings in vim here.

Upvotes: 4

Related Questions