From 297936250fba38ea898aaff7e56b3a788ee27dab Mon Sep 17 00:00:00 2001 From: Alex Oliveira Date: Mon, 3 Jul 2023 21:33:35 -0300 Subject: [PATCH] [draft] trying to make colors work in Neovim --- plugin/smartest.vim | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/plugin/smartest.vim b/plugin/smartest.vim index 760e2ff..ce3b900 100644 --- a/plugin/smartest.vim +++ b/plugin/smartest.vim @@ -416,8 +416,17 @@ function! RunTests(filename) " exec ":!" . final_test_command " - " Using silent keyword will avoid the `Hit ENTER to continue` - exec "!" . final_test_command + " Experimenting with fixing Neovim terminal colors by using :term instead of + " :! + " + " if has("nvim") " nvim + " " Neovim has a bug in which :! doesn't output terminal colors + " exec "term " . final_test_command + " else + " Using silent keyword will avoid the `Hit ENTER to continue` + exec "!" . final_test_command + " endif + redraw! else echo "Don't know how to run tests. Define .smartest." . smartest_test_context @@ -425,7 +434,22 @@ function! RunTests(filename) else silent exec ":!echo " . smartest_test_description silent exec ":!echo " . smartest_test_command - exec ":!" . smartest_test_command + + " Experimenting with fixing Neovim terminal colors by using :term instead of + " :! + " + " if has("nvim") " nvim + " " Neovim has a bug in which :! doesn't output terminal colors + " " exec ":split | term " . smartest_test_command + + " let term_position = get(g:, 'test#neovim#term_position', 'botright') + " execute term_position . ' new' + " call termopen(smartest_test_command) + " au BufDelete wincmd p " switch back to last window + " startinsert + " else + exec ":!" . smartest_test_command + " endif endif endfunction