Mapping EX commands in Vim


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Mapping EX commands in Vim
# 1  
Old 11-30-2010
Mapping EX commands in Vim

I got a lot of M$ .doc files converted to text that I got to edited.

Can you map EX commands into your .vimrc?

I use alot of them regularly but I get sick of typing them. I would like to map them to function keys <F3>, <F4>, <F5> and such.

I got this entry in my .vimrc to work:

Code:
map <F3> 1d

but this one doesn't work:

Code:
map <F4> $d

These don't work either:
Code:
map <F5> %s/^$/@/
map <F6> ggVGJ
map <F7> %s/@/\r\r/g|%s/^ //|%s/  / /g|%s/  / /g

I think it is the metacharacters that are tripping me up.

also "ggVGJ" is a VISUAL command, not an EX command. Can that be mapped?

I may be going about this the wrong way. Any help would be greatly appreciated.
# 2  
Old 11-30-2010
Don't forget the : if your are defining line-mode commands and put ctrl-M on the end (blue ^M is entered as ctrl-v ctrl-m).
Code:
map <F4> :$d^M
map <F5> :%s/^$/@/^M
map <F7> :%s/@/\r\r/g^M:%s/^ //^M:%s/ / /g^M:%s/ / /g^M



Note F6 worked fine for me (join whole document to 1 line)
This User Gave Thanks to Chubler_XL For This Post:
# 3  
Old 11-30-2010
awesome! that worked great! much thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Many to many -- mapping

INPUT 13333--TEXT1 14444--TEXT2 13333--TEXT3 12233--TEXT5 14444--TEXT5 12233--TEXT1 12222--TEXT5 13333--TEXT09 what I'm looking for is something using awk arrays with below given output. 14444--TEXT2,TEXT5 13333--TEXT1,TEXT3,TEXT09 12233--TEXT5,TEXT1 12222--TEXT5 (6 Replies)
Discussion started by: busyboy
6 Replies

2. UNIX for Dummies Questions & Answers

Mapping drive

please forgive me. i know this is unix forum. CIFS can map to shared windows folder. i just wonder if windows can map to unix shared folder. if yes, please enlight me... (5 Replies)
Discussion started by: lawsongeek
5 Replies

3. Shell Programming and Scripting

Mapping two files

I have a large comma delimited file from which i have to extract a specific column, compare it against a static file and replace the column value with the matching column from the static file. The following are the files: Main file: mainfile.csv test1234,,real,,,,open,,,,EU,,,,23/03/2012... (12 Replies)
Discussion started by: goddevil
12 Replies

4. Shell Programming and Scripting

Creating unique mapping from multiple mapping

Hello, I do not know if this is the right title to use. I have a large dictionary database which has the following structure: where a b c d e are in English and p q r s t are in a target language., the two separated by the delimiter =. What I am looking for is a perl script which will take... (5 Replies)
Discussion started by: gimley
5 Replies

5. Shell Programming and Scripting

Bit Mapping

Hi All, I am working on the Scenario where i need compare the integer value with other using bit mapping. input file, 1,4,5,4 1,2,4,6 2,3,4,4 like i have many fields. Script : i need to filter hte field one value "1" and field 3 value "4" and Filed 4 i need to do the Bitwise... (5 Replies)
Discussion started by: readycpbala
5 Replies

6. Shell Programming and Scripting

Pattern mapping

Dear Friends, Please help me on this I have file A.txt containing text lines as below grectec; 30 ,50, 60, base_123 ; top09 grectec; 30 ,55, 60, base_123 ; top09 grectec; 10 ,53, 60, base_123 ; top09 grectec; 50 ,57, 60, base_123 ; top09 ... ... another file B.txt containing test... (4 Replies)
Discussion started by: Danish Shakil
4 Replies

7. Solaris

Very Importan - Vim Settings - Error while opening a File using vim

I downloaded vim.7.2 and compiled the vim source . Added the vim binary path to PATH (Because iam not the root of the box) when i load the file using vim it throws me an error Error detected while processing /home2/e3003091/.vimrc: line 2: E185: Cannot find color scheme darkblue line... (0 Replies)
Discussion started by: girija
0 Replies

8. IP Networking

port mapping

Hello to all! I am new to this interesting forum. My questions is not totally related to unix/linux systems, but I am not finding proper place where to make my question and this forum seems to be visited by experts and unix/linux experts are epxerts in everything My ISP has two kinds of... (1 Reply)
Discussion started by: kallquk
1 Replies

9. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

10. UNIX for Advanced & Expert Users

kernel mapping...

> how the sendmsg and recvmsg calls will know which kernel module to use (SCTP, RTP etc.) internally(kernel mapping: how kernel handle socket call) (1 Reply)
Discussion started by: prangin
1 Replies
Login or Register to Ask a Question