Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

HOw to create a function in VIM?

Posted on 2011-03-13
11
Medium Priority
?
552 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
7 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 2000 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

I previously wrote an article addressing the use of UBCD4WIN and SARDU. All are great, but I have always been an advocate of SARDU. Recently it was suggested that I go back and take a look at Easy2Boot in comparison.
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…

772 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