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

  • Home
  • SEARCH
  • 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 262401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:30:45+00:00 2026-05-11T22:30:45+00:00

I have found the following command in AWK useful in Vim :'<,’>!awk ‘{ print

  • 0

I have found the following command in AWK useful in Vim

:'<,'>!awk '{ print $2 }'

Python may also be useful in Vim.
However, I have not found an useful command in Python for Vim’s visual mode.

Which Python commands do you use in Vim?

  • 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-05-11T22:30:45+00:00Added an answer on May 11, 2026 at 10:30 pm

    It’s hard to make useful one-liner filters in Python. You need to import sys to get stdin, and already you’re starting to push it. This isn’t to say anything bad about Python. My feeling is that Python is optimized for multi-line scripts, while the languages that do well at one-liners (awk, sed, bash, I could name others but would probably be flamed…) tend work less well (IMHO) when writing scripts of any significant complexity.

    I do really like Python for writing multi-line scripts that I can invoke from Vim. For example, I’ve got one Python script that will, when given a signature for a Java constructor, like this:

    Foo(String name, int size) {
    

    will emit a lot of the boilerplate that goes into creating a value class:

    private final String name;
    private final int size;
    
    public String getName() {
      return name;
    }
    
    public int getSize() {
      return size;
    }
    
    @Override
    public boolean equals(Object that) {
      return this == that
          || (that instanceof Foo && equals((Foo) that));
    }
    
    public boolean equals(Foo that) {
      return Objects.equal(getName(), that.getName())
          && this.getSize() == that.getSize();
    }
    
    @Override
    public int hashCode() {
      return Objects.hashCode(
          getName(),
          getSize());
    }
    
    Foo(String name, int size) {
      this.name = Preconditions.checkNotNull(name);
      this.size = size;
    

    I use this from Vim by highlighting the signature and then typing !jhelper.py.

    I also used to use Python scripts I’d written to reverse characters in lines and to reverse the lines of a file before I found out about rev and tac.

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

Sidebar

Related Questions

I have found some in the Cappuccino website (vim, textmate and SubEthaEdit), but not
I'm converting an application to use Java 1.5 and have found the following method:
According to what I have found so far, I can use the following code:
I found the following rather strange. Then again, I have mostly used closures in
So: I have the following function, adapted from a formula found online, which takes
I have not found a reason why Mac's find does not have the option
I have found following question: $0 (Program Name) in Java? Discover main class? but
I have tried the following command on my SVN Repository to clone only a
I have found that my HTML is, to be honest, very clunky. Small, simple
I have found some libraries or web services in PHP that does the job.

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.