Solved

HOw to create a function in VIM?

Posted on 2011-03-13
11
481 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
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now