Closed ghost closed 2 years ago
Same thing here, and I would like to know how to change the behavior as well.
I have the following command:
FloatermNew python3 %
And the floaterm closes at the end. Some versions ago (don't know which one though), the window would stay open after the execution of the code, which was helpful to see if there was a problem.
Environment
checkhealth as below
======================================================================== ## common - INFO: Platform: linux - INFO: Nvim: NVIM v0.6.1 - INFO: Plugin: 6244d17 ## terminal - OK: Terminal emulator is available ## floating - OK: Floating window is available
Configurations related to vim-floaterm
" Set floating window border line color to cyan, and background to orange hi FloatermBorder guibg=orange guifg=gray hi FloatermNC guibg=gray nnoremap <silent> <leader>n :FloatermNew<CR> tnoremap <silent> <leader>n <C-\><C-n>:FloatermNew<CR> nnoremap <silent> <leader>k :FloatermPrev<CR> tnoremap <silent> <leader>k <C-\><C-n>:FloatermPrev<CR> nnoremap <silent> <leader>j :FloatermNext<CR> tnoremap <silent> <leader>j <C-\><C-n>:FloatermNext<CR> nnoremap <silent> <leader>t :FloatermToggle<CR> tnoremap <silent> <leader>t <C-\><C-n>:FloatermToggle<CR> "nnoremap <silent> <A-k> <C-\><C-n>:FloatermKill<CR> tnoremap <silent> <A-k> <C-\><C-n>:FloatermKill<CR>
question
I am using floaterm.I want to set
<F5>
as the key to compile c file in the floaterm.And this is the setting:noremap <F5> :call CompileRunGcc()<CR> func! CompileRunGcc() exec "w" if &filetype == 'c' FloatermNew gcc -ansi -Wall % -o %< && time ./%< endif endfunc The :FloatermNew is the one of the options to open floaterm
When I press
<F5>
,it does compile in the floaterm.But the floaterm disappear in a moment.So i want to know how to let it compile and the floaterm is still there to show me the outputs.Forgive me for not being able to give you a screenshot bacause it cannot be captured.
try this in init.vim:
let g:floaterm_autoclose = 0
Hi @thedawnboy @joolof @MetalInMyVeins Sorry for the late response, but you can use --autoclose
along with :FloatermNew
.
noremap <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
- FloatermNew gcc -ansi -Wall % -o %< && time ./%<
+ FloatermNew gcc --autoclose=0 -ansi -Wall % -o %< && time ./%<
endif
endfunc
The :FloatermNew is the one of the options to open floaterm
- FloatermNew python3 %
+ FloatermNew --autoclose=0 python3 %
try this in init.vim:
let g:floaterm_autoclose = 0
Note that this approach also works but it will apply autoclose
to 0
for all :FloatermNew
without explicit autoclose
flag.
Environment
checkhealth as below
Configurations related to vim-floaterm
question
I am using floaterm.I want to set
<F5>
as the key to compile c file in the floaterm.And this is the setting:When I press
<F5>
,it does compile in the floaterm.But the floaterm disappear in a moment.So i want to know how to let it compile and the floaterm is still there to show me the outputs.Forgive me for not being able to give you a screenshot bacause it cannot be captured.