I'm trying to get the same setup as the guy in this video, so that when :!pytest % gets called, the output is colored.

I've tried with various vanilla colorschemes, with no luck...

I'm using NVIM, with TERM=st-256color (tried setting to xterm-256), but got nowhere... :(

EDIT: Output in terminal

Output in NVIM

  • Hi, welcome! Is the output different if you run pytest in your terminal directly? If not, this is not about vim, but most likely about your terminal itself, or your command. – Biggybi Feb 12 at 9:39
  • Hi @Biggybi, thank you for the warm welcome! I've added pictures showcasing the issue. – eltbus Feb 12 at 9:50
  • The video is on Vim, not Neovim. – Matt Feb 12 at 10:41

The video shows Vim, not Neovim. In Neovim the output of "bang" is not colorized.

If you like long stories you can read this and this and so on.

TL;DR they think it's not a big deal, but fixing "bang" may be too hard, so just use :terminal instead.

  • Love long stories! Thank you so much Matt! – eltbus Feb 12 at 11:02
  • Hi Matt, I've figured how to solve the issue. Would you consider adding the following to your answer? From: vi.stackexchange.com/questions/15535/… Adding autocmd TermOpen * startinsert to your .vimrc (or init.vim for NVIM users), makes terminal behave the same as "bang", such that it will exit on <CR> – eltbus Feb 12 at 11:28
  • That, combined with your answer (using :terminal), fixed it for me without "behaviour" changes (except some tweaking to split instead of open a full buffer) – eltbus Feb 12 at 11:31
  • @eltbus This is rather your personal preference. In general, you don't have to enter insert mode in order to close terminal. Just press ZZ or such, just like any normal buffer. On split, something like :split +term will do in Neovim. – Matt Feb 12 at 11:59
  • But ":terminal" by itself behaves differently than "bang" output wise. Still, I have to agree. It's a personal choice. – eltbus Feb 12 at 12:25

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.