I want to detect whether or not I am in the right most (or left, top, bottommost) split. In other words, when ctrl-w h would do nothing. Is there a way to do that?
Is there a way in vim to know I am in the left most split?
vim
There's only winnr(), which is a sequential numbering; i.e. you can only check for topleft- and bottomright-most window, but not the exact window relations. If you need this information in a mapping / script, you'd have to do exactly as you've described:function! IsLeftMostWindow()    let curNr = winnr()    wincmd h    if winnr() == curNr        return 1    endif    wincmd p  Move back.    return 0endfunctionEDIT: winnr('$') is a special case which returns the highest index in the current tab. So if winnr() == winnr('$'), you're on the leftmost (or the only) window.