是否可以在VimScript中检测分割窗口是否触及真实窗口的底部和/或右边距?
答案 0 :(得分:5)
试试这个。
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()