errors with VI editor after mapped key setup in .exrc file
I have the following mapped commands to the K key in my .exrc file
map K :1,$s/^\s*[0-9]+\s//|1,$s/^\s*[0-9]+\n/\r/
The purpose of it is to remove any whitespace before the line number and after the number when a user has line numbers turned on and does a copy and paste.
Sample after paste:
1 1 text
2 2 text
3 3 text
4 4
5 5 text
will look like after commands run
1 text
2 text
3 text
4
5 text
If I copy the above command into the command line of VI it works as designed.
I'm having 2 problems that I would like help with. The first is when VI loads it only seems to load the first command into K. The second problem is that before the file opens I receive an error message that the pattern can't be found.
My question is how do I prevent VI from running this command at start, but still map it to the K key? Also how do I get the 2 commands to be mapped to the K key?
Thank you for any help,
Last edited by bilyboy65; 05-30-2012 at 12:51 PM.
Reason: I figured out one of my problems and discovered another.
|