" Autoload function for the internal terminal emulator. " Last Changed: 2021-07-28 " Author: Federico Igne " License: This file is placed in the public domain. "" Toggle a (tab-specific) terminal scratchpad. " " This is similar to terminal consoles available in other editors. This " still allows (and does not interfere with) other terminal windows open " for other porpuses. function! dyamon#terminal#toggle() abort if exists("t:terminal_scratchpad") && bufexists(t:terminal_scratchpad) " This could be simplified if `switchbuf` contains "useopen" if bufwinnr(t:terminal_scratchpad) == -1 echomsg "here" exec "botright sbuffer" t:terminal_scratchpad else exec bufwinnr(t:terminal_scratchpad) . "hide" endif else botright terminal let t:terminal_scratchpad = bufnr('%') endif endfunction