When i try to run some commands like :make or :!ls , it shows the output in an altogether different screen/view and the file i am editing is not visible during this process. Is there anyway i can still see my file and edit, while the command that i executed can probably run in a window at the bottom, probably the quick fix window?


If you are using vim 8 or neovim, maybe you would like to try :

http://github.com/skywind3000/asyncrun.vim ,

Nice replacement to vim-dispatch with much better user experience.

enter image description here

  • Easy to use, just start your background command by :AsyncRun (just like old "!" cmd).

  • Command is done in the background, no need to wait for the entire process to finish.

  • Output are displayed in the quickfix window, errors are matched with errorformat.

  • You can explore the error output immediately or keep working in vim while executing.

  • Ring the bell or play a sound to notify you job finished while you're focusing on editing.
  • Provide corresponding user experience in vim, neovim, gvim and macvim.
| improve this answer | |

You could use vim-dispatch plugin for asynchronous build (make).

or if you simply want shell command result in a quickfix window you coud use in ex-mode:

:cexpr system('ls -alh') | copen

even better, add this to you .vimrc

command -nargs=+ Run :cexpr system('<args>') | copen

and run in ex-mode:

:Run ls -alh
| improve this answer | |

That behavior is totally normal. CLI Vim doesn't come with a terminal emulator and will never do. GUI Vim comes with a dumb terminal emulator, though, and I think that's what you "remember long back".

You need a plugin for running commands in a separate Vim window. ConqueTerm is the only name I can remember at the moment but I think there are one or two others.

| improve this answer | |
  • Can you run vim inside ConqueTerm? – user1686 Feb 28 '13 at 14:31
  • 1
    Haha. I don't even want to know. – romainl Feb 28 '13 at 14:44
  • @romainl I do not want it to run in a separate shell. In a vim file, if i press : , it is being displayed in the last line in the monitor. Now, when i execute the command, let the command run in bash, but is there any way that the output be shown either in the last line again, or in a quickfix window? – woodstok Mar 1 '13 at 5:41
  • When you do :make and there are errors, those errors are always listed in the quickfix window. If you want the output of some arbitrary command to be displayed in the quickfix window you must read through :h quickfix.txt which tells you how to format the output of your commands for use in the qf. But I suspect a serious case of XY problem, here: displaying the output of some commands in the qf window is a mean, what exactly are you trying to achieve? – romainl Mar 1 '13 at 7:38

Like romainl said, this is the normal behavior. Vim does not store the output, acting like a pager it is only shown while the external command is executed. You could capture the command output in a scratch Vim buffer (:r !ls), use a plugin like the mentioned Conque, or split a shell window outside of Vim with the help of a terminal multiplexer like screen or tmux.

| improve this answer | |

Would splitting the vim windows work for you?

  • :split - splits window horizontally
  • :vsplit - splits window vertically

Then you can use of the windows just for editing the file and the second one for executing via :make.

| improve this answer | |
  • 1
    No, i remember long back, in another system that the output used to come automatically in a small horizontal window at the bottom. I just dont know why its currently going to a different shell when this is executed... – woodstok Feb 28 '13 at 12:19
  • @MIkhail: You could use Vim within a terminal multiplexer such as tmux to get similar functionality. – Daniel Andersson Feb 28 '13 at 13:02
  • @DanielAndersson I live and sleep in tmux :). But, :make in vim helps me in jumping to line numbers with errors, which wont be there if i run make in another window. – woodstok Feb 28 '13 at 13:08
  • You can run make in the background or in another terminal and save the output to a file, then when it's done, read that file into the quickfix – garyjohn Feb 28 '13 at 15:36
  • ... list with :cfile. See :help :cfile. [First comment timed out.] – garyjohn Feb 28 '13 at 15:46

You may be looking for ex-mode. If you type Q in normal mode you will get a command prompt style buffer at the bottom of the window.

More information here: http://vimdoc.sourceforge.net/htmldoc/intro.html#Ex-mode

| improve this answer | |

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.