diff --git a/autoload/SpaceVim/api/vim/window.vim b/autoload/SpaceVim/api/vim/window.vim index d85865e35..7d5869622 100644 --- a/autoload/SpaceVim/api/vim/window.vim +++ b/autoload/SpaceVim/api/vim/window.vim @@ -29,6 +29,10 @@ " " Check if the window is a floating windows, return `v:true` if the window " is a floating window. +" +" winexists({winid}) +" +" Check if the window with {winid} exists in current tabpage. let s:self = {} @@ -97,6 +101,12 @@ else endfunction endif +function! s:self.winexists(winid) abort + if !exists('win_id2tabwin') + return 0 + endif + return win_id2tabwin(a:winid)[0] == tabpagenr() +endfunction function! SpaceVim#api#vim#window#get() abort return deepcopy(s:self) diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 0df6066e8..bf5c78dde 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -3720,6 +3720,10 @@ is_float({winnr}) Check if the window is a floating windows, return `v:true` if the window is a floating window. +winexists({winid}) + + Check if the window with {winid} exists in current tabpage. + ============================================================================== VIM#COMMAND *SpaceVim-api-vim-command*