私が考えることができるのは、:windo
を使用して、現在のタブ内のすべてのウィンドウを繰り返し、ファイルがロードされているかどうかを確認することです。このような何か:
function! TabIsEmpty()
" Remember which window we're in at the moment
let initial_win_num = winnr()
let win_count = 0
" Add the length of the file name on to count:
" this will be 0 if there is no file name
windo let win_count += len(expand('%'))
" Go back to the initial window
exe initial_win_num . "wincmd w"
" Check count
if win_count == 0
" Tab page is empty
return 1
else
return 0
endif
endfunction
" Test it like this:
echo TabIsEmpty()
" Use it like this:
if TabIsEmpty() == 1
echo "The tab is empty"
else
echo "The tab is not empty"
endif
唯一のオープンは、ヘルプページまたはプレビューウィンドウ、またはそのような何かであるならば、私はないがwindo
は、それらの上で動作思いとして、それはおそらく1を返します。
うんを、私は戻って、ちょうど小さな変更を行いました最初のウィンドウに、私は '' exe 'normal' 'を実行しています。 initial_win_num。 "^ W^W" '。どうもありがとう! –
DrAl、ありがとう、これも私自身の問題で私を助けた:http://stackoverflow.com/q/15141979/212307 – Rixius