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 9174657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:47:20+00:00 2026-06-17T16:47:20+00:00

In Ruby there is a gem called interactive_editor which allows entering a vim session

  • 0

In Ruby there is a gem called interactive_editor which allows entering a vim session when entering vi in Ruby interpreter.

Literally we need to require interactive_editor.rb in ~/.irbrc file, like this:

require '~/interactive_editor.rb'

And we are done. When we do vi in interactive session; vim is launched. As soon as we quit the editor, the code inside the vim session is executed. Here is more information about running vim within irb.

So, is there any equivalent to that in Python?

  • 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-17T16:47:21+00:00Added an answer on June 17, 2026 at 4:47 pm
    from os import system as sh
    def vim(fname): sh('vim ' + fname)
    

    A possible way of (re)loading the module:

    import imp
    from os import system as sh
    
    def _vim(fname, globs):
        sh('vim ' + fname)
        (dirname, _, basename) = fname.rpartition('/')
        modname = basename.rpartition('.')[0]
        m = imp.load_source(modname, fname)
        globs[modname] = m
    

    and anytime you import this into the interpreter, it is recommended to make a wrapper manually:

    def vim(fname): _vim(fname, globals())
    

    because globals() called in a python file holds the file’s globals, not the interpreter’s. I know, it’s not elegant. But I’d recommend to reload module manually like reload(modname), it gives you more control, though may be tedious.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I love to use bpython but in Ruby there is a gem called interactive_editor
Is there a Ruby gem which can be used to create a Google Slideshow
Is there a gem in Ruby which can write to an Excel file, with
Background: I'm using a ruby gem called bane which in turn uses GServer to
Is there a gem that allows us to write Ruby code in Rails with
Is there any gem/plugin for ruby on rails which gives the ability to define
Is there any ruby gem/ rails plugin available for parsing the resume and importing
Is there a ruby gem or such for MySQL connection pooling that isn't part
Is there a ruby gem that will format dates relative to the current time?
Is there a gem or a library to get ruby 1.9 methods like [1,

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.