Last active
December 25, 2022 22:06
-
-
Save jamescherti/d552078af417a9c3c84c71d7db30f06a to your computer and use it in GitHub Desktop.
Vim: Close the buffer of all Vim terminals (Vim's built-in terminals).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Language: Vim script | |
" Author: James Cherti | |
" URL: https://gist.github.com/jamescherti/d552078af417a9c3c84c71d7db30f06a | |
" License: MIT | |
" Description: Close the buffer of all Vim terminals (Vim's built-in terminals) | |
function! CloseAllTerminals() abort | |
let l:buflist = getbufinfo() | |
for l:buf in l:buflist | |
if getbufvar(l:buf.bufnr, '&buftype', '') ==# 'terminal' | |
execute 'bdelete! ' . l:buf.bufnr | |
endif | |
endfor | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment