MrHnau
10-14-2005, 09:07 AM
I've found it useful to share with others some of the stuff I've stuck in my .exrc file, and to learn from others. Everyone has different stuff it seems :smirk:
I've found some of the following to be extremely useful.
map g ^[:e#^M
^[ is the code for escape, ^M is the code for enter. To enter a control character, you need to enter a control-V followed by the character you want in your file. For instance, ^[ would be control-V ESC.
I use this one all the time. It allows you to toggle between two files. Useful when having to cut and paste or compare two files. Do this when not in edit mode
map ^A ^[:%s/^[ ]*//g^M
In this case ^A is control A, do it when not in edit mode. I've found cutting and pasting between windows and a Vi editor can really screw up your formatting. This removes all preceeding spaces and tabs. The
[ ] actually contains a space and a tab. order is irrelevant.
ab teh the
one of my common typos when I'm typing fast. Stick in your favorite to cut back on edit times! Also can be used for abbreviations, eg
ab Jan January
Do this in edit mode.
map = ^[i#^[56a-^M^[
Enter a long comment line when not in edit mode. Modify it for your appropriate programming language/shell. If you want, you can program in a complete header if its normally uniform.
Anything anyone else would like to share?
MrH
I've found some of the following to be extremely useful.
map g ^[:e#^M
^[ is the code for escape, ^M is the code for enter. To enter a control character, you need to enter a control-V followed by the character you want in your file. For instance, ^[ would be control-V ESC.
I use this one all the time. It allows you to toggle between two files. Useful when having to cut and paste or compare two files. Do this when not in edit mode
map ^A ^[:%s/^[ ]*//g^M
In this case ^A is control A, do it when not in edit mode. I've found cutting and pasting between windows and a Vi editor can really screw up your formatting. This removes all preceeding spaces and tabs. The
[ ] actually contains a space and a tab. order is irrelevant.
ab teh the
one of my common typos when I'm typing fast. Stick in your favorite to cut back on edit times! Also can be used for abbreviations, eg
ab Jan January
Do this in edit mode.
map = ^[i#^[56a-^M^[
Enter a long comment line when not in edit mode. Modify it for your appropriate programming language/shell. If you want, you can program in a complete header if its normally uniform.
Anything anyone else would like to share?
MrH