Skip to content

Instantly share code, notes, and snippets.

@jamescherti
Last active December 25, 2022 22:06
Show Gist options
  • Save jamescherti/d552078af417a9c3c84c71d7db30f06a to your computer and use it in GitHub Desktop.
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).
" 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