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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:02:35+00:00 2026-05-21T02:02:35+00:00

What are the possible operations (with keyboard shortcuts) that you could execute on a

  • 0

What are the possible operations (with keyboard shortcuts) that you could execute on a visually selected text? For the simplicity consider this simple piece:

   a  b  cd  1  p
   a  b  cd  2  y
   a  b  cd  3  t
   a  b  cd  4  h
   a  b  cd  5  o
   a  b  cd  6  n

One specific question: is it possible to execute Python/shell commands/scripts on selections?

A couple more specific questions:

1-) How to in-place sort the python column?

2-) How to switch place of columns?

3-) How to increment values? (say. only the numbers greater than 3 in selection)

Thanks.

  • 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-21T02:02:35+00:00Added an answer on May 21, 2026 at 2:02 am

    To do this correctly, you need to use filters and vim’s execution mode.

    A filter is any standard UNIX program (sort, awk, grep, cut, paste, sed …) that can read from stdin and write to stdout.

    Vim’s execution mode lets you read in or replace text with the output of a program. If you make a visual selection (say, using V or C-V), and hit :, your command prompt will immediately be :'<,'>, which means “Apply whatever command follows to the lines included in the visual selection.” At this point, you can write !foo to replace the text with the output of program foo.

    For example, to sort the text by the python column, select it, hit :, and enter !sort -k5. The whole command will look like :'<,'>!sort -k5 Running it will produce:

       a  b  cd  4  h
       a  b  cd  6  n
       a  b  cd  5  o
       a  b  cd  1  p
       a  b  cd  3  t
       a  b  cd  2  y
    

    For the other two tasks, awk is your friend. A command like :'<,'>!awk '{ print $1, $3, $2, $4, $5 }' is will flip the second and third columns (but note that inter-column spacing is collapsed). To increment columns, try something like :'<,'>!awk '{ sub($4, $4+1); print }'.

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

Sidebar

Related Questions

Is it possible to do +- operations like this somehow? BigInteger a = new
You are provided with four possible operations that can be done on the editor
It is possible in SQL Server Express have a log of all operations SELECT
In Java, is it possible to clear a bit using bitwise operations?
Possible Duplicate: The written versions of the logical operators. I notice that C++ define
Possible Duplicate: WPF and cross thread operations I am having trouble with a window
is it possible to select colums and do complex operations on them for example
Is it possible to combine a Django Haystack search with built-in QuerySet filter operations,
Lucene has Analyzers that basically tokenize and filter the corpus when indexing. Operations include
Possible Duplicate: When should I do certain SQLite operations on another thread(not the main

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.