Reputation: 84962
Is it possible in VimScript to detect if a split window touches the bottom and/or right margin of the real window?
Upvotes: 4
Views: 702
Reputation: 7733
Try this.
BITS BROKEN:
func! IsMostBottomRight(nr)
let oldw = winnr()
silent! exe "normal! \<c-w>l"
silent! exe "normal! \<c-w>j"
let neww = winnr()
silent! exe oldw.'wincmd w'
return oldw == neww
endfunction
" echo IsMostBottomRight(winnr())
FIXED:
func! IsMostBottomRight()
let oldw = winnr()
silent! exe "normal! \<c-w>l"
silent! exe "normal! \<c-w>j"
let neww = winnr()
silent! exe oldw.'wincmd w'
return oldw == neww
endfunction
" echo IsMostBottomRight()
Upvotes: 5