Solved

HOw to create a function in VIM?

Posted on 2011-03-13
11
541 Views
Last Modified: 2013-12-13
I would like to create a function which will be available for a particular file type. Inside this function I would like to execute ":v/search pattern/d" and ":s/search pattern/substitution/g" commands. How to write such a function in _vimrc file and how to invoke this function when needed?
0
Comment
Question by:zzzy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 35176064

Seems you are too lazy to even Google it.
0
 
LVL 41

Expert Comment

by:graye
ID: 35184993
I'm confused... are you trying to add a function to VIM?  ... or are you trying to perform a VIM-like substitution function within your own program?

Please tell us more about what you're trying to do...
0
 

Author Comment

by:zzzy
ID: 35235227
I'm trying to create a function/macro which would perform combinations of line deletes and substitions. Then I would like to map that function so that I can do this task in one key-stroke.
0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 500 total points
ID: 35241708

Check put this example.
0
 

Author Comment

by:zzzy
ID: 35300212
Thanks MikeOM, this should help. I'll let you know how it goes.
0
 

Author Comment

by:zzzy
ID: 35300398
Hi MikeOM,

I'm not lazy. I tired to go through the VIM help files and also tried googling for some samples. I even tried writing some functions. Unfortunately I didn't find what I was looking for. I've learned it a hard way that sometimes it is better to ask for help.

Thanks
SG
0
 
LVL 27

Expert Comment

by:Tolomir
ID: 35810120
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
In this article we have discussed the manual scenarios to recover data from Windows 10 through some backup and recovery tools which are offered by it.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question