ブラウザをリロード

osascript -e 'tell app "Safari"' -e 'activate' -e 'do JavaScript "window.location.reload();" in first document' -e 'end tell'

System Eventsを使うので、「システム環境設定 -> ユニバーサルアクセス」の「補助装置にアクセスできるようにする」にチェックをいれる必要あり。

osascript -e 'tell app "Firefox"' -e 'activate' -e 'end tell' -e 'tell application "System Events"' -e 'keystroke "r" using command down' -e 'end tell'
function! ReloadFirefox()
    :write
    !osascript -e 'tell app "Firefox"' -e 'activate' -e 'end tell' -e 'tell application "System Events"' -e 'keystroke "r" using command down' -e 'end tell'
endfunction

map <silent> ,rf :call ReloadFirefox()<CR>