Do things to buffers depending on their status
Copyright 2020 Alin Mr. <almr.oss@outlook.com>
. MIT license.
:call bufcond#BufDo( 'bw', { v -> !len( v.windows ) && !v.changed }, #{} )
wipes out unmodified buffers which are not active in any tab/window. First argument is a command or a lambda, second is a lambda to filtergetbufinfo()
results, third is a dictionary passed togetbufinfo()
.- same as above, but merely unload (if loaded):
call bufcond#BufDo( { b -> execute( 'bunload ' .. b ) }, { v -> !len( v.windows ) && !v.changed && v.loaded }, #{} )
- get comprehensive info on loaded buffers, using Bufferize:
Bufferize echo join( bufcond#BufDo( { v -> v->bufinfo()[0] }, { v -> v.loaded }, #{} ), "\n" )
See bufcond.vim
With vim
8+, just drop in packpath (I personally use minpac which is almost the same thing). Autoloadable functions for now.