Vi Map Keys


Are there a combinations of key strokes you constantly enter?



Maybe you are a Java programming! 🙂 Or PHP/Perl – either way if you are using vi a lot, these tips could be worth your pc’s weight in gold. 😉



To create a one time map (of any key), just run this within vi:

:map #1 :!echo hey mapped f1^M

You need to hold down control and hit m to get the return, so this will run itself (no enter required).

To see current maps, just type :map

To make it permanent, just add same syntax to $HOME/.exrc

I think another good tip, is to map f1 to cat the exrc – like this:

:map #1 :!cat $HOME/.exrc^M

Then map #2, 3, 4 …



[tags]vi, macros, Unix Coding School[/tags]


If you have found my website useful, please consider buying me a coffee below 😉

Leave a Reply

Your email address will not be published. Required fields are marked *