检查Vim分割窗口是否最底部/最右边

Ale*_*x B 4 vim

在VimScript中是否可以检测分割窗口是否接触真实窗口的底部和/或右边距?

mat*_*ttn 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())
Run Code Online (Sandbox Code Playgroud)

固定:

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()
Run Code Online (Sandbox Code Playgroud)