Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8041199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:08:06+00:00 2026-06-05T04:08:06+00:00

I recently needed to wrap listings in a LaTeX document I was working on

  • 0

I recently needed to wrap listings in a LaTeX document I was working on in a minipage environment. Essentially, to insert some text before and after each line in a file that matched. To do this I used the following sequence of commands:

:g/lstinputlisting/:norm O\begin{minipage}{\textwidth}
:g/lstinputlisting/:norm o\end{minipage}

While this gave the result I desired it seemed clunky to have to enter two separate commands, both operating on the same matched line. Is it possible to execute multiple commands on the same line or is the repeated command really necessary?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:08:08+00:00Added an answer on June 5, 2026 at 4:08 am

    To wrap:

    lstinputlisting
    

    with tags:

    \begin{minipage}{\textwidth}
    lstinputlisting
    \end{minipage}
    

    You can use this command:

    :%s/lstinputlisting/\\begin{minipage}{\\textwidth}\r&\r\\end{minipage}
    
    • \r is new line.
    • & is search pattern.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently I was working with some strings, text input, things like that and I
I was recently working on a project where I needed to convert a regular
Recently I've been working on some embedded devices, where we have some structs and
I recently needed to append some data to dynamically created LI elements . In
Till recently i've needed to run the dev environment for my Heroku (postgres) app
I recently needed to strip some changesets from my Mercurial repository. I then tried
I've been learning python for some time now. Recently I needed to install in
While working in a Java app, I recently needed to assemble a comma-delimited list
I'm working on a c++ project, and we recently needed to include a small
Recently I needed to do some more advanced tweaking in our MSBuild/VS2008-based build system.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.