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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:03:41+00:00 2026-05-28T13:03:41+00:00

Inside Vim on Windows, I’m trying to filter the lines in a file through

  • 0

Inside Vim on Windows, I’m trying to filter the lines in a file through a shell executable. I’m using the following command:

:0,$!sort

The idea being that I’ll sort the lines of the file using the Windows sort command.

The issue is that I get nothing back so, effectively, all the lines in the file are deleted, i.e. they are replaced with nothing (I can recover all the lines using undo u).

Outside of Vim, the following command works fine:

type sort-lines.txt | sort

(“sort-lines.txt” is the test file that I’m working with in vim.)

I’ve tried this with the Windows sort command as well as with the Cygwin sort command. The results are the same.

Interestingly, if I use the following command in Vim:

:0,$!dir

The lines of the file are replaced with the output from the dir command. This makes me think that the external program is executing, but it isn’t correctly receiving the input lines from the file.

Is there something that needs to be adjusted in my configuration to make this work? I checked the value of Vim’s shellpipe option and it is set to:

shellpipe=>%s 2>&1

which doesn’t seem right to me.

  • 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-28T13:03:41+00:00Added an answer on May 28, 2026 at 1:03 pm

    Okay, I found the issue.

    I had an Autorun CMD script set in my registry. Whenever vim would spin up CMD to run the filter, the Autorun script would run and somehow block the piped-in data from getting in.

    To workaround the issue, I changed the value of the vim “shell” variable. Here is what I set it to.

    :set shell=C:\Windows\system32\cmd.exe\ /d
    

    The /d tells CMD not to run any Autorun scripts. The extra backslash after the “cmd.exe” is necessary in order to escape the space character between cmd.exe and the /d.

    With this setting in place, filtering works correctly.

    For a discussion of Autorun and the /d option see this MSDN article

    Thanks, Darcy, for pointing me in the right direction. (BTW, you have a great last name.)

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

Sidebar

Related Questions

I'm trying to find the name of the file I'm editing inside of Vim.
Inside a windows batch file I'd like to figure out what the fully qualified
I use the following Vim macro a lot (it puts the current line inside
Using vim I'm used to motion command like cit , dit , yit when
Inside Vim, is there a formatting command that would align a block of end
I have lines looking like: EXPORT var value From inside Vim, I want to
GVim on linux I use :!some command inside Vim often. I've just switched from
I'm aware of opening files in readonly mode from shell using vim -R ,
The question does not refer to some Vim-mode in Emacs, but to Vim inside
Inside my page, I have the following: <aspe:UpdatePanel runat=server ID=updatePanel> <ContentTemplate> <local:KeywordSelector runat=server ID=ksKeywords

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.