gvim啓動位置固定的話容易擋到東西,因此寫了一段vimscript根據gnome-terminal的位置啓動gvim,這樣被遮住的機率就一些了。vim
fun! g:get_xterm_pos ()"{{{ if(!exists('$WINDOWID')) | return [] | endif let term_rect_info = system('xwininfo -id ' . $WINDOWID . \ '|grep "Absolute upper-left \(X\|Y\):"' . \ "|awk -F ':' '{print $2}'") let term_pos = split(term_rect_info) return term_pos endfun"}}} fun! g:update_pos_by_xterm (adjust)"{{{ if(!has('gui_running')) | return | endif let term_pos = g:get_xterm_pos() if(term_pos == []) echoerr 'update failed...' return endif exe printf('winpos %d %d', term_pos[0] + a:adjust[0], term_pos[1] + a:adjust[1]) endfun"}}} au GUIENTER * call g:update_pos_by_xterm([7, 45])
g:update_pos_by_xterm的adjust是微調位置,以gnome-terminal的左上角爲原點,[0,0]就表明和gnome-terminal徹底重疊了