3

When using Gvim on Linux I can use :!ls to list files and directories 'in-line' in Gvim to navigate around the file structure and open files.

However, on Windows when using :!dir, a cmd window opens listing the files there. This is fine, but not as convenient as the in-line :!ls version. Is there a way to emulate this behavior with the Windows version of gvim?

  • 5
    I don't use Windows a lot, so don't have a direct answer; but a better alternative to using :!ls would be to just use :edit . (or :split ., :tabedit ., etc.). Vim includes a file manager plugin by default (netrw), which makes it much easier to do operations like opening files, etc. There are also some alternatives around in case you don't like netrw (e.g. NERDTree, dirvish, many more). – Martin Tournoij May 29 '17 at 22:27
4

You should use the Plugin AsyncRun. It allows the execution of external commands in the background as well as loading output back into a buffer or the quickfixlist. And it works well on Windows.

0

If you want to upgrade to Neovim, you can use :term. It will open a new split that can run a terminal emulator. You can set up an alias in your .vimrc so that it runs bash and thus has all of the basic commands that are native to a linux system.

edit: Now as of vim 8 you can use a terminal emulator as well, so neovim isn't necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.